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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:00:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 604b196575ae9a486f84302d4c6d8eda603f46b4
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 15 10:48:18 2002 +0000

    	Refactor so that all invocations of navigation policy are set up
    	to be asynchronous. However, the actually delegate method is not
    	async yet.
    
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _checkNavigationPolicyForRequest:dataSource:andCall:withSelector:]):
            (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]):
            (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]):
            (-[WebFrame _continueLoadRequestAfterNavigationPolicy:request:]):
            (-[WebFrame _loadDataSource:withLoadType:]):
            * WebView.subproj/WebMainResourceClient.h:
            * WebView.subproj/WebMainResourceClient.m:
            (-[WebMainResourceClient stopLoadingForPolicyChange]):
            (-[WebMainResourceClient continueAfterNavigationPolicy:request:]):
            (-[WebMainResourceClient handle:willSendRequest:]):
            (-[WebMainResourceClient handle:didReceiveResponse:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2686 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index f40f9df..569e4ab 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2002-11-15  Maciej Stachowiak  <mjs at apple.com>
+
+	Refactor so that all invocations of navigation policy are set up
+	to be asynchronous. However, the actually delegate method is not
+	async yet.
+	
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _checkNavigationPolicyForRequest:dataSource:andCall:withSelector:]):
+        (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]):
+        (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]):
+        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:request:]):
+        (-[WebFrame _loadDataSource:withLoadType:]):
+        * WebView.subproj/WebMainResourceClient.h:
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient stopLoadingForPolicyChange]):
+        (-[WebMainResourceClient continueAfterNavigationPolicy:request:]):
+        (-[WebMainResourceClient handle:willSendRequest:]):
+        (-[WebMainResourceClient handle:didReceiveResponse:]):
+
 2002-11-14  Maciej Stachowiak  <mjs at apple.com>
 
 	Refactor things a bit so all loads bottleneck through a single
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index f40f9df..569e4ab 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,23 @@
+2002-11-15  Maciej Stachowiak  <mjs at apple.com>
+
+	Refactor so that all invocations of navigation policy are set up
+	to be asynchronous. However, the actually delegate method is not
+	async yet.
+	
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _checkNavigationPolicyForRequest:dataSource:andCall:withSelector:]):
+        (-[WebFrame _continueFragmentScrollAfterNavigationPolicy:request:]):
+        (-[WebFrame _loadURL:loadType:triggeringEvent:isFormSubmission:]):
+        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:request:]):
+        (-[WebFrame _loadDataSource:withLoadType:]):
+        * WebView.subproj/WebMainResourceClient.h:
+        * WebView.subproj/WebMainResourceClient.m:
+        (-[WebMainResourceClient stopLoadingForPolicyChange]):
+        (-[WebMainResourceClient continueAfterNavigationPolicy:request:]):
+        (-[WebMainResourceClient handle:willSendRequest:]):
+        (-[WebMainResourceClient handle:didReceiveResponse:]):
+
 2002-11-14  Maciej Stachowiak  <mjs at apple.com>
 
 	Refactor things a bit so all loads bottleneck through a single
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 3f239e1..44ee540 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -103,11 +103,12 @@ typedef enum {
 - (void)_checkLoadComplete;
 - (void)_timedLayout: userInfo;
 - (WebBridge *)_bridge;
-- (BOOL)_shouldShowRequest:(WebResourceRequest *)request;
 - (void)_clearProvisionalDataSource;
 - (void)_setLoadType: (WebFrameLoadType)loadType;
 - (WebFrameLoadType)_loadType;
 
+- (void)_checkNavigationPolicyForRequest:(WebResourceRequest *)request dataSource:(WebDataSource *)dataSource andCall:(id)target withSelector:(SEL)selector;
+
 - (NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event;
 - (BOOL)_continueAfterNavigationPolicyForRequest:(WebResourceRequest *)request dataSource:(WebDataSource *)dataSource;
 - (void)_goToItem: (WebHistoryItem *)item withLoadType: (WebFrameLoadType)type;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 6f9b836..988a473 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -731,11 +731,6 @@ static const char * const stateNames[] = {
     [[[self controller] policyDelegate] unableToImplementPolicy:policy error:error forURL:URL inFrame:self];    
 }
 
-- (BOOL)_shouldShowRequest:(WebResourceRequest *)request
-{
-    return [self _continueAfterNavigationPolicyForRequest:request dataSource:[self provisionalDataSource]];
-}
-
 - (void)_clearProvisionalDataSource
 {
     [_private setProvisionalDataSource:nil];
@@ -920,6 +915,12 @@ static const char * const stateNames[] = {
 			 forKey:WebActionNavigationTypeKey];
 }
 
+- (void)_checkNavigationPolicyForRequest:(WebResourceRequest *)request dataSource:(WebDataSource *)dataSource andCall:(id)target withSelector:(SEL)selector
+{
+    BOOL shouldContinue = [self _continueAfterNavigationPolicyForRequest:request dataSource:dataSource];
+    [target performSelector:selector withObject:(id)(unsigned)shouldContinue withObject:request];
+}
+
 -(BOOL)_continueAfterNavigationPolicyForRequest:(WebResourceRequest *)request dataSource:(WebDataSource *)dataSource
 {
     NSDictionary *action = [dataSource _triggeringAction];
@@ -984,6 +985,35 @@ static const char * const stateNames[] = {
     return NO;
 }
 
+
+
+-(void)_continueFragmentScrollAfterNavigationPolicy:(BOOL)shouldContinue request:(WebResourceRequest *)request
+{
+    if (!shouldContinue) {
+	return;
+    }
+
+    NSURL *URL = [request URL];
+    WebDataSource *dataSrc = [self dataSource];
+
+    // save scroll position before we open URL, which will jump to anchor
+    [self _saveScrollPositionToItem:[_private currentItem]];
+    
+    // ???Might need to save scroll-state, form-state for all other frames
+    
+    ASSERT(![_private previousItem]);
+    // will save form state to current item, since prevItem not set
+    [_private->bridge openURL:URL reload:NO headers:nil];
+    [dataSrc _setURL:URL];
+    // NB: must happen after _setURL, since we add based on the current request
+    [self _addBackForwardItemClippedAtTarget:NO];
+    // This will clear previousItem from the rest of the frame tree tree that didn't
+    // doing any loading.  We need to make a pass on this now, since for anchor nav
+    // we'll not go through a real load and reach Completed state
+    [self _checkLoadComplete];
+    [[[self controller] locationChangeDelegate] locationChangedWithinPageForDataSource:dataSrc];
+}
+
 // main funnel for navigating via callback from WebCore (e.g., clicking a link, redirect)
 - (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission
 {
@@ -1013,26 +1043,7 @@ static const char * const stateNames[] = {
 
         WebDataSource *dataSrc = [self dataSource];
 	[dataSrc _setTriggeringAction:action];
-	if (![self _continueAfterNavigationPolicyForRequest:request dataSource:dataSrc]) {
-	    return;
-	}
-
-        // save scroll position before we open URL, which will jump to anchor
-        [self _saveScrollPositionToItem:[_private currentItem]];
-
-        // ???Might need to save scroll-state, form-state for all other frames
-
-        ASSERT(![_private previousItem]);
-        // will save form state to current item, since prevItem not set
-        [_private->bridge openURL:URL reload:NO headers:nil];
-        [dataSrc _setURL:URL];
-        // NB: must happen after _setURL, since we add based on the current request
-        [self _addBackForwardItemClippedAtTarget:NO];
-        // This will clear previousItem from the rest of the frame tree tree that didn't
-        // doing any loading.  We need to make a pass on this now, since for anchor nav
-        // we'll not go through a real load and reach Completed state
-        [self _checkLoadComplete];
-        [[[self controller] locationChangeDelegate] locationChangedWithinPageForDataSource:dataSrc];
+	[self _checkNavigationPolicyForRequest:request dataSource:dataSrc andCall:self withSelector:@selector(_continueFragmentScrollAfterNavigationPolicy:request:)];
     } else {
         WebFrameLoadType previousLoadType = [self _loadType];
         WebDataSource *oldDataSource = [[self dataSource] retain];
@@ -1259,6 +1270,25 @@ static const char * const stateNames[] = {
     return [_private currentItem];
 }
 
+-(void)_continueLoadRequestAfterNavigationPolicy:(BOOL)shouldContinue request:(WebResourceRequest *)request
+{
+    if (!shouldContinue) {
+	[self _setLoadType: WebFrameLoadTypeStandard];
+	[_private setProvisionalDataSource:nil];
+        return;
+    }
+    
+    // We tell the documentView provisionalDataSourceChanged:
+    // once it has been created by the controller.
+    
+    [self _setState: WebFrameStateProvisional];
+    
+    if (self == [[self controller] mainFrame])
+        LOG(DocumentLoad, "loading %@", [[[self provisionalDataSource] request] URL]);
+
+    [_private->provisionalDataSource startLoading];
+}
+
 - (void)_loadDataSource:(WebDataSource *)newDataSource withLoadType: (WebFrameLoadType)loadType
 {
     ASSERT([self controller] != nil);
@@ -1272,16 +1302,8 @@ static const char * const stateNames[] = {
         [self stopLoading];
     }
 
-    [self _setLoadType: WebFrameLoadTypeStandard];
-
-    // _continueAfterNavigationPolicyForRequest:dataSource: asks the
-    // client for the URL policies and reports errors if there are any
-    // returns YES if we should show the data source
+    [self _setLoadType:loadType];
 
-    if (![self _continueAfterNavigationPolicyForRequest:[newDataSource request] dataSource:newDataSource]) {
-        return;
-    }
-    
     if ([self parent]) {
         [newDataSource _setOverrideEncoding:[[[self parent] dataSource] _overrideEncoding]];
     }
@@ -1289,18 +1311,8 @@ static const char * const stateNames[] = {
     [_private setProvisionalDataSource:newDataSource];
     
     ASSERT([newDataSource webFrame] == self);
-    
-    // We tell the documentView provisionalDataSourceChanged:
-    // once it has been created by the controller.
-    
-    [self _setState: WebFrameStateProvisional];
-    
-    [self _setLoadType:loadType];
 
-    if (self == [[self controller] mainFrame])
-        LOG(DocumentLoad, "loading %@", [[[self provisionalDataSource] request] URL]);
-
-    [_private->provisionalDataSource startLoading];
+    [self _checkNavigationPolicyForRequest:[newDataSource request] dataSource:newDataSource andCall:self withSelector:@selector(_continueLoadRequestAfterNavigationPolicy:request:)];
 }
 
 - (void)_downloadRequest:(WebResourceRequest *)request toPath:(NSString *)path
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.h b/WebKit/WebView.subproj/WebMainResourceClient.h
index 8e84eb8..eec7ef4 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.h
+++ b/WebKit/WebView.subproj/WebMainResourceClient.h
@@ -26,6 +26,7 @@
     NSMutableData *resourceData;
     int _contentLength; // for logging only
     int _bytesReceived; // for logging only
+    BOOL defersBeforeCheckingPolicy;
 }
 
 - initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceClient.m b/WebKit/WebView.subproj/WebMainResourceClient.m
index 741762b..efddd1d 100644
--- a/WebKit/WebView.subproj/WebMainResourceClient.m
+++ b/WebKit/WebView.subproj/WebMainResourceClient.m
@@ -91,6 +91,25 @@
     [self release];
 }
 
+
+-(void)stopLoadingForPolicyChange
+{
+    [[dataSource webFrame] _clearProvisionalDataSource];
+    [self notifyDelegatesOfInterruptionByPolicyChange];
+    [self cancelQuietly];
+}
+
+-(void)continueAfterNavigationPolicy:(BOOL)shouldContinue request:(WebResourceRequest *)request
+{
+    if (!defersBeforeCheckingPolicy) {
+	[[dataSource controller] _setDefersCallbacks:NO];
+    }
+
+    if (!shouldContinue) {
+	[self stopLoadingForPolicyChange];
+    }
+}
+
 -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
 {
     newRequest = [super handle:h willSendRequest:newRequest];
@@ -99,16 +118,6 @@
 
     NSURL *URL = [newRequest URL];
 
-    if (![[dataSource webFrame] _shouldShowRequest:newRequest]) {
-        [self cancelQuietly];
-
-        [[dataSource webFrame] _clearProvisionalDataSource];
-	[[[dataSource controller] locationChangeDelegate] locationChangeDone:
-            [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil]
-            forDataSource:dataSource];
-        return nil;
-    }
-    
     LOG(Redirect, "URL = %@", URL);
     
     // Update cookie policy base URL as URL changes, except for subframes, which use the
@@ -120,7 +129,14 @@
     // Don't set this on the first request.  It is set
     // when the main load was started.
     [dataSource _setRequest:newRequest];
-    
+
+    defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
+    if (!defersBeforeCheckingPolicy) {
+	[[dataSource controller] _setDefersCallbacks:YES];
+    }
+
+    [[dataSource webFrame] _checkNavigationPolicyForRequest:newRequest dataSource:dataSource andCall:self withSelector:@selector(continueAfterNavigationPolicy:request:)];
+
     return newRequest;
 }
 
@@ -133,14 +149,6 @@
     [super notifyDelegatesOfInterruptionByPolicyChange];
 }
 
-
--(void)stopLoadingAfterContentPolicy
-{
-    [[dataSource webFrame] _clearProvisionalDataSource];
-    [self notifyDelegatesOfInterruptionByPolicyChange];
-    [self cancelQuietly];
-}
-
 -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
 {
     [dataSource _setResponse:r];
@@ -165,7 +173,7 @@
     case WebPolicyShow:
 	if (![WebController canShowMIMEType:[r contentType]]) {
 	    [[dataSource webFrame] _handleUnimplementablePolicy:contentPolicy errorCode:WebErrorCannotShowMIMEType forURL:[req URL]];
-	    [self stopLoadingAfterContentPolicy];
+	    [self stopLoadingForPolicyChange];
 	    return;
 	}
         break;
@@ -198,7 +206,7 @@
 	    }
 	}
 
-	[self stopLoadingAfterContentPolicy];
+	[self stopLoadingForPolicyChange];
 	return;
 	break;
 	
@@ -209,12 +217,12 @@
 	    [[dataSource webFrame] _handleUnimplementablePolicy:contentPolicy errorCode:WebErrorFinderCannotOpenDirectory forURL:[req URL]];
 	}
 
-	[self stopLoadingAfterContentPolicy];
+	[self stopLoadingForPolicyChange];
 	return;
 	break;
     
     case WebPolicyIgnore:
-	[self stopLoadingAfterContentPolicy];
+	[self stopLoadingForPolicyChange];
 	return;
         break;
     
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.h b/WebKit/WebView.subproj/WebMainResourceLoader.h
index 8e84eb8..eec7ef4 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.h
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.h
@@ -26,6 +26,7 @@
     NSMutableData *resourceData;
     int _contentLength; // for logging only
     int _bytesReceived; // for logging only
+    BOOL defersBeforeCheckingPolicy;
 }
 
 - initWithDataSource:(WebDataSource *)dataSource;
diff --git a/WebKit/WebView.subproj/WebMainResourceLoader.m b/WebKit/WebView.subproj/WebMainResourceLoader.m
index 741762b..efddd1d 100644
--- a/WebKit/WebView.subproj/WebMainResourceLoader.m
+++ b/WebKit/WebView.subproj/WebMainResourceLoader.m
@@ -91,6 +91,25 @@
     [self release];
 }
 
+
+-(void)stopLoadingForPolicyChange
+{
+    [[dataSource webFrame] _clearProvisionalDataSource];
+    [self notifyDelegatesOfInterruptionByPolicyChange];
+    [self cancelQuietly];
+}
+
+-(void)continueAfterNavigationPolicy:(BOOL)shouldContinue request:(WebResourceRequest *)request
+{
+    if (!defersBeforeCheckingPolicy) {
+	[[dataSource controller] _setDefersCallbacks:NO];
+    }
+
+    if (!shouldContinue) {
+	[self stopLoadingForPolicyChange];
+    }
+}
+
 -(WebResourceRequest *)handle:(WebResourceHandle *)h willSendRequest:(WebResourceRequest *)newRequest
 {
     newRequest = [super handle:h willSendRequest:newRequest];
@@ -99,16 +118,6 @@
 
     NSURL *URL = [newRequest URL];
 
-    if (![[dataSource webFrame] _shouldShowRequest:newRequest]) {
-        [self cancelQuietly];
-
-        [[dataSource webFrame] _clearProvisionalDataSource];
-	[[[dataSource controller] locationChangeDelegate] locationChangeDone:
-            [WebError errorWithCode:WebErrorLocationChangeInterruptedByPolicyChange inDomain:WebErrorDomainWebKit failingURL:nil]
-            forDataSource:dataSource];
-        return nil;
-    }
-    
     LOG(Redirect, "URL = %@", URL);
     
     // Update cookie policy base URL as URL changes, except for subframes, which use the
@@ -120,7 +129,14 @@
     // Don't set this on the first request.  It is set
     // when the main load was started.
     [dataSource _setRequest:newRequest];
-    
+
+    defersBeforeCheckingPolicy = [[dataSource controller] _defersCallbacks];
+    if (!defersBeforeCheckingPolicy) {
+	[[dataSource controller] _setDefersCallbacks:YES];
+    }
+
+    [[dataSource webFrame] _checkNavigationPolicyForRequest:newRequest dataSource:dataSource andCall:self withSelector:@selector(continueAfterNavigationPolicy:request:)];
+
     return newRequest;
 }
 
@@ -133,14 +149,6 @@
     [super notifyDelegatesOfInterruptionByPolicyChange];
 }
 
-
--(void)stopLoadingAfterContentPolicy
-{
-    [[dataSource webFrame] _clearProvisionalDataSource];
-    [self notifyDelegatesOfInterruptionByPolicyChange];
-    [self cancelQuietly];
-}
-
 -(void)handle:(WebResourceHandle *)h didReceiveResponse:(WebResourceResponse *)r
 {
     [dataSource _setResponse:r];
@@ -165,7 +173,7 @@
     case WebPolicyShow:
 	if (![WebController canShowMIMEType:[r contentType]]) {
 	    [[dataSource webFrame] _handleUnimplementablePolicy:contentPolicy errorCode:WebErrorCannotShowMIMEType forURL:[req URL]];
-	    [self stopLoadingAfterContentPolicy];
+	    [self stopLoadingForPolicyChange];
 	    return;
 	}
         break;
@@ -198,7 +206,7 @@
 	    }
 	}
 
-	[self stopLoadingAfterContentPolicy];
+	[self stopLoadingForPolicyChange];
 	return;
 	break;
 	
@@ -209,12 +217,12 @@
 	    [[dataSource webFrame] _handleUnimplementablePolicy:contentPolicy errorCode:WebErrorFinderCannotOpenDirectory forURL:[req URL]];
 	}
 
-	[self stopLoadingAfterContentPolicy];
+	[self stopLoadingForPolicyChange];
 	return;
 	break;
     
     case WebPolicyIgnore:
-	[self stopLoadingAfterContentPolicy];
+	[self stopLoadingForPolicyChange];
 	return;
         break;
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list