Title: [143789] trunk
Revision
143789
Author
[email protected]
Date
2013-02-22 14:00:09 -0800 (Fri, 22 Feb 2013)

Log Message

Preloads should be cleared when _javascript_ cancels loading prematurely.
https://bugs.webkit.org/show_bug.cgi?id=110388

Reviewed by Antti Koivisto.

Source/WebCore:

If a page preloads a resource, but _javascript_ aborts parsing for any reason (for example, a
redirect or document.write()), the resource is forever marked a preload and won't be reloaded
even if it's explicitly marked no-cache and the page is reloaded.

Test: http/tests/cache/preload-cleared-after-parrsing-canceled-by-js.html

* dom/Document.cpp:
(WebCore::Document::implicitClose):
(WebCore::Document::finishedParsing):

LayoutTests:

* http/tests/cache/preload-cleared-after-parrsing-canceled-by-js-expected.txt: Added.
* http/tests/cache/preload-cleared-after-parrsing-canceled-by-js.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (143788 => 143789)


--- trunk/LayoutTests/ChangeLog	2013-02-22 21:50:47 UTC (rev 143788)
+++ trunk/LayoutTests/ChangeLog	2013-02-22 22:00:09 UTC (rev 143789)
@@ -1,3 +1,13 @@
+2013-02-22  James Simonsen  <[email protected]>
+
+        Preloads should be cleared when _javascript_ cancels loading prematurely.
+        https://bugs.webkit.org/show_bug.cgi?id=110388
+
+        Reviewed by Antti Koivisto.
+
+        * http/tests/cache/preload-cleared-after-parrsing-canceled-by-js-expected.txt: Added.
+        * http/tests/cache/preload-cleared-after-parrsing-canceled-by-js.html: Added.
+
 2013-02-22  Rouslan Solomakhin  <[email protected]>
 
         Expect editing/spelling/spelling-changed-text.html to fail on Qt and GTK

Added: trunk/LayoutTests/http/tests/cache/preload-cleared-after-parsing-canceled-by-js-expected.txt (0 => 143789)


--- trunk/LayoutTests/http/tests/cache/preload-cleared-after-parsing-canceled-by-js-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/preload-cleared-after-parsing-canceled-by-js-expected.txt	2013-02-22 22:00:09 UTC (rev 143789)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 22: Reloading
+PASS

Added: trunk/LayoutTests/http/tests/cache/preload-cleared-after-parsing-canceled-by-js.html (0 => 143789)


--- trunk/LayoutTests/http/tests/cache/preload-cleared-after-parsing-canceled-by-js.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/cache/preload-cleared-after-parsing-canceled-by-js.html	2013-02-22 22:00:09 UTC (rev 143789)
@@ -0,0 +1,39 @@
+<html>
+  <head>
+    <script>
+      function saveAndCheckRandomNumber() {
+        if (!sessionStorage.lastRandom) {
+          sessionStorage.lastRandom = randomNumber;
+        } else {
+          window.passed = sessionStorage.lastRandom != randomNumber;
+        }
+      }
+    </script>
+    <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src="" _onload_="saveAndCheckRandomNumber();"></script>
+  </head>
+  <body>
+    <script type="text/_javascript_">
+      if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+      }
+      if (document.referrer != document.location.toString()) {
+        console.log('Reloading');
+        document.location.reload();
+      } else {
+        if (window.passed === true) {
+          document.body.innerText = "PASS";
+        } else if (window.passed === false) {
+          document.body.innerText = "FAIL";
+        } else {
+          document.body.innerText = "ERROR";
+        }
+        delete sessionStorage.lastRandom;
+        if (window.testRunner) {
+          testRunner.notifyDone();
+        }
+      }
+    </script>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (143788 => 143789)


--- trunk/Source/WebCore/ChangeLog	2013-02-22 21:50:47 UTC (rev 143788)
+++ trunk/Source/WebCore/ChangeLog	2013-02-22 22:00:09 UTC (rev 143789)
@@ -1,3 +1,20 @@
+2013-02-22  James Simonsen  <[email protected]>
+
+        Preloads should be cleared when _javascript_ cancels loading prematurely.
+        https://bugs.webkit.org/show_bug.cgi?id=110388
+
+        Reviewed by Antti Koivisto.
+
+        If a page preloads a resource, but _javascript_ aborts parsing for any reason (for example, a
+        redirect or document.write()), the resource is forever marked a preload and won't be reloaded
+        even if it's explicitly marked no-cache and the page is reloaded.
+
+        Test: http/tests/cache/preload-cleared-after-parrsing-canceled-by-js.html
+
+        * dom/Document.cpp:
+        (WebCore::Document::implicitClose):
+        (WebCore::Document::finishedParsing):
+
 2013-02-22  Antoine Quint  <[email protected]>
 
         Expose a list of all reasons that qualify a RenderLayer to be composited

Modified: trunk/Source/WebCore/dom/Document.cpp (143788 => 143789)


--- trunk/Source/WebCore/dom/Document.cpp	2013-02-22 21:50:47 UTC (rev 143788)
+++ trunk/Source/WebCore/dom/Document.cpp	2013-02-22 22:00:09 UTC (rev 143789)
@@ -2362,9 +2362,6 @@
     // onLoad event handler, as in Radar 3206524.
     detachParser();
 
-    // Parser should have picked up all preloads by now
-    m_cachedResourceLoader->clearPreloads();
-
     // FIXME: We kick off the icon loader when the Document is done parsing.
     // There are earlier opportunities we could start it:
     //  -When the <head> finishes parsing
@@ -4405,6 +4402,9 @@
     // alive indefinitely by something innocuous like JS setting .innerHTML repeatedly on a timer.
     static const int timeToKeepSharedObjectPoolAliveAfterParsingFinishedInSeconds = 10;
     m_sharedObjectPoolClearTimer.startOneShot(timeToKeepSharedObjectPoolAliveAfterParsingFinishedInSeconds);
+
+    // Parser should have picked up all preloads by now
+    m_cachedResourceLoader->clearPreloads();
 }
 
 void Document::sharedObjectPoolClearTimerFired(Timer<Document>*)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to