LayoutTests:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2006 05:49:04 +0000 (05:49 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2006 05:49:04 +0000 (05:49 +0000)
        Reviewed by Eric.

        - test for <rdar://problem/4683948> REGRESSION: Assertion failure in [FrameProgressEntry addChild:forDataSource:] (fandango.com)

        (I both added a WebKit assertion that would fail under this test, and then did a fix to make it not fire)

        * fast/loader/start-load-in-unload-expected.txt: Added.
        * fast/loader/start-load-in-unload.html: Added.

WebKit:

        Reviewed by Eric.

        <rdar://problem/4683948> REGRESSION: Assertion failure in [FrameProgressEntry addChild:forDataSource:] (fandango.com)

        * Loader/WebFrameLoader.m:
        (-[WebFrameLoader addSubresourceLoader:]): Add a WebKit-level assertion that should fire when this bad
        situation occurs.
        * Loader/WebSubresourceLoader.m:
        (+[WebSubresourceLoader startLoadingResource:withRequest:customHeaders:referrer:forFrameLoader:]): Prevent
        the situation from occuring.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15982 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/loader/start-load-in-unload-expected.txt [new file with mode: 0644]
LayoutTests/fast/loader/start-load-in-unload.html [new file with mode: 0644]
WebKit/ChangeLog
WebKit/Loader/WebFrameLoader.m
WebKit/Loader/WebSubresourceLoader.m

index 99bf7cfa02378e5d1b623ffa144ff1cc2673ace5..2848a75a3e04012465504da6c94e0c3cf98ae6dd 100644 (file)
@@ -1,3 +1,14 @@
+2006-08-22  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Eric.
+
+        - test for <rdar://problem/4683948> REGRESSION: Assertion failure in [FrameProgressEntry addChild:forDataSource:] (fandango.com)
+        
+        (I both added a WebKit assertion that would fail under this test, and then did a fix to make it not fire)
+        
+        * fast/loader/start-load-in-unload-expected.txt: Added.
+        * fast/loader/start-load-in-unload.html: Added.
+
 2006-08-22  Maciej Stachowiak  <mjs@apple.com>
 
         Fix for broken tests.
diff --git a/LayoutTests/fast/loader/start-load-in-unload-expected.txt b/LayoutTests/fast/loader/start-load-in-unload-expected.txt
new file mode 100644 (file)
index 0000000..93cbb43
--- /dev/null
@@ -0,0 +1,9 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderImage {IMG} at (0,0) size 20x20
+      RenderText {#text} at (20,6) size 732x18
+        text run at (20,6) width 732: " This test verifies that starting a subresource load from an unload handler does not cause crashes or assertion failures."
+      RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/fast/loader/start-load-in-unload.html b/LayoutTests/fast/loader/start-load-in-unload.html
new file mode 100644 (file)
index 0000000..e6cf470
--- /dev/null
@@ -0,0 +1,5 @@
+
+<body onunload="document.getElementById('i').src = 'broken.jpg'">
+<img id="i" src="nosrc.jpg">
+This test verifies that starting a subresource load from an unload handler does not cause crashes or assertion failures.
+</body>
index 359a3f88d86f26166a0031a17e117fe170a7aff2..77cde4961aabf8ca9ad401c9192d4a316387d7dd 100644 (file)
@@ -1,3 +1,16 @@
+2006-08-22  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Eric.
+
+        <rdar://problem/4683948> REGRESSION: Assertion failure in [FrameProgressEntry addChild:forDataSource:] (fandango.com)
+        
+        * Loader/WebFrameLoader.m:
+        (-[WebFrameLoader addSubresourceLoader:]): Add a WebKit-level assertion that should fire when this bad
+        situation occurs.
+        * Loader/WebSubresourceLoader.m:
+        (+[WebSubresourceLoader startLoadingResource:withRequest:customHeaders:referrer:forFrameLoader:]): Prevent
+        the situation from occuring.
+
 2006-08-22  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
index 891926f6aee95dad273154da4c01da2fee08a139..d73491a23ff8cd4351848f2dae177b3017054dd1 100644 (file)
 
 - (void)addSubresourceLoader:(WebLoader *)loader
 {
+    ASSERT(!provisionalDataSource);
     if (subresourceLoaders == nil)
         subresourceLoaders = [[NSMutableArray alloc] init];
     [subresourceLoaders addObject:loader];
index 594d008fc20b837e8da0497a1f841b01d02f3e33..80b2044999cf88bafab92f65ebc78ca945cb6454 100644 (file)
@@ -96,6 +96,9 @@ static void setHTTPReferrer(NSMutableURLRequest *request, NSString *theReferrer)
                                       referrer:(NSString *)referrer 
                                 forFrameLoader:(WebFrameLoader *)fl
 {
+    if ([fl state] == WebFrameStateProvisional)
+        return nil;
+
     WebSubresourceLoader *loader = [[[self alloc] initWithLoader:rLoader frameLoader:fl] autorelease];
     
     [fl addSubresourceLoader:loader];