[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 06:59:39 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 368154da987b78fbbc70eb566bd4d6762c3d65f6
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 13 10:56:21 2002 +0000

    WebCore:
    
    	- fixed 3050447 - Policy handlers have no way of telling client
    	that the proposed navigation is a form post
    
            * khtml/khtml_part.cpp:
            (KHTMLPart::submitForm): Call kwq->submitForm
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::openURL): Adjusted for bridge API change.
            (KWQKHTMLPart::openURLRequest): Removed POST handling.
    	(KWQKHTMLPart::submitForm): Added this back, because we need to
    	know what URL navigations are caused by form submission, even if
    	they are not POSTs.
            (KWQKHTMLPart::urlSelected): Adjusted for bridge API change.
            * kwq/WebCoreBridge.h: Add triggeringEvent: parameter to postURL:
    	and isFormSubmission: parameter to loadURL:.
    
    WebKit:
    
    	- fixed 3050447 - Policy handlers have no way of telling client
    	that the proposed navigation is a form post
    
    	Now we pass form submissions through all the normal policy steps.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge loadURL:reload:triggeringEvent:isFormSubmission:]):
            (-[WebBridge postWithURL:data:contentType:triggeringEvent:]):
            (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
            * WebView.subproj/WebDataSourcePrivate.h:
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSourcePrivate dealloc]):
            (-[WebDataSource _setTriggeringAction:]):
            (-[WebDataSource _triggeringAction]):
            (-[WebDataSource _lastCheckedRequest]):
            (-[WebDataSource _setLastCheckedRequest:]):
            * WebView.subproj/WebFrame.m:
            (-[WebFrame setProvisionalDataSource:]):
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _shouldShowRequest:]):
            (-[WebFrame _loadRequest:triggeringAction:]):
            (-[WebFrame _actionInformationForNavigationType:event:]):
            (-[WebFrame _continueAfterNavigationPolicyForRequest:dataSource:]):
            (-[WebFrame _loadURL:loadType:clientRedirect:triggeringEvent:isFormSubmission:]):
            (-[WebFrame _loadURL:intoChild:]):
            (-[WebFrame _postWithURL:data:contentType:triggeringEvent:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2652 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 1bc9e80..e8e1179 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,21 @@
+2002-11-13  Maciej Stachowiak  <mjs at apple.com>
+
+	- fixed 3050447 - Policy handlers have no way of telling client
+	that the proposed navigation is a form post
+	
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::submitForm): Call kwq->submitForm
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::openURL): Adjusted for bridge API change.
+        (KWQKHTMLPart::openURLRequest): Removed POST handling.
+	(KWQKHTMLPart::submitForm): Added this back, because we need to
+	know what URL navigations are caused by form submission, even if
+	they are not POSTs.
+        (KWQKHTMLPart::urlSelected): Adjusted for bridge API change.
+        * kwq/WebCoreBridge.h: Add triggeringEvent: parameter to postURL:
+	and isFormSubmission: parameter to loadURL:.
+
 2002-11-12  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3032869, the background image for the body was being
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 1bc9e80..e8e1179 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,21 @@
+2002-11-13  Maciej Stachowiak  <mjs at apple.com>
+
+	- fixed 3050447 - Policy handlers have no way of telling client
+	that the proposed navigation is a form post
+	
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::submitForm): Call kwq->submitForm
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::openURL): Adjusted for bridge API change.
+        (KWQKHTMLPart::openURLRequest): Removed POST handling.
+	(KWQKHTMLPart::submitForm): Added this back, because we need to
+	know what URL navigations are caused by form submission, even if
+	they are not POSTs.
+        (KWQKHTMLPart::urlSelected): Adjusted for bridge API change.
+        * kwq/WebCoreBridge.h: Add triggeringEvent: parameter to postURL:
+	and isFormSubmission: parameter to loadURL:.
+
 2002-11-12  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3032869, the background image for the body was being
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 1bc9e80..e8e1179 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,21 @@
+2002-11-13  Maciej Stachowiak  <mjs at apple.com>
+
+	- fixed 3050447 - Policy handlers have no way of telling client
+	that the proposed navigation is a form post
+	
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::submitForm): Call kwq->submitForm
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::openURL): Adjusted for bridge API change.
+        (KWQKHTMLPart::openURLRequest): Removed POST handling.
+	(KWQKHTMLPart::submitForm): Added this back, because we need to
+	know what URL navigations are caused by form submission, even if
+	they are not POSTs.
+        (KWQKHTMLPart::urlSelected): Adjusted for bridge API change.
+        * kwq/WebCoreBridge.h: Add triggeringEvent: parameter to postURL:
+	and isFormSubmission: parameter to loadURL:.
+
 2002-11-12  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3032869, the background image for the body was being
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 3b22dec..0ea29ef 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -3169,7 +3169,11 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
   }
   else
   {
+#if APPLE_CHANGES
+    kwq->submitForm( u, args);
+#else
     emit d->m_extension->openURLRequest( u, args );
+#endif
   }
 }
 
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index e2cfd2f..f9ad038 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -80,6 +80,7 @@ public:
 
     void openURL(const KURL &);
     void openURLRequest(const KURL &, const KParts::URLArgs &);
+    void submitForm(const KURL &, const KParts::URLArgs &);
     
     void slotData(NSString *, bool forceEncoding, const char *bytes, int length, bool complete = false);
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 63190bd..21517e0 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -144,7 +144,7 @@ void KWQKHTMLPart::openURL(const KURL &url)
     // FIXME: The lack of args here to get the reload flag from
     // indicates a problem in how we use KHTMLPart::processObjectRequest,
     // where we are opening the URL before the args are set up.
-    [_bridge loadURL:cocoaURL reload:NO triggeringEvent:nil];
+    [_bridge loadURL:cocoaURL reload:NO triggeringEvent:nil isFormSubmission:NO];
 }
 
 void KWQKHTMLPart::openURLRequest(const KURL &url, const URLArgs &args)
@@ -155,14 +155,25 @@ void KWQKHTMLPart::openURLRequest(const KURL &url, const URLArgs &args)
         return;
     }
     
+    [bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:nil isFormSubmission:NO];
+}
+
+void KWQKHTMLPart::submitForm(const KURL &url, const URLArgs &args)
+{
+    NSURL *cocoaURL = url.getNSURL();
+    if (cocoaURL == nil) {
+        // FIXME: Do we need to report an error to someone?
+        return;
+    }
+    
     if (!args.doPost()) {
-        [bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:nil];
+        [bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:_currentEvent isFormSubmission:YES];
     } else {
         QString contentType = args.contentType();
         ASSERT(contentType.startsWith("Content-Type: "));
         [bridgeForFrameName(args.frameName) postWithURL:cocoaURL
             data:[NSData dataWithBytes:args.postData.data() length:args.postData.size()]
-            contentType:contentType.mid(14).getNSString()];
+            contentType:contentType.mid(14).getNSString() triggeringEvent:_currentEvent];
     }
 }
 
@@ -193,7 +204,7 @@ void KWQKHTMLPart::urlSelected(const KURL &url, int button, int state, const URL
         return;
     }
     
-    [bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:_currentEvent];
+    [bridgeForFrameName(args.frameName) loadURL:cocoaURL reload:args.reload triggeringEvent:_currentEvent isFormSubmission:NO];
 }
 
 class KWQPluginPart : public ReadOnlyPart
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 9f682e7..27a772c 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -178,8 +178,8 @@ enum FrameBorderStyle {
 /* Creates a name for an frame unnamed in the HTML.  It should produce repeatable results for loads of the same frameset. */
 - (NSString *)generateFrameName;
 
-- (void)loadURL:(NSURL *)URL reload:(BOOL)reload triggeringEvent:(NSEvent *)event;
-- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType;
+- (void)loadURL:(NSURL *)URL reload:(BOOL)reload triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission;
+- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event;
 
 - (WebCoreBridge *)createWindowWithURL:(NSURL *)URL frameName:(NSString *)name;
 - (void)showWindow;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ead40aa..33ea0fd 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,33 @@
+2002-11-13  Maciej Stachowiak  <mjs at apple.com>
+
+	- fixed 3050447 - Policy handlers have no way of telling client
+	that the proposed navigation is a form post
+
+	Now we pass form submissions through all the normal policy steps.
+	
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:reload:triggeringEvent:isFormSubmission:]):
+        (-[WebBridge postWithURL:data:contentType:triggeringEvent:]):
+        (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSourcePrivate dealloc]):
+        (-[WebDataSource _setTriggeringAction:]):
+        (-[WebDataSource _triggeringAction]):
+        (-[WebDataSource _lastCheckedRequest]):
+        (-[WebDataSource _setLastCheckedRequest:]):
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame setProvisionalDataSource:]):
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _shouldShowRequest:]):
+        (-[WebFrame _loadRequest:triggeringAction:]):
+        (-[WebFrame _actionInformationForNavigationType:event:]):
+        (-[WebFrame _continueAfterNavigationPolicyForRequest:dataSource:]):
+        (-[WebFrame _loadURL:loadType:clientRedirect:triggeringEvent:isFormSubmission:]):
+        (-[WebFrame _loadURL:intoChild:]):
+        (-[WebFrame _postWithURL:data:contentType:triggeringEvent:]):
+
 2002-11-12  Maciej Stachowiak  <mjs at apple.com>
 
 	Combine click policy and URL policy into navigation policy.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index ead40aa..33ea0fd 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,33 @@
+2002-11-13  Maciej Stachowiak  <mjs at apple.com>
+
+	- fixed 3050447 - Policy handlers have no way of telling client
+	that the proposed navigation is a form post
+
+	Now we pass form submissions through all the normal policy steps.
+	
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge loadURL:reload:triggeringEvent:isFormSubmission:]):
+        (-[WebBridge postWithURL:data:contentType:triggeringEvent:]):
+        (-[WebBridge createChildFrameNamed:withURL:renderPart:allowsScrolling:marginWidth:marginHeight:]):
+        * WebView.subproj/WebDataSourcePrivate.h:
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSourcePrivate dealloc]):
+        (-[WebDataSource _setTriggeringAction:]):
+        (-[WebDataSource _triggeringAction]):
+        (-[WebDataSource _lastCheckedRequest]):
+        (-[WebDataSource _setLastCheckedRequest:]):
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame setProvisionalDataSource:]):
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _shouldShowRequest:]):
+        (-[WebFrame _loadRequest:triggeringAction:]):
+        (-[WebFrame _actionInformationForNavigationType:event:]):
+        (-[WebFrame _continueAfterNavigationPolicyForRequest:dataSource:]):
+        (-[WebFrame _loadURL:loadType:clientRedirect:triggeringEvent:isFormSubmission:]):
+        (-[WebFrame _loadURL:intoChild:]):
+        (-[WebFrame _postWithURL:data:contentType:triggeringEvent:]):
+
 2002-11-12  Maciej Stachowiak  <mjs at apple.com>
 
 	Combine click policy and URL policy into navigation policy.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index ad959ff..5747135 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -276,15 +276,15 @@
     [[self dataSource] _setIconURL:URL withType:type];
 }
 
-- (void)loadURL:(NSURL *)URL reload:(BOOL)reload triggeringEvent:(NSEvent *)event
+- (void)loadURL:(NSURL *)URL reload:(BOOL)reload triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission
 {
-    [frame _loadURL:URL loadType:(reload ? WebFrameLoadTypeReload : WebFrameLoadTypeStandard) clientRedirect:_doingClientRedirect triggeringEvent:event];
+    [frame _loadURL:URL loadType:(reload ? WebFrameLoadTypeReload : WebFrameLoadTypeStandard) clientRedirect:_doingClientRedirect triggeringEvent:event isFormSubmission:isFormSubmission];
     _doingClientRedirect = NO;
 }
 
-- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType
+- (void)postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event
 {
-    [frame _postWithURL:URL data:data contentType:contentType];
+    [frame _postWithURL:URL data:data contentType:contentType triggeringEvent:event];
 }
 
 - (NSString *)generateFrameName
@@ -308,7 +308,7 @@
     [[newFrame webView] _setMarginHeight:height];
 
     // We must avoid loading the document itself as a subframe, like
-    // other browsers do, otherwise bugs like Radar 3083732
+    // other browsers do, otherwise bugs like Radar 3083732 occur
     if (![[[URL _web_URLByRemovingFragment] absoluteURL] isEqual:[[[frame dataSource] URL] absoluteURL]]) {
 	[frame _loadURL:URL intoChild:newFrame];
     }
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index 6528ce0..e5d0fe4 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -71,10 +71,14 @@
     // BF items that reference what we loaded - we must keep their titles up to date
     NSMutableArray *ourBackForwardItems;
 
-    // The event that triggered loading of this data source, if any -
+    // The action that triggered loading of this data source -
     // we keep this around for the benefit of the various policy
     // handlers.
-    NSEvent *triggeringEvent;
+    NSDictionary *triggeringAction;
+
+    // The last request that we checked click policy for - kept around
+    // so we can avoid asking again needlessly.
+    WebResourceRequest *lastCheckedRequest;
 
     BOOL isDownloading;
     NSString *downloadPath;
@@ -125,14 +129,12 @@
 - (void)_makeRepresentation;
 - (void)_receivedData:(NSData *)data;
 - (void)_finishedLoading;
-
-
 - (void)_defersCallbacksChanged;
 - (WebResourceRequest *)_originalRequest;
-
-- (void)_setTriggeringEvent:(NSEvent *)event;
-- (NSEvent *)_triggeringEvent;
-
+- (NSDictionary *)_triggeringAction;
+- (void)_setTriggeringAction:(NSDictionary *)action;
+- (WebResourceRequest *)_lastCheckedRequest;
+- (void)_setLastCheckedRequest:(WebResourceRequest *)request;
 - (void)_setIsDownloading:(BOOL)isDownloading;
 - (void)_setDownloadPath:(NSString *)downloadPath;
 
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 0cd7dc6..7c3c65c 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -57,7 +57,8 @@
     [iconLoader release];
     [iconURL release];
     [ourBackForwardItems release];
-    [triggeringEvent release];
+    [triggeringAction release];
+    [lastCheckedRequest release];
     [downloadPath release];
 
     [super dealloc];
@@ -538,19 +539,33 @@
     return _private->originalRequest;
 }
 
-- (void)_setTriggeringEvent:(NSEvent *)event
+- (void)_setTriggeringAction:(NSDictionary *)action
 {
-    [event retain];
-    [_private->triggeringEvent release];
-    _private->triggeringEvent = event;
+    [action retain];
+    [_private->triggeringAction release];
+    _private->triggeringAction = action;
 }
 
-- (NSEvent *)_triggeringEvent
+- (NSDictionary *)_triggeringAction
 {
-    return [[_private->triggeringEvent retain] autorelease];
+    return [[_private->triggeringAction retain] autorelease];
 }
 
 
+- (WebResourceRequest *)_lastCheckedRequest
+{
+    // It's OK not to make a copy here because we know the caller
+    // isn't going to modify this request
+    return [[_private->lastCheckedRequest retain] autorelease];
+}
+
+- (void)_setLastCheckedRequest:(WebResourceRequest *)request
+{
+    WebResourceRequest *oldRequest = _private->lastCheckedRequest;
+    _private->lastCheckedRequest = [request copy];
+    [oldRequest release];
+}
+
 - (void)_setIsDownloading:(BOOL)isDownloading
 {
     _private->isDownloading = isDownloading;
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 7cec8a4..07bbe3b 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -126,10 +126,11 @@
 
     [self _setLoadType: WebFrameLoadTypeStandard];
 
-    // _shouldShowRequest asks the client for the URL policies and reports errors if there are any
+    // _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
 
-    if (![self _shouldShowRequest:[newDataSource request]]) {
+    if (![self _continueAfterNavigationPolicyForRequest:[newDataSource request] dataSource:newDataSource]) {
         return NO;
     }
     
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 0cc965a..e9ae89d 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -108,11 +108,11 @@ typedef enum {
 - (WebFrameLoadType)_loadType;
 
 - (NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event;
-- (BOOL)_continueAfterNavigationPolicyForRequest:(WebResourceRequest *)request event:(NSEvent *)event;
+- (BOOL)_continueAfterNavigationPolicyForRequest:(WebResourceRequest *)request dataSource:(WebDataSource *)dataSource;
 - (void)_goToItem: (WebHistoryItem *)item withLoadType: (WebFrameLoadType)type;
-- (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType clientRedirect:(BOOL)clientRedirect triggeringEvent:(NSEvent *)event;
+- (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType clientRedirect:(BOOL)clientRedirect triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission;
 - (void)_loadURL:(NSURL *)URL intoChild:(WebFrame *)childFrame;
-- (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType;
+- (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event;
 
 - (void)_saveScrollPositionToItem:(WebHistoryItem *)item;
 - (void)_restoreScrollPosition;
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index c8a5c91..d88c34b 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -727,7 +727,7 @@ static const char * const stateNames[] = {
 
 - (BOOL)_shouldShowRequest:(WebResourceRequest *)request
 {
-    return [self _continueAfterNavigationPolicyForRequest:request event:[[self provisionalDataSource] _triggeringEvent]];
+    return [self _continueAfterNavigationPolicyForRequest:request dataSource:[self provisionalDataSource]];
 }
 
 - (void)_setProvisionalDataSource:(WebDataSource *)d
@@ -883,10 +883,10 @@ static const char * const stateNames[] = {
     [self _recursiveGoToItem:item fromItem:currItem withLoadType:type];
 }
 
-- (void)_loadRequest:(WebResourceRequest *)request triggeringEvent:(NSEvent *)event
+- (void)_loadRequest:(WebResourceRequest *)request triggeringAction:(NSDictionary *)action
 {
     WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
-    [newDataSource _setTriggeringEvent:event];
+    [newDataSource _setTriggeringAction:action];
 
     if ([self setProvisionalDataSource:newDataSource]) {
         [self startLoading];
@@ -896,38 +896,26 @@ static const char * const stateNames[] = {
 
 -(NSDictionary *)_actionInformationForNavigationType:(WebNavigationType)navigationType event:(NSEvent *)event
 {
-    switch (navigationType) {
-    case WebNavigationTypeLinkClicked:
-    case WebNavigationTypeFormSubmitted:
-	;
-
+    if (event != nil) {
 	NSView *topViewInEventWindow = [[event window] contentView];
 	NSView *viewContainingPoint = [topViewInEventWindow hitTest:[topViewInEventWindow convertPoint:[event locationInWindow] fromView:nil]];
-
+	
 	ASSERT(viewContainingPoint != nil);
 	ASSERT([viewContainingPoint isKindOfClass:[WebHTMLView class]]);
-	    
+	
 	NSPoint point = [viewContainingPoint convertPoint:[event locationInWindow] fromView:nil];
 	NSDictionary *elementInfo = [(WebHTMLView *)viewContainingPoint _elementAtPoint:point];
 	
 	return [NSDictionary dictionaryWithObjectsAndKeys:
-			     [NSNumber numberWithInt:navigationType], WebActionNavigationTypeKey,
+				 [NSNumber numberWithInt:navigationType], WebActionNavigationTypeKey,
 			     elementInfo, WebActionElementKey,
 			     [NSNumber numberWithInt:[event type]], WebActionButtonKey,
 			     [NSNumber numberWithInt:[event modifierFlags]], WebActionModifierFlagsKey,
 			     nil];
-
-
-	break;
-    case WebNavigationTypeOther:
-	return [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:navigationType]
-			     forKey:WebActionNavigationTypeKey];
-
-	break;
-    default:
-	ASSERT_NOT_REACHED();
-	return nil;
     }
+
+    return [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:navigationType]
+			 forKey:WebActionNavigationTypeKey];
 }
 
 -(BOOL)_continueAfterFileURLPolicyForRequest:(WebResourceRequest *)request
@@ -983,14 +971,24 @@ static const char * const stateNames[] = {
     }
 }
 
--(BOOL)_continueAfterNavigationPolicyForRequest:(WebResourceRequest *)request event:(NSEvent *)event
+-(BOOL)_continueAfterNavigationPolicyForRequest:(WebResourceRequest *)request dataSource:(WebDataSource *)dataSource
 {
-    WebController *controller = [self controller];
-    WebPolicyAction policy;
+    NSDictionary *action = [dataSource _triggeringAction];
+    if (action == nil) {
+	action = [self _actionInformationForNavigationType:WebNavigationTypeOther event:nil];
+	[dataSource _setTriggeringAction:action];
+    }
 
-    policy = [[controller policyDelegate] navigationPolicyForAction:[self _actionInformationForNavigationType:(event != nil ? WebNavigationTypeLinkClicked : WebNavigationTypeOther) event:event]
-				       andRequest:request
-					  inFrame:self];
+    // Don't ask more than once for the same request
+    if ([request isEqual:[dataSource _lastCheckedRequest]]) {
+	return YES;
+    }
+
+    [dataSource _setLastCheckedRequest:request];
+
+    WebPolicyAction policy = [[[self controller] policyDelegate] navigationPolicyForAction:action
+								 andRequest:request
+								 inFrame:self];
 
     switch (policy) {
     case WebPolicyIgnore:
@@ -1001,13 +999,13 @@ static const char * const stateNames[] = {
 	}
 	break;
     case WebPolicyOpenNewWindow:
-	[controller _openNewWindowWithRequest:request behind:NO];
+	[[self controller] _openNewWindowWithRequest:request behind:NO];
 	break;
     case WebPolicyOpenNewWindowBehind:
-	[controller _openNewWindowWithRequest:request behind:YES];
+	[[self controller] _openNewWindowWithRequest:request behind:YES];
 	break;
     case WebPolicySave:
-	[controller _downloadURL:[request URL]];
+	[[self controller] _downloadURL:[request URL]];
 	break;
     case WebPolicyUse:
 	if ([[request URL] isFileURL]) {
@@ -1015,10 +1013,11 @@ static const char * const stateNames[] = {
 	} else {
 	    if (![WebResourceHandle canInitWithRequest:request]) {
 		[self handleUnimplementablePolicy:policy errorCode:WebErrorCannotShowURL forURL:[request URL]];
-		break;
+	    } else {
+		return YES;
 	    }
-	    return YES;
 	}
+	break;
     default:
 	[NSException raise:NSInvalidArgumentException
 		     format:@"clickPolicyForElement:button:modifierFlags: returned an invalid WebClickPolicy"];
@@ -1028,7 +1027,7 @@ static const char * const stateNames[] = {
 }
 
 // main funnel for navigating via callback from WebCore (e.g., clicking a link, redirect)
-- (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType clientRedirect:(BOOL)clientRedirect triggeringEvent:(NSEvent *)event
+- (void)_loadURL:(NSURL *)URL loadType:(WebFrameLoadType)loadType clientRedirect:(BOOL)clientRedirect triggeringEvent:(NSEvent *)event isFormSubmission:(BOOL)isFormSubmission
 {
     WebResourceRequest *request = [[WebResourceRequest alloc] initWithURL:URL];
     [request setReferrer:[_private->bridge referrer]];
@@ -1036,8 +1035,14 @@ static const char * const stateNames[] = {
 	[request setRequestCachePolicy:WebRequestCachePolicyLoadFromOrigin];
     }
 
-    if (event != nil && ![self _continueAfterNavigationPolicyForRequest:request event:event]) {
-	return;
+    NSDictionary *action = nil;
+
+    if (isFormSubmission) {
+	action = [self _actionInformationForNavigationType:WebNavigationTypeFormSubmitted event:event];
+    } else if (event == nil) {
+	action = [self _actionInformationForNavigationType:WebNavigationTypeOther event:event];
+    } else {
+	action = [self _actionInformationForNavigationType:WebNavigationTypeLinkClicked event:event];
     }
 
     // FIXME: This logic doesn't exactly match what KHTML does in openURL, so it's possible
@@ -1047,8 +1052,12 @@ static const char * const stateNames[] = {
         // an anchor in the URL - otherwise this check might prevent us from reloading a document
         // that has subframes that are different than what we're displaying (in other words, a link
         // from within a frame is trying to reload the frameset into _top).
+
         WebDataSource *dataSrc = [self dataSource];
-	[dataSrc _setTriggeringEvent:event];
+	[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]];
@@ -1071,7 +1080,7 @@ static const char * const stateNames[] = {
         WebDataSource *oldDataSource = [[self dataSource] retain];
         WebFrameState stateBeforeStartingLoad = [self _state];
 
-        [self _loadRequest:request triggeringEvent:event];
+        [self _loadRequest:request triggeringAction:action];
         // NB: must be done after loadRequest:, which sets the provDataSource, which
         //     inits the load type to Standard
         [self _setLoadType:loadType];
@@ -1113,7 +1122,7 @@ static const char * const stateNames[] = {
         }
     }
             
-    [childFrame _loadURL:URL loadType:childLoadType clientRedirect:NO triggeringEvent:nil];
+    [childFrame _loadURL:URL loadType:childLoadType clientRedirect:NO triggeringEvent:nil isFormSubmission:NO];
     // want this here???
     if (childItem) {
         if (loadType != WebFrameLoadTypeReload) {
@@ -1126,7 +1135,7 @@ static const char * const stateNames[] = {
     }
 }
 
-- (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType
+- (void)_postWithURL:(NSURL *)URL data:(NSData *)data contentType:(NSString *)contentType triggeringEvent:(NSEvent *)event
 {
     // When posting, use the WebResourceHandleFlagLoadFromOrigin load flag.
     // This prevents a potential bug which may cause a page with a form that uses itself
@@ -1137,7 +1146,11 @@ static const char * const stateNames[] = {
     [request setData:data];
     [request setContentType:contentType];
     [request setReferrer:[_private->bridge referrer]];
-    [self _loadRequest:request triggeringEvent:nil];
+
+    NSDictionary *action = [self _actionInformationForNavigationType:WebNavigationTypeFormSubmitted event:event];
+
+    [self _loadRequest:request triggeringAction:action];
+
     [request release];
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list