Title: [192969] trunk
Revision
192969
Author
y...@yoav.ws
Date
2015-12-02 14:41:21 -0800 (Wed, 02 Dec 2015)

Log Message

Fix preloader issue with srcdoc documents.
https://bugs.webkit.org/show_bug.cgi?id=151744

Reviewed by Ryosuke Niwa.

Source/WebCore:

Make sure that PreloadRequest is resolving URLs based on the document's
baseURL() rather than using url() as the base URL, which is not how URLs
are resolved by the parser, and fails when document->url() diverges from
the document's base URL (e.g. in the case of srcdoc based documents).

Test: fast/preloader/iframe-srcdoc.html

* html/parser/HTMLResourcePreloader.cpp:
(WebCore::PreloadRequest::completeURL):

LayoutTests:

Added a test that makes sure that srcdoc based subresources are properly preloaded.

* fast/preloader/iframe-srcdoc-expected.txt: Added.
* fast/preloader/iframe-srcdoc.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192968 => 192969)


--- trunk/LayoutTests/ChangeLog	2015-12-02 22:35:38 UTC (rev 192968)
+++ trunk/LayoutTests/ChangeLog	2015-12-02 22:41:21 UTC (rev 192969)
@@ -1,3 +1,15 @@
+2015-12-02  Yoav Weiss  <y...@yoav.ws>
+
+        Fix preloader issue with srcdoc documents.
+        https://bugs.webkit.org/show_bug.cgi?id=151744
+
+        Reviewed by Ryosuke Niwa.
+
+        Added a test that makes sure that srcdoc based subresources are properly preloaded.
+
+        * fast/preloader/iframe-srcdoc-expected.txt: Added.
+        * fast/preloader/iframe-srcdoc.html: Added.
+
 2015-12-02  Jer Noble  <jer.no...@apple.com>
 
         Add a setting and restriction which will pause invisible autoplaying video

Added: trunk/LayoutTests/fast/preloader/iframe-srcdoc-expected.txt (0 => 192969)


--- trunk/LayoutTests/fast/preloader/iframe-srcdoc-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/preloader/iframe-srcdoc-expected.txt	2015-12-02 22:41:21 UTC (rev 192969)
@@ -0,0 +1,7 @@
+CONSOLE MESSAGE: line 1: PASS
+This test has to be run as a layout test in order to see if resources were loaded and the test passed. 
+
+--------
+Frame: '<!--framePath //<!--frame0-->-->'
+--------
+ <script src=""

Added: trunk/LayoutTests/fast/preloader/iframe-srcdoc.html (0 => 192969)


--- trunk/LayoutTests/fast/preloader/iframe-srcdoc.html	                        (rev 0)
+++ trunk/LayoutTests/fast/preloader/iframe-srcdoc.html	2015-12-02 22:41:21 UTC (rev 192969)
@@ -0,0 +1,10 @@
+<body>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpChildFramesAsText();
+        testRunner.dumpAsText();
+    }
+
+</script>
+This test has to be run as a layout test in order to see if resources were loaded and the test passed.
+<iframe srcdoc="<script> window.addEventListener('DOMContentLoaded', function() { if (window.internals) console.log(internals.isPreloaded('resources/script1.js') ? 'PASS' : 'FAIL'); }, false); </script><script src="" <script src="" />

Modified: trunk/Source/WebCore/ChangeLog (192968 => 192969)


--- trunk/Source/WebCore/ChangeLog	2015-12-02 22:35:38 UTC (rev 192968)
+++ trunk/Source/WebCore/ChangeLog	2015-12-02 22:41:21 UTC (rev 192969)
@@ -1,3 +1,20 @@
+2015-12-02  Yoav Weiss  <y...@yoav.ws>
+
+        Fix preloader issue with srcdoc documents.
+        https://bugs.webkit.org/show_bug.cgi?id=151744
+
+        Reviewed by Ryosuke Niwa.
+
+        Make sure that PreloadRequest is resolving URLs based on the document's
+        baseURL() rather than using url() as the base URL, which is not how URLs
+        are resolved by the parser, and fails when document->url() diverges from
+        the document's base URL (e.g. in the case of srcdoc based documents).
+
+        Test: fast/preloader/iframe-srcdoc.html
+
+        * html/parser/HTMLResourcePreloader.cpp:
+        (WebCore::PreloadRequest::completeURL):
+
 2015-12-02  Jer Noble  <jer.no...@apple.com>
 
         Add a setting and restriction which will pause invisible autoplaying video

Modified: trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp (192968 => 192969)


--- trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp	2015-12-02 22:35:38 UTC (rev 192968)
+++ trunk/Source/WebCore/html/parser/HTMLResourcePreloader.cpp	2015-12-02 22:41:21 UTC (rev 192969)
@@ -37,7 +37,7 @@
 
 URL PreloadRequest::completeURL(Document& document)
 {
-    return document.completeURL(m_resourceURL, m_baseURL.isEmpty() ? document.url() : m_baseURL);
+    return document.completeURL(m_resourceURL, m_baseURL.isEmpty() ? document.baseURL() : m_baseURL);
 }
 
 CachedResourceRequest PreloadRequest::resourceRequest(Document& document)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to