Bug 6331

Summary: REGRESSION: form events don't fire after back/forward navigation, due to inconsistent load state
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: JavaScriptCoreAssignee: Geoffrey Garen <ggaren>
Severity: Normal    
Priority: P1    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Description Flags
Fix darin: review+

Description Geoffrey Garen 2006-01-01 23:58:32 PST
Check out the attached reduction. 

The patch for 5518 caused this. I'm surprised Mitz didn't catch it; he must be slipping... :)
Comment 1 Geoffrey Garen 2006-01-01 23:59:06 PST
Created attachment 5414 [details]
Comment 2 Geoffrey Garen 2006-01-02 00:12:28 PST
Sorry, not 5518; rdar://problem/4268278.
Comment 3 Geoffrey Garen 2006-01-08 22:20:29 PST
Created attachment 5562 [details]

Darin had a look at a previous incarnation of this patch, but I think I've
found a better way that is more in tune with the loader's natural behavior.
Comment 4 Geoffrey Garen 2006-01-08 22:22:01 PST
Comment on attachment 5562 [details]

The key to this new patch is:

+    } else if ([_private->subresourceLoaders count] > 0) {
+	 // The main resource loader already finished loading. Set the
cancelled error on the 
+	 // document and let the subresourceLoaders send individual cancelled
messages below.
+	 [self _setMainDocumentError:[self _cancelledError]];
     } else {
-	 // Main handle is already done. Set the cancelled error.
-	 NSError *cancelledError = [NSError
-							       URL:[self
-	 [self _setMainDocumentError:cancelledError];
+	 // If there are no resource loaders, we need to manufacture a
cancelled message.
+	 // (A back/forward navigation has no resource loaders because its
resources are cached.)
+	 [[self _webView] _mainReceivedError:[self _cancelledError]
+			      fromDataSource:self
+				    complete:YES];
Comment 5 Darin Adler 2006-01-09 09:05:30 PST
Comment on attachment 5562 [details]

I would write "Cancels the DataSource's pending loads" as "Cancels the data
source's pending loads" (not important, just a comment in passing).

This looks better than the earlier fix you had me review last week.

Comment 6 Geoffrey Garen 2006-01-09 10:34:05 PST
Landed as revision 11963.