[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 07:30:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit c3c65c9fb4f9c31a56b352e4be450ec8c828695d
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Mar 19 07:05:36 2003 +0000

    WebCore:
    
    	Support for password saving in forms.  Added elementIsPassword:,
    	nuked deadwood formIsLoginForm:.
    
            Reviewed by Maciej.
    
            * khtml/html/html_formimpl.cpp:
            (HTMLFormElementImpl::submit):  Pass forms data for login forms and
    	password fields to bridge.  This case was skipped for security in
    	khtml's autocomplete, but we need this data to save passwords, and
    	we enforce policy at a higher level.
            * khtml/html/html_formimpl.h:
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            Nuked formIsLoginForm:.
            (-[WebCoreBridge elementIsPassword:]):  New utility.
    
    WebKit:
    
    	Support for saving passwords on forms-based logins.  Biggest change is that
    	the willSubmitForm: message is async to allow a sheet to be presented.
    
    	Also fixed @interface.*{ so prepare-change-log can swallow WebFramePrivate.m.
    
            Reviewed by Maciej.
    
            * WebView.subproj/WebControllerPolicyDelegate.m:
            (-[WebPolicyDecisionListener continue]):  The decision listener also
    	implements WebFormSubmissionListener, to share some other impl.
            * WebView.subproj/WebControllerPolicyDelegatePrivate.h:
            * WebView.subproj/WebFormDelegate.h:
            * WebView.subproj/WebFormDelegate.m:
            (-[WebFormDelegate frame:willSubmitForm:withValues:submissionListener:]):
    	Take listener param for async API.
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
    	Latent bug.  Don't call willSubmitForm if no values are being submitted.
            (-[WebFrame _postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
    	Latent bug.  Don't call willSubmitForm if no values are being submitted.
            (-[WebFrame _continueAfterWillSubmitForm:]):
    	Continuation code for after FormDelegate is done with willSubmitForm.
            (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
    	Pass new listener arg to willSubmitForm.
            * WebView.subproj/WebHTMLRepresentation.h:
            * WebView.subproj/WebHTMLRepresentation.m:
    	Nuke deadwood formIsLoginForm.
            (-[WebHTMLRepresentation elementIsPassword:]):  Just pass through glue
    	over the bridge.
    
    WebBrowser:
    
    	Password saving is implemented, with data saved in the keychain.
    	Lots of FIXMEs were either fixed or moved to Radar.
    
            Reviewed by Chris.
    
            * BrowserWindowController.m:
            (-[BrowserWindowController windowDidLoad]):
    	Observe BrowserDocumentLoadingFinishedNotification.
            (-[BrowserWindowController frameLoadStarted:]):
    	Cancel timer that would try to autofill the last page with a password.
            (-[BrowserWindowController frameLoadFinished:]):
    	Start a timer that will try to autofill this page with a password.  We use a short
    	timer to avoid affecting the PLT.
            (-[BrowserWindowController tryToAutofillPasswords:]):
    	Force keychain check of password protecting the ad-hoc data.
    	Try to autocomplete any login form on the page.
            (-[FormDelegate frame:willSubmitForm:withValues:submissionListener:]):
    	Pass new async listener param along to FormCompletionController.
            * CompletionController.m:
            (-[CompletionController _showMatchesWindow:]):  Don't try to set an initial match
    	if there wasn't one.
            (-[CompletionController completeString:]):  Handle the case of a subclass specifying
    	no initial match after a query.
            * Debug/DebugUtilities.m:
            (-[DebugUtilities createDebugMenu]):  Nuke items for which we now have real prefs.
            * English.lproj/ABAutoCompleteMappings.plist:  A tweak for better matching.
    	No longer need to have both USA and U.S.A.
            * English.lproj/Localizable.strings:
            * English.lproj/StringsNotToBeLocalized.txt:
            * FormCompletionController.h:
            * FormCompletionController.m:
            (urlFromFrame):  New utility, just factored from other routines.
            (domainFromFrame):  Call new utility.
            (authResourceFromFrame):  New utility.
            (HTMLRepFromFrame):  New utility, just factored from other routines.
            (dontSaveMarker):  Return a magic username that indicates passwords are never
    	saved for a particular AuthResource.
            (+[FormCompletionController setPasswordCompletionEnabled:]):  Nuke NOP code.
            (viewContainsTextField):  Utility to search view hierarchy for a text field.
            (+[FormCompletionController verifyKeychainAccessWithController:]):
    	Read the AutoComplete encryption password, just to get the keychain nag out of the way.
            (+[FormCompletionController _cryptData:encode:]):  Terminology - s/AutoComplete/AutoFill/
            (+[FormCompletionController _reapABMarker:forFrame:fieldName:]):
    	Deletes a stale AB marker that was detected.
            (+[FormCompletionController loginInfoForForm:inFrame:]):
    	Return some info about the form if it is a login form.
            (+[FormCompletionController _frame:willSubmitLoginForm:withValues:formInfo:submissionListener:]):
    	Handle a login form being submitted.  Runs a sheet for the user, or at least makes sure
    	the one we are sending becomes the default item for the site.
            (+[FormCompletionController _passwordSheetDismissed:returnCode:contextInfo:]):
    	After the sheet, possibly save the new item, or save a refusal marker so we never
    	ask the user again for this site.  Make sure to continue the submission.
            (+[FormCompletionController _frame:willSubmitRegularForm:withValues:]):
    	Same code as what used to be in willSubmitForm, just factored here for the non-login case.
            (+[FormCompletionController frame:willSubmitForm:withValues:submissionListener:]):
    	Branch to either the regular or login method.
            (+[FormCompletionController _addABMatchesToArray:forString:atABPointer:]):
    	Subtle bug in how we inserted AB matches into the matches from completion data.  We would
    	sometimes errantly leave ABMarkers in this list, which became problematic now that we
    	reap stale ones.  Now we are willing to match an ABMatch against a literal string from
    	the CompletionDB -AND- an ABMarker.
            (+[FormCompletionController _credentialMatchesForString:frame:]):
    	Match the partialString against previous logins for this site.  For these matches we
    	insert WebCredentials into the matches array.
            (+[FormCompletionController _matchesForString:frame:fieldName:view:]):
    	Call new utility routine.  Reap any stale ABMarkers left over in the matches list.
            (stringFromMatch):  Handle a Credential match.
            (matchComparator):  Oops, should be case insensitive.
            (-[FormCompletionController queryResultsForString:startingMatch:]):
    	Do a credential-based match if this is a login form.
            (+[FormCompletionController currentFrameAndForm:inController:]):
    	Just factored code from autoFillInController.
            (+[FormCompletionController _autoFillPasswordInFrame:formInfo:]):
    	Stick the default login and password into a form.
            (+[FormCompletionController autoFillInController:]):  AutoFill a non-login form the
    	same was as before (code was moved from elsewhere).  AutoFill a login form too.
            (+[FormCompletionController autoFillPasswordInController:]):
    	AutoFill, but only for login forms.
            (-[FormCompletionController initWithSourceField:frame:]):
    	Use new utility to decide if this is a login form instead of WC routine.
            (-[FormCompletionController reflectSelectedRow]):
    	If we are stuffing a username into a login form, stuff the password field too.
            (-[FormCompletionController finalMatchingStringForResult:]):  FIXME -> Radar.
            (cookedPopupString):  strip periods out of strings before we match popup values.
            (indexOfBestStringInArray):  Use cookedPopupString for all matching.
            (-[AutoFillController _reflectAutoFillMatch:inView:fieldName:]):
    	When stuffing a popup, be sure the action message is sent to get the right side-effects.
            (-[AutoFillController autoFill]):  Use new utility routines.  Return a more accurate
    	result of whether we actually autofilled anything.
            (-[AutoFillController autoFillAddressStartingAtView:match:]):  Use new utility routines.
            (+[FormToABBinder loadGlobalBinder]):  FIXME -> Radar
            (-[FormToABBinder initWithPath:]):  Cleanup SearchPass handling, so a non-specified
    	SearchPass really behaves the same as a SearchPass==1.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3862 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index ca9d8ca..f4b07eb 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,21 @@
+2003-03-17  Trey Matteson  <trey at apple.com>
+
+	Support for password saving in forms.  Added elementIsPassword:,
+	nuked deadwood formIsLoginForm:.
+
+        Reviewed by Maciej.
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::submit):  Pass forms data for login forms and
+	password fields to bridge.  This case was skipped for security in
+	khtml's autocomplete, but we need this data to save passwords, and
+	we enforce policy at a higher level.
+        * khtml/html/html_formimpl.h:
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        Nuked formIsLoginForm:.
+        (-[WebCoreBridge elementIsPassword:]):  New utility.
+
 2003-03-18  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index ca9d8ca..f4b07eb 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,21 @@
+2003-03-17  Trey Matteson  <trey at apple.com>
+
+	Support for password saving in forms.  Added elementIsPassword:,
+	nuked deadwood formIsLoginForm:.
+
+        Reviewed by Maciej.
+
+        * khtml/html/html_formimpl.cpp:
+        (HTMLFormElementImpl::submit):  Pass forms data for login forms and
+	password fields to bridge.  This case was skipped for security in
+	khtml's autocomplete, but we need this data to save passwords, and
+	we enforce policy at a higher level.
+        * khtml/html/html_formimpl.h:
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        Nuked formIsLoginForm:.
+        (-[WebCoreBridge elementIsPassword:]):  New utility.
+
 2003-03-18  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by John.
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index ab8ad2e..1711c04 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -91,24 +91,6 @@ NodeImpl::Id HTMLFormElementImpl::id() const
 }
 
 #if APPLE_CHANGES
-bool HTMLFormElementImpl::isLoginForm()
-{
-    int numPasswordFields = 0;
-    int numTextFields = 0;
-    QPtrListIterator<HTMLGenericFormElementImpl> it(formElements);
-    for (; it.current(); ++it) {
-        if (it.current()->id() == ID_INPUT) {
-            HTMLInputElementImpl *inputElt = static_cast<HTMLInputElementImpl*>(it.current());
-            if (inputElt->inputType() == HTMLInputElementImpl::PASSWORD) {
-                numPasswordFields++;
-            } else if (inputElt->inputType() == HTMLInputElementImpl::TEXT) {
-                numTextFields++;
-            }
-        }
-    }
-    return (numPasswordFields > 0) && (numTextFields == 1);
-}
-
 bool HTMLFormElementImpl::formWouldHaveSecureSubmission(DOMString url)
 {
     if (url.isNull()) {
@@ -524,17 +506,26 @@ void HTMLFormElementImpl::submit( bool activateSubmitButton )
 #endif
     for (QPtrListIterator<HTMLGenericFormElementImpl> it(formElements); it.current(); ++it) {
         HTMLGenericFormElementImpl* current = it.current();
+#if APPLE_CHANGES
+        // Our app needs to get form values for password fields for doing password autocomplete,
+        // so we are more lenient in pushing values, and let the app decide what to save when.
+        if (current->id() == ID_INPUT) {
+            HTMLInputElementImpl *input = static_cast<HTMLInputElementImpl*>(current);
+            if (input->inputType() == HTMLInputElementImpl::TEXT
+                || input->inputType() ==  HTMLInputElementImpl::PASSWORD)
+            {
+                KWQ(view->part())->recordFormValue(input->name().string(), input->value().string(), this);
+            }
+        }
+#else
         if (current->id() == ID_INPUT &&
             static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::TEXT &&
             static_cast<HTMLInputElementImpl*>(current)->autoComplete() )
         {
             HTMLInputElementImpl *input = static_cast<HTMLInputElementImpl *>(current);
-#if APPLE_CHANGES
-            KWQ(view->part())->recordFormValue(input->name().string(), input->value().string(), this);
-#else
             view->addFormCompletionItem(input->name().string(), input->value().string());
-#endif
         }
+#endif
 
         if (needButtonActivation) {
             if (current->isActivatedSubmit()) {
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index e421528..674736f 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -99,10 +99,6 @@ public:
     
     static void i18nData();
 
-#if APPLE_CHANGES
-    bool isLoginForm();
-#endif
-    
     friend class HTMLFormElement;
     friend class HTMLFormCollectionImpl;
 
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 706ff00..0f756bd 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -159,8 +159,8 @@ enum FrameBorderStyle {
 
 - (NSDictionary *)elementAtPoint:(NSPoint)point;
 - (id <WebDOMElement>)elementForView:(NSView *)view;
-- (BOOL)formIsLoginForm:(id <WebDOMElement>)element;
 - (BOOL)elementDoesAutoComplete:(id <WebDOMElement>)element;
+- (BOOL)elementIsPassword:(id <WebDOMElement>)element;
 - (id <WebDOMElement>)formForElement:(id <WebDOMElement>)element;
 - (id <WebDOMElement>)currentForm;
 - (NSArray *)controlsInForm:(id <WebDOMElement>)form;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 5236f36..2a08cce 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -492,12 +492,6 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
     return nil;
 }
 
-- (BOOL)formIsLoginForm:(id <WebDOMElement>)element
-{
-    HTMLFormElementImpl *formElement = formElementFromDOMElement(element);
-    return formElement->isLoginForm();
-}
-
 - (BOOL)elementDoesAutoComplete:(id <WebDOMElement>)element
 {
     HTMLInputElementImpl *inputElement = inputElementFromDOMElement(element);
@@ -506,6 +500,13 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
         && inputElement->autoComplete();
 }
 
+- (BOOL)elementIsPassword:(id <WebDOMElement>)element
+{
+    HTMLInputElementImpl *inputElement = inputElementFromDOMElement(element);
+    return inputElement != nil
+        && inputElement->inputType() == HTMLInputElementImpl::PASSWORD;
+}
+
 - (id <WebDOMElement>)formForElement:(id <WebDOMElement>)element;
 {
     HTMLInputElementImpl *inputElement = inputElementFromDOMElement(element);
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ba438b0..8431578 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,35 @@
+2003-03-17  Trey Matteson  <trey at apple.com>
+
+	Support for saving passwords on forms-based logins.  Biggest change is that
+	the willSubmitForm: message is async to allow a sheet to be presented.
+
+	Also fixed @interface.*{ so prepare-change-log can swallow WebFramePrivate.m.
+
+        Reviewed by Maciej.
+
+        * WebView.subproj/WebControllerPolicyDelegate.m:
+        (-[WebPolicyDecisionListener continue]):  The decision listener also
+	implements WebFormSubmissionListener, to share some other impl.
+        * WebView.subproj/WebControllerPolicyDelegatePrivate.h:
+        * WebView.subproj/WebFormDelegate.h:
+        * WebView.subproj/WebFormDelegate.m:
+        (-[WebFormDelegate frame:willSubmitForm:withValues:submissionListener:]):
+	Take listener param for async API.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _loadURL:referrer:loadType:target:triggeringEvent:form:formValues:]):
+	Latent bug.  Don't call willSubmitForm if no values are being submitted.
+        (-[WebFrame _postWithURL:referrer:target:data:contentType:triggeringEvent:form:formValues:]):
+	Latent bug.  Don't call willSubmitForm if no values are being submitted.
+        (-[WebFrame _continueAfterWillSubmitForm:]):
+	Continuation code for after FormDelegate is done with willSubmitForm.
+        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
+	Pass new listener arg to willSubmitForm.
+        * WebView.subproj/WebHTMLRepresentation.h:
+        * WebView.subproj/WebHTMLRepresentation.m:
+	Nuke deadwood formIsLoginForm.
+        (-[WebHTMLRepresentation elementIsPassword:]):  Just pass through glue
+	over the bridge.
+
 2003-03-18  Richard Williamson   <rjw at apple.com>
 
         Another rename WebController*.[hm] to WebView*.[hm]
diff --git a/WebKit/WebView.subproj/WebControllerPolicyDelegate.m b/WebKit/WebView.subproj/WebControllerPolicyDelegate.m
index 99de024..2b6ec75 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyDelegate.m
+++ b/WebKit/WebView.subproj/WebControllerPolicyDelegate.m
@@ -77,6 +77,8 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
     [self release];
 }
 
+// WebPolicyDecisionListener implementation
+
 -(void)use
 {
     [self _usePolicy:WebPolicyUse];
@@ -90,6 +92,13 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
 -(void)download
 {
     [self _usePolicy:WebPolicyDownload];
-}   
+}
+
+// WebFormSubmissionListener implementation
+
+-(void)continue
+{
+    [self _usePolicy:WebPolicyUse];
+}
 
 @end
diff --git a/WebKit/WebView.subproj/WebControllerPolicyDelegatePrivate.h b/WebKit/WebView.subproj/WebControllerPolicyDelegatePrivate.h
index 43fa768..41e0011 100644
--- a/WebKit/WebView.subproj/WebControllerPolicyDelegatePrivate.h
+++ b/WebKit/WebView.subproj/WebControllerPolicyDelegatePrivate.h
@@ -5,6 +5,7 @@
 
 
 #import <WebKit/WebControllerPolicyDelegate.h>
+#import <WebKit/WebFormDelegate.h>
 
 typedef enum {
     WebPolicyUse,
@@ -15,7 +16,7 @@ typedef enum {
 
 @class WebPolicyDecisionListenerPrivate;
 
- at interface WebPolicyDecisionListener : NSObject <WebPolicyDecisionListener>
+ at interface WebPolicyDecisionListener : NSObject <WebPolicyDecisionListener, WebFormSubmissionListener>
 {
 @private
     WebPolicyDecisionListenerPrivate *_private;
diff --git a/WebKit/WebView.subproj/WebFormDelegate.h b/WebKit/WebView.subproj/WebFormDelegate.h
index 5981d61..ece52b1 100644
--- a/WebKit/WebView.subproj/WebFormDelegate.h
+++ b/WebKit/WebView.subproj/WebFormDelegate.h
@@ -10,6 +10,15 @@
 @class WebFrame;
 @protocol WebDOMElement;
 
+
+/*!
+    @protocol  WebFormSubmissionListener
+    @discussion .
+*/
+ at protocol WebFormSubmissionListener <NSObject>
+- (void)continue;
+ at end
+
 /*!
     @protocol  WebFormDelegate
     @discussion .
@@ -33,7 +42,8 @@
 - (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)commandSelector inFrame:(WebFrame *)frame;
 
 // Sent when a form is just about to be submitted (before the load is started)
-- (void)frame:(WebFrame *)frame willSubmitForm:(id <WebDOMElement>)form withValues:(NSDictionary *)values;
+// listener must be sent continue when the delegate is done.
+- (void)frame:(WebFrame *)frame willSubmitForm:(id <WebDOMElement>)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener;
 @end
 
 /*!
diff --git a/WebKit/WebView.subproj/WebFormDelegate.m b/WebKit/WebView.subproj/WebFormDelegate.m
index 9508687..efc352e 100644
--- a/WebKit/WebView.subproj/WebFormDelegate.m
+++ b/WebKit/WebView.subproj/WebFormDelegate.m
@@ -5,6 +5,8 @@
 
 #import "WebFormDelegatePrivate.h"
 
+//FIXME:  This should become an informal protocol, now that we switch all the others
+
 @implementation WebFormDelegate
 
 static WebFormDelegate *sharedDelegate = nil;
@@ -55,6 +57,9 @@ static WebFormDelegate *sharedDelegate = nil;
     return NO;
 }
 
-- (void)frame:(WebFrame *)frame willSubmitForm:(id <WebDOMElement>)form withValues:(NSDictionary *)values  { }
+- (void)frame:(WebFrame *)frame willSubmitForm:(id <WebDOMElement>)form withValues:(NSDictionary *)values submissionListener:(id <WebFormSubmissionListener>)listener
+{
+    [listener continue];
+}
 
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index bc833d9..f3ddc8a 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -111,7 +111,8 @@ Repeat load of the same URL (by any other means of navigation other than the rel
 // over the bridge, and possibly hand it on through to the FormsDelegate.
 // Today it is just used internally to keep some state as we make our way through a bunch
 // layers while doing a load.
- at interface WebFormState : NSObject {
+ at interface WebFormState : NSObject
+{
     NSObject <WebDOMElement> *_form;
     NSDictionary *_values;
 }
@@ -1535,7 +1536,10 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     ASSERT(loadType != WebFrameLoadTypeSame);
 
     NSDictionary *action = [self _actionInformationForLoadType:loadType isFormSubmission:isFormSubmission event:event originalURL:URL];
-    WebFormState *formState = [[WebFormState alloc] initWithForm:form values:values];
+    WebFormState *formState = nil;
+    if (form && values) {
+        formState = [[WebFormState alloc] initWithForm:form values:values];
+    }
 
     if (target != nil) {
 	WebFrame *targetFrame = [self findFrameNamed:target];
@@ -1656,7 +1660,10 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     [request setReferrer:referrer];
 
     NSDictionary *action = [self _actionInformationForLoadType:WebFrameLoadTypeStandard isFormSubmission:YES event:event originalURL:URL];
-    WebFormState *formState = [[WebFormState alloc] initWithForm:form values:values];
+    WebFormState *formState = nil;
+    if (form && values) {
+        formState = [[WebFormState alloc] initWithForm:form values:values];
+    }
 
     if (target != nil) {
 	WebFrame *targetFrame = [self findFrameNamed:target];
@@ -1849,6 +1856,17 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     return nil;
 }
 
+// Called after the FormsDelegate is done processing willSubmitForm:
+-(void)_continueAfterWillSubmitForm:(WebPolicyAction)policy
+{
+    if (_private->listener) {
+        [_private->listener _invalidate];
+        [_private->listener release];
+        _private->listener = nil;
+    }
+    [_private->provisionalDataSource _startLoading];
+}
+
 -(void)_continueLoadRequestAfterNavigationPolicy:(WebRequest *)request formState:(WebFormState *)formState
 {
     if (!request) {
@@ -1878,9 +1896,13 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         }
     } else {
         if (formState) {
-            [[[self webView] _formDelegate] frame:self willSubmitForm:[formState form] withValues:[formState values]];
+            // It's a bit of a hack to reuse the WebPolicyDecisionListener for the continuation
+            // mechanism across the willSubmitForm callout.
+            _private->listener = [[WebPolicyDecisionListener alloc] _initWithTarget:self action:@selector(_continueAfterWillSubmitForm:)];
+            [[[self webView] _formDelegate] frame:self willSubmitForm:[formState form] withValues:[formState values] submissionListener:_private->listener];
+        } else {
+            [self _continueAfterWillSubmitForm:WebPolicyUse];
         }
-        [_private->provisionalDataSource _startLoading];
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.h b/WebKit/WebView.subproj/WebHTMLRepresentation.h
index b84205d..3ee76b7 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.h
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.h
@@ -53,7 +53,7 @@
 
 - (id <WebDOMElement>)elementForView:(NSView *)view;
 - (BOOL)elementDoesAutoComplete:(id <WebDOMElement>)element;
-- (BOOL)formIsLoginForm:(id <WebDOMElement>)element;
+- (BOOL)elementIsPassword:(id <WebDOMElement>)element;
 - (id <WebDOMElement>)formForElement:(id <WebDOMElement>)element;
 - (id <WebDOMElement>)currentForm;
 - (NSArray *)controlsInForm:(id <WebDOMElement>)form;
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.m b/WebKit/WebView.subproj/WebHTMLRepresentation.m
index 1af0935..fa48d39 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.m
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.m
@@ -123,9 +123,9 @@
     return [_private->bridge elementDoesAutoComplete:element];
 }
 
-- (BOOL)formIsLoginForm:(id <WebDOMElement>)element
+- (BOOL)elementIsPassword:(id <WebDOMElement>)element
 {
-    return [_private->bridge formIsLoginForm:element];
+    return [_private->bridge elementIsPassword:element];
 }
 
 - (id <WebDOMElement>)formForElement:(id <WebDOMElement>)element
diff --git a/WebKit/WebView.subproj/WebPolicyDelegate.m b/WebKit/WebView.subproj/WebPolicyDelegate.m
index 99de024..2b6ec75 100644
--- a/WebKit/WebView.subproj/WebPolicyDelegate.m
+++ b/WebKit/WebView.subproj/WebPolicyDelegate.m
@@ -77,6 +77,8 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
     [self release];
 }
 
+// WebPolicyDecisionListener implementation
+
 -(void)use
 {
     [self _usePolicy:WebPolicyUse];
@@ -90,6 +92,13 @@ NSString *WebActionOriginalURLKey = @"WebActionOriginalURLKey";
 -(void)download
 {
     [self _usePolicy:WebPolicyDownload];
-}   
+}
+
+// WebFormSubmissionListener implementation
+
+-(void)continue
+{
+    [self _usePolicy:WebPolicyUse];
+}
 
 @end
diff --git a/WebKit/WebView.subproj/WebPolicyDelegatePrivate.h b/WebKit/WebView.subproj/WebPolicyDelegatePrivate.h
index 43fa768..41e0011 100644
--- a/WebKit/WebView.subproj/WebPolicyDelegatePrivate.h
+++ b/WebKit/WebView.subproj/WebPolicyDelegatePrivate.h
@@ -5,6 +5,7 @@
 
 
 #import <WebKit/WebControllerPolicyDelegate.h>
+#import <WebKit/WebFormDelegate.h>
 
 typedef enum {
     WebPolicyUse,
@@ -15,7 +16,7 @@ typedef enum {
 
 @class WebPolicyDecisionListenerPrivate;
 
- at interface WebPolicyDecisionListener : NSObject <WebPolicyDecisionListener>
+ at interface WebPolicyDecisionListener : NSObject <WebPolicyDecisionListener, WebFormSubmissionListener>
 {
 @private
     WebPolicyDecisionListenerPrivate *_private;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list