[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:26:35 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit bff00ea043e989a607dd3eb62c238b83eee2497e
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 28 22:07:21 2003 +0000

            Reviewed by Trey.
    
            - fixed 3183575 -- <https://sbcreg.sbcglobal.net> casuses infinite refresh & crash
    
            The page had history.forward(1) which was causing us to reload.
    
            * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge goBackOrForward:]):
            Handle edge cases by checking backListCount and forwardListCount at this level.
            Be sure to do nothing when we are already on the right page.
    
            * History.subproj/WebBackForwardList.h: Added forwardListCount, updated comment for entryAtIndex.
            * History.subproj/WebBackForwardList.m:
            (-[WebBackForwardList forwardListCount]): Added.
            (-[WebBackForwardList entryAtIndex:]): Return nil for out of range indices.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3717 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7d100d4..ac951f1 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,20 @@
+2003-02-28  Darin Adler  <darin at apple.com>
+
+        Reviewed by Trey.
+
+        - fixed 3183575 -- <https://sbcreg.sbcglobal.net> casuses infinite refresh & crash
+        
+        The page had history.forward(1) which was causing us to reload.
+
+        * WebCoreSupport.subproj/WebBridge.m: (-[WebBridge goBackOrForward:]):
+        Handle edge cases by checking backListCount and forwardListCount at this level.
+        Be sure to do nothing when we are already on the right page.
+
+        * History.subproj/WebBackForwardList.h: Added forwardListCount, updated comment for entryAtIndex.
+        * History.subproj/WebBackForwardList.m:
+        (-[WebBackForwardList forwardListCount]): Added.
+        (-[WebBackForwardList entryAtIndex:]): Return nil for out of range indices.
+        
 2003-02-27  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Richard.
diff --git a/WebKit/History.subproj/WebBackForwardList.h b/WebKit/History.subproj/WebBackForwardList.h
index 918d6f7..89df1d9 100644
--- a/WebKit/History.subproj/WebBackForwardList.h
+++ b/WebKit/History.subproj/WebBackForwardList.h
@@ -155,10 +155,17 @@
 - (int)backListCount;
 
 /*!
+    @method forwardListCount
+    @abstract Returns the forward list's current count.
+    @result The number of items in the list.
+*/
+- (int)forwardListCount;
+
+/*!
     @method entryAtIndex:
     @abstract Returns an entry the given distance from the current entry.
     @param index Index of the desired list item relative to the current item; 0 is current item, -1 is back item, 1 is forward item, etc.
-    @result The entry the given distance from the current entry. If index exceeds the limits of the list, the entry furthest in that direction is returned.
+    @result The entry the given distance from the current entry. If index exceeds the limits of the list, nil is returned.
 */
 - (WebHistoryItem *)entryAtIndex:(int)index;
 
diff --git a/WebKit/History.subproj/WebBackForwardList.m b/WebKit/History.subproj/WebBackForwardList.m
index aa072c8..0be152e 100644
--- a/WebKit/History.subproj/WebBackForwardList.m
+++ b/WebKit/History.subproj/WebBackForwardList.m
@@ -254,14 +254,19 @@ static BOOL usesPageCache = YES;
     return _current;
 }
 
+- (int)forwardListCount
+{
+    return (int)[_entries count] - (_current + 1);
+}
+
 - (WebHistoryItem *)entryAtIndex:(int)index
 {
     // Do range checks without doing math on index to avoid overflow.
     if (index < -_current) {
-        return [_entries objectAtIndex:0];
+        return nil;
     }
-    if (index >= (int)[_entries count] - _current) {
-        return [_entries lastObject];
+    if (index > [self forwardListCount]) {
+        return nil;
     }
     return [_entries objectAtIndex:index + _current];
 }
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index d068084..8a65c2c 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -627,8 +627,25 @@ static BOOL loggedObjectCacheSize = NO;
 
 - (void)goBackOrForward:(int)distance
 {
+    if (distance == 0) {
+        return;
+    }
     WebController *controller = [frame controller];
-    WebHistoryItem *item = [[controller backForwardList] entryAtIndex:distance];
+    WebBackForwardList *list = [controller backForwardList];
+    WebHistoryItem *item = [list entryAtIndex:distance];
+    if (!item) {
+        if (distance > 0) {
+            int forwardListCount = [list forwardListCount];
+            if (forwardListCount > 0) {
+                item = [list entryAtIndex:forwardListCount];
+            }
+        } else {
+            int backListCount = [list forwardListCount];
+            if (backListCount > 0) {
+                item = [list entryAtIndex:-backListCount];
+            }
+        }
+    }
     if (item) {
         [controller goBackOrForwardToItem:item];
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list