Title: [238877] trunk
Revision
238877
Author
jiewen_...@apple.com
Date
2018-12-04 15:01:29 -0800 (Tue, 04 Dec 2018)

Log Message

Don't report resource timing to parent frame for history items
https://bugs.webkit.org/show_bug.cgi?id=192273
<rdar://problem/45163764>

Reviewed by Youenn Fablet.

Source/WebCore:

We should not report history items to its parent frame as those are less
interested to its parent and might not be the first navigation in the iframes.

This change aligns the behavior when a cached document is not available for the
history item with the available case as we don't report resource timing for any
cached main document.

Test: http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::loadDifferentDocumentItem):

LayoutTests:

* http/tests/misc/resource-timing-navigation-in-restored-iframe-2-expected.txt: Added.
* http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html: Copied from LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html.
* http/tests/misc/resource-timing-navigation-in-restored-iframe.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238876 => 238877)


--- trunk/LayoutTests/ChangeLog	2018-12-04 22:58:36 UTC (rev 238876)
+++ trunk/LayoutTests/ChangeLog	2018-12-04 23:01:29 UTC (rev 238877)
@@ -1,3 +1,15 @@
+2018-11-30  Jiewen Tan  <jiewen_...@apple.com>
+
+        Don't report resource timing to parent frame for history items
+        https://bugs.webkit.org/show_bug.cgi?id=192273
+        <rdar://problem/45163764>
+
+        Reviewed by Youenn Fablet.
+
+        * http/tests/misc/resource-timing-navigation-in-restored-iframe-2-expected.txt: Added.
+        * http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html: Copied from LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html.
+        * http/tests/misc/resource-timing-navigation-in-restored-iframe.html:
+
 2018-12-04  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed

Added: trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-2-expected.txt (0 => 238877)


--- trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-2-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-2-expected.txt	2018-12-04 23:01:29 UTC (rev 238877)
@@ -0,0 +1,12 @@
+ALERT: Going back.
+Tests that an iframe restored from history does not report resource timing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS resources.length is 1
+PASS resources[0].name is "http://127.0.0.1:8000/js-test-resources/js-test.js"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html (from rev 238876, trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html) (0 => 238877)


--- trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html	2018-12-04 23:01:29 UTC (rev 238877)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<script src=""
+<script>
+    description('Tests that an iframe restored from history does not report resource timing.');
+    window.jsTestIsAsync = true;
+    if (window.internals)
+        internals.clearMemoryCache();
+
+    function runTest() {
+        if (!sessionStorage.didNav) {
+            sessionStorage.didNav = true;
+            window.addEventListener('message', (event) => {
+                location.href = '';
+            });
+            document.getElementById('target-iframe').contentWindow.postMessage('navigate', '*');
+        } else {
+            delete sessionStorage.didNav;
+
+            resources = performance.getEntriesByType('resource');
+            shouldBe('resources.length', '1');
+            shouldBeEqualToString('resources[0].name', 'http://127.0.0.1:8000/js-test-resources/js-test.js');
+            if (window.testRunner)
+                finishJSTest();
+        }
+    }
+    window._onload_ = runTest;
+</script>
+<iframe id="target-iframe" src=""

Modified: trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html (238876 => 238877)


--- trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html	2018-12-04 22:58:36 UTC (rev 238876)
+++ trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html	2018-12-04 23:01:29 UTC (rev 238877)
@@ -14,7 +14,7 @@
             delete sessionStorage.didNav;
             window.addEventListener('message', (event) => {
                 resources = performance.getEntriesByType('resource');
-                shouldBe('resources.length', '1');
+                shouldBe('resources.length', '1'); // There is only one report as we don't report resource timing for cached main document.
                 shouldBeEqualToString('resources[0].name', 'http://127.0.0.1:8000/js-test-resources/js-test.js');
                 if (window.testRunner)
                     finishJSTest();

Modified: trunk/Source/WebCore/ChangeLog (238876 => 238877)


--- trunk/Source/WebCore/ChangeLog	2018-12-04 22:58:36 UTC (rev 238876)
+++ trunk/Source/WebCore/ChangeLog	2018-12-04 23:01:29 UTC (rev 238877)
@@ -1,3 +1,23 @@
+2018-11-30  Jiewen Tan  <jiewen_...@apple.com>
+
+        Don't report resource timing to parent frame for history items
+        https://bugs.webkit.org/show_bug.cgi?id=192273
+        <rdar://problem/45163764>
+
+        Reviewed by Youenn Fablet.
+
+        We should not report history items to its parent frame as those are less
+        interested to its parent and might not be the first navigation in the iframes.
+
+        This change aligns the behavior when a cached document is not available for the
+        history item with the available case as we don't report resource timing for any
+        cached main document.
+
+        Test: http/tests/misc/resource-timing-navigation-in-restored-iframe-2.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::loadDifferentDocumentItem):
+
 2018-12-04  Simon Fraser  <simon.fra...@apple.com>
 
         REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (238876 => 238877)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2018-12-04 22:58:36 UTC (rev 238876)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2018-12-04 23:01:29 UTC (rev 238877)
@@ -3591,6 +3591,9 @@
 // methods of FrameLoader.
 void FrameLoader::loadDifferentDocumentItem(HistoryItem& item, FrameLoadType loadType, FormSubmissionCacheLoadPolicy cacheLoadPolicy, ShouldTreatAsContinuingLoad shouldTreatAsContinuingLoad)
 {
+    // History items should not be reported to the parent.
+    m_shouldReportResourceTimingToParentFrame = false;
+
     // Remember this item so we can traverse any child items as child frames load
     history().setProvisionalItem(&item);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to