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

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:56:26 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit d2aed28a32714b1497844c7f1195354060e224ab
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 1 20:45:33 2002 +0000

    	Moved involved code for loading URLs from WebBridge up to WebFrame, with a little
    	consolidation along the way.  I need to get all this stuff in one place in prep
    	for doing back-forward properly with frames.  There should be no change in
    	functionality as a result of these changes.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge loadURL:reload:]):
            (-[WebBridge postWithURL:data:contentType:]):
            (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
    	Much of the guts of these is moved to WebFramePrivate.
            * WebView.subproj/WebDataSourcePrivate.h:
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _setIsClientRedirect:]):
            (-[WebDataSource _isClientRedirect]):
    	Keep state of whether we're processing a redirect in DataSource.  I had previously
    	to do this with a loadType, but that failed because cliRedir is orthogonal.
            * WebView.subproj/WebFramePrivate.h:
    	WebFrameLoadTypeClientRedirect is gone.
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFramePrivate init]):
    	Initialize loadType explicitly.
            (-[WebFrame _transitionToCommitted]):
    	Test [dataSource _isClientRedirect] instead of looking at loadType.
            (-[WebFrame _isLoadComplete]):
    	Nuke WebFrameLoadTypeClientRedirect
            (-[WebFrame _goToItem:withFrameLoadType:]):
    	Nuke WebFrameLoadTypeClientRedirect.
            (-[WebFrame _loadRequest:]):
    	Helper method moved from WebBridge.
            (-[WebFrame _loadURL:loadType:clientRedirect:]):
    	Core impl moved up from WebBridge.
            (-[WebFrame _postWithURL:data:contentType:]):
    	Core impl moved up from WebBridge.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2529 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f0d82b1..92d05b7 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,39 @@
+2002-11-01  Trey Matteson  <trey at apple.com>
+
+	Moved involved code for loading URLs from WebBridge up to WebFrame, with a little
+	consolidation along the way.  I need to get all this stuff in one place in prep
+	for doing back-forward properly with frames.  There should be no change in
+	functionality as a result of these changes.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:reload:]):
+        (-[WebBridge postWithURL:data:contentType:]):
+        (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+	Much of the guts of these is moved to WebFramePrivate.
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setIsClientRedirect:]):
+        (-[WebDataSource _isClientRedirect]):
+	Keep state of whether we're processing a redirect in DataSource.  I had previously
+	to do this with a loadType, but that failed because cliRedir is orthogonal.
+        * WebView.subproj/WebFramePrivate.h:
+	WebFrameLoadTypeClientRedirect is gone.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFramePrivate init]):
+	Initialize loadType explicitly.
+        (-[WebFrame _transitionToCommitted]):
+	Test [dataSource _isClientRedirect] instead of looking at loadType.
+        (-[WebFrame _isLoadComplete]):
+	Nuke WebFrameLoadTypeClientRedirect
+        (-[WebFrame _goToItem:withFrameLoadType:]):
+	Nuke WebFrameLoadTypeClientRedirect.
+        (-[WebFrame _loadRequest:]):
+	Helper method moved from WebBridge.
+        (-[WebFrame _loadURL:loadType:clientRedirect:]):
+	Core impl moved up from WebBridge.
+        (-[WebFrame _postWithURL:data:contentType:]):
+	Core impl moved up from WebBridge.
+
 2002-11-01  Darin Adler  <darin at apple.com>
 
 	- implemented loop counts
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index f0d82b1..92d05b7 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,39 @@
+2002-11-01  Trey Matteson  <trey at apple.com>
+
+	Moved involved code for loading URLs from WebBridge up to WebFrame, with a little
+	consolidation along the way.  I need to get all this stuff in one place in prep
+	for doing back-forward properly with frames.  There should be no change in
+	functionality as a result of these changes.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:reload:]):
+        (-[WebBridge postWithURL:data:contentType:]):
+        (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+	Much of the guts of these is moved to WebFramePrivate.
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setIsClientRedirect:]):
+        (-[WebDataSource _isClientRedirect]):
+	Keep state of whether we're processing a redirect in DataSource.  I had previously
+	to do this with a loadType, but that failed because cliRedir is orthogonal.
+        * WebView.subproj/WebFramePrivate.h:
+	WebFrameLoadTypeClientRedirect is gone.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFramePrivate init]):
+	Initialize loadType explicitly.
+        (-[WebFrame _transitionToCommitted]):
+	Test [dataSource _isClientRedirect] instead of looking at loadType.
+        (-[WebFrame _isLoadComplete]):
+	Nuke WebFrameLoadTypeClientRedirect
+        (-[WebFrame _goToItem:withFrameLoadType:]):
+	Nuke WebFrameLoadTypeClientRedirect.
+        (-[WebFrame _loadRequest:]):
+	Helper method moved from WebBridge.
+        (-[WebFrame _loadURL:loadType:clientRedirect:]):
+	Core impl moved up from WebBridge.
+        (-[WebFrame _postWithURL:data:contentType:]):
+	Core impl moved up from WebBridge.
+
 2002-11-01  Darin Adler  <darin at apple.com>
 
 	- implemented loop counts
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index e0aee0b..a65119c 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -278,79 +278,15 @@
     [[self dataSource] _setIconURL:URL withType:type];
 }
 
-- (void)loadRequest:(WebResourceRequest *)request
-{
-    WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
-    if ([frame setProvisionalDataSource:newDataSource]) {
-        [frame startLoading];
-    }
-    [newDataSource release];
-}
-
 - (void)loadURL:(NSURL *)URL reload:(BOOL)reload
 {
-    // FIXME: This logic doesn't exactly match what KHTML does in openURL, so it's possible
-    // this will screw up in some cases involving framesets.
-    if (!reload && [[URL _web_URLByRemovingFragment] isEqual:[[self URL] _web_URLByRemovingFragment]]) {
-        [self openURL:URL];
-
-        WebDataSource *dataSource = [frame dataSource];
-        WebHistoryItem *backForwardItem = [[WebHistoryItem alloc] initWithURL:URL
-            target:[frame name] parent:[[frame parent] name] title:[dataSource pageTitle]];
-        [backForwardItem setAnchor:[URL fragment]];
-        [[[frame controller] backForwardList] addEntry:backForwardItem];
-        [backForwardItem release];
-
-        [dataSource _setURL:URL];
-        [dataSource _addBackForwardItem:backForwardItem];
-        [[[frame controller] locationChangeDelegate] locationChangedWithinPageForDataSource:dataSource];
-    } else {
-        WebFrameLoadType previousLoadType = [frame _loadType];
-        WebDataSource *oldDataSource = [[frame dataSource] retain];
-        WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
-        [request setReferrer:[self referrer]];
-        if (reload) {
-            [request setRequestCachePolicy:WebRequestCachePolicyLoadFromOrigin];
-        }
-        [self loadRequest:request];
-        if (_doingClientRedirect) {
-            // client side redirects shouldn't make a new BF item like user navigations
-            // NB: must be done after loadRequest:, which sets the provDataSource, which
-            //     inits the load type to Standard
-            if (previousLoadType == WebFrameLoadTypeInternal) {
-                // Re-set back to Internal load type, so redirect doesn't end up in BF list
-                [frame _setLoadType:WebFrameLoadTypeInternal];
-            } else {
-                // Set load type, so redirect will update current item in BF list
-                [frame _setLoadType:WebFrameLoadTypeClientRedirect];
-            }
-
-            // need to transfer BF items from the dataSource that we're replacing
-            WebDataSource *newDataSource = [frame provisionalDataSource];
-            [newDataSource _setProvisionalBackForwardItem:[oldDataSource _provisionalBackForwardItem]];
-            [newDataSource _setPreviousBackForwardItem:[oldDataSource _previousBackForwardItem]];
-            [newDataSource _addBackForwardItems:[oldDataSource _backForwardItems]];
-        }
-        [request release];
-        [oldDataSource release];
-    }
+    [frame _loadURL:URL loadType:(reload ? WebFrameLoadTypeReload : WebFrameLoadTypeStandard) clientRedirect:_doingClientRedirect];
     _doingClientRedirect = NO;
 }
 
 - (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType
 {
-    // When posting, use the WebResourceHandleFlagLoadFromOrigin load flag. 
-    // This prevents a potential bug which may cause a page
-    // with a form that uses itself as an action to be returned 
-    // from the cache without submitting.
-    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
-    [request setRequestCachePolicy:WebRequestCachePolicyLoadFromOrigin];
-    [request setMethod:@"POST"];
-    [request setData:data];
-    [request setContentType:contentType];
-    [request setReferrer:[self referrer]];
-    [self loadRequest:request];
-    [request release];
+    [frame _postWithURL:URL data:data contentType:contentType];
 }
 
 - (WebCoreBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
@@ -364,17 +300,11 @@
     }
     
     [[newFrame _bridge] setRenderPart:childRenderPart];
-    
+
     [[newFrame webView] _setMarginWidth:width];
     [[newFrame webView] _setMarginHeight:height];
-    
-    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
-    [request setReferrer:[self referrer]];
-    [[newFrame _bridge] loadRequest:request];
-    [request release];
-    
-    // Set the load type so this load doesn't end up in the back/forward list.
-    [newFrame _setLoadType:WebFrameLoadTypeInternal];
+
+    [newFrame _loadURL:URL loadType:WebFrameLoadTypeInternal clientRedirect:NO];
 
     return [newFrame _bridge];
 }
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 89948c5..856e4a8 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -43,9 +43,11 @@
     double loadingStartedTime;
     
     BOOL primaryLoadComplete;
-    
+
     BOOL stopping;
 
+    BOOL isClientRedirect;
+
     NSString *pageTitle;
     
     NSString *encoding;
@@ -63,7 +65,9 @@
 
     BOOL gotFirstByte; // got first byte
     BOOL committed; // This data source has been committed
-    
+
+    BOOL defersCallbacks;
+
     NSURL *iconURL;
     WebIconLoader *iconLoader;
 
@@ -73,8 +77,6 @@
     WebHistoryItem *previousBackForwardItem;
     // BF items that reference what we loaded - we must keep their titles up to date
     NSMutableArray *ourBackForwardItems;
-    
-    BOOL defersCallbacks;
 }
 
 @end
@@ -115,6 +117,8 @@
 - (void)_addBackForwardItem:(WebHistoryItem *)item;
 - (void)_addBackForwardItems:(NSArray *)items;
 - (NSArray *)_backForwardItems;
+- (void)_setIsClientRedirect:(BOOL)flag;
+- (BOOL)_isClientRedirect;
 
 // Convenience interface for getting here from an WebDataSource.
 // This returns nil if the representation is not an WebHTMLRepresentation.
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index fad4b05..82f3d33 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -314,6 +314,16 @@
     return [[_private->overrideEncoding copy] autorelease];
 }
 
+- (void)_setIsClientRedirect:(BOOL)flag
+{
+    _private->isClientRedirect = flag;
+}
+
+- (BOOL)_isClientRedirect
+{
+    return _private->isClientRedirect;
+}
+
 - (WebHistoryItem *)_provisionalBackForwardItem
 {
     return _private->provisionalBackForwardItem;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 6f05ade..0b77aef 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -35,7 +35,6 @@ typedef enum {
     WebFrameLoadTypeIndexedBackForward,		// a multi-item hop in the backforward list
     WebFrameLoadTypeReload,
     WebFrameLoadTypeReloadAllowingStaleData,
-    WebFrameLoadTypeClientRedirect,
     WebFrameLoadTypeInternal
 } WebFrameLoadType;
 
@@ -96,6 +95,8 @@ typedef enum {
 - (void)_setLoadType: (WebFrameLoadType)loadType;
 - (WebFrameLoadType)_loadType;
 - (void)_goToItem: (WebHistoryItem *)item withFrameLoadType: (WebFrameLoadType)type;
+- (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType clientRedirect:(BOOL)clientRedirect;
+- (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType;
 - (void)_restoreScrollPosition;
 - (void)_scrollToTop;
 - (void)_textSizeMultiplierChanged;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 395157e..c7714f6 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -50,6 +50,7 @@ static const char * const stateNames[] = {
     }
     
     state = WebFrameStateComplete;
+    loadType = WebFrameLoadTypeStandard;
     
     return self;
 }
@@ -344,22 +345,21 @@ static const char * const stateNames[] = {
                     entry = [[WebHistory sharedHistory] addEntryForURL: [[[ds _originalRequest] URL] _web_canonicalize]];
                     if (ptitle)
                         [entry setTitle: ptitle];
-                
-                    // Add item to back/forward list.
-                    parentFrame = [self parent]; 
-                    backForwardItem = [[WebHistoryItem alloc] initWithURL:[[ds request] URL]
-                                                                   target:[self name]
-                                                                   parent:[parentFrame name]
-                                                                    title:ptitle];
-                    [[[self controller] backForwardList] addEntry: backForwardItem];
-                    [ds _addBackForwardItem:backForwardItem];
-                    [backForwardItem release];
-                    // Scroll to top.
-                    break;
 
-                case WebFrameLoadTypeClientRedirect:
-                    // update the URL in the BF list
-                    [[[[self controller] backForwardList] currentEntry] setURL:[[ds request] URL]];
+                    if (![ds _isClientRedirect]) {
+                        // Add item to back/forward list.
+                        parentFrame = [self parent];
+                        backForwardItem = [[WebHistoryItem alloc] initWithURL:[[ds request] URL]
+                                                                       target:[self name]
+                                                                       parent:[parentFrame name]
+                                                                        title:ptitle];
+                        [[[self controller] backForwardList] addEntry: backForwardItem];
+                        [ds _addBackForwardItem:backForwardItem];
+                        [backForwardItem release];
+                    } else {
+                        // update the URL in the BF list that we made before the redirect
+                        [[[[self controller] backForwardList] currentEntry] setURL:[[ds request] URL]];
+                    }
                     break;
                     
                 case WebFrameLoadTypeInternal:
@@ -528,7 +528,6 @@ static const char * const stateNames[] = {
                         break;
         
                     case WebFrameLoadTypeStandard:
-                    case WebFrameLoadTypeClientRedirect:
                     case WebFrameLoadTypeInternal:
                     case WebFrameLoadTypeReloadAllowingStaleData:
                         // Do nothing.
@@ -749,8 +748,6 @@ static const char * const stateNames[] = {
                 case WebFrameLoadTypeReloadAllowingStaleData:
                     // no-op: leave as protocol default
                     break;
-                case WebFrameLoadTypeClientRedirect:
-                    // should never start out going to an item in redirect mode
                 default:
                     ASSERT_NOT_REACHED();
             }
@@ -771,6 +768,75 @@ static const char * const stateNames[] = {
     }
 }
 
+- (void)_loadRequest:(WebResourceRequest *)request
+{
+    WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
+    if ([self setProvisionalDataSource:newDataSource]) {
+        [self startLoading];
+    }
+    [newDataSource release];
+}
+
+// main funnel for navigating via callback from WebCore (e.g., clicking a link, redirect)
+- (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType clientRedirect:(BOOL)clientRedirect
+{
+    // FIXME: This logic doesn't exactly match what KHTML does in openURL, so it's possible
+    // this will screw up in some cases involving framesets.
+    if (loadType != WebFrameLoadTypeReload && [[URL _web_URLByRemovingFragment] isEqual:[[_private->bridge URL] _web_URLByRemovingFragment]]) {
+        [_private->bridge openURL:URL];
+
+        WebDataSource *dataSource = [self dataSource];
+        WebHistoryItem *backForwardItem = [[WebHistoryItem alloc] initWithURL:URL target:[self name] parent:[[self parent] name] title:[dataSource pageTitle]];
+        [backForwardItem setAnchor:[URL fragment]];
+        [[[self controller] backForwardList] addEntry:backForwardItem];
+        [backForwardItem release];
+
+        [dataSource _setURL:URL];
+        [dataSource _addBackForwardItem:backForwardItem];
+        [[[self controller] locationChangeDelegate] locationChangedWithinPageForDataSource:dataSource];
+    } else {
+        WebFrameLoadType previousLoadType = [self _loadType];
+        WebDataSource *oldDataSource = [[self dataSource] retain];
+        WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
+        [request setReferrer:[_private->bridge referrer]];
+        if (loadType == WebFrameLoadTypeReload) {
+            [request setRequestCachePolicy:WebRequestCachePolicyLoadFromOrigin];
+        }
+        [self _loadRequest:request];
+        // NB: must be done after loadRequest:, which sets the provDataSource, which
+        //     inits the load type to Standard
+        [self _setLoadType:loadType];
+        if (clientRedirect) {
+            // Inherit the loadType from the operation that spawned the redirect
+            [self _setLoadType:previousLoadType];
+
+            // need to transfer BF items from the dataSource that we're replacing
+            WebDataSource *newDataSource = [self provisionalDataSource];
+            [newDataSource _setIsClientRedirect:YES];
+            [newDataSource _setProvisionalBackForwardItem:[oldDataSource _provisionalBackForwardItem]];
+            [newDataSource _setPreviousBackForwardItem:[oldDataSource _previousBackForwardItem]];
+            [newDataSource _addBackForwardItems:[oldDataSource _backForwardItems]];
+        }
+        [request release];
+        [oldDataSource release];
+    }
+}
+
+- (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType
+{
+    // When posting, use the WebResourceHandleFlagLoadFromOrigin load flag.
+    // This prevents a potential bug which may cause a page with a form that uses itself
+    // as an action to be returned from the cache without submitting.
+    WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
+    [request setRequestCachePolicy:WebRequestCachePolicyLoadFromOrigin];
+    [request setMethod:@"POST"];
+    [request setData:data];
+    [request setContentType:contentType];
+    [request setReferrer:[_private->bridge referrer]];
+    [self _loadRequest:request];
+    [request release];
+}
+
 - (void)_restoreScrollPosition
 {
     WebHistoryItem *entry;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list