Title: [225381] trunk
Revision
225381
Author
[email protected]
Date
2017-11-30 21:27:11 -0800 (Thu, 30 Nov 2017)

Log Message

Extra PerformanceEntryList entry after iframe navigation
https://bugs.webkit.org/show_bug.cgi?id=178433

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: http/tests/security/PerformanceEntryList-parent-only-first-navigation.html

When an iframe is loaded, its main resource load should be reported to the parent frame's PerformanceEntryList.
Subsequent main resource loads should not.

* loader/FrameLoader.h:
(WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
* loader/ResourceTimingInformation.cpp:
(WebCore::ResourceTimingInformation::addResourceTiming):

LayoutTests:

* http/tests/security/PerformanceEntryList-parent-only-first-navigation-expected.txt: Added.
* http/tests/security/PerformanceEntryList-parent-only-first-navigation.html: Added.
* http/tests/security/resources/navigate-and-postMessage.html: Added.
* http/tests/security/resources/postMessage.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (225380 => 225381)


--- trunk/LayoutTests/ChangeLog	2017-12-01 05:24:19 UTC (rev 225380)
+++ trunk/LayoutTests/ChangeLog	2017-12-01 05:27:11 UTC (rev 225381)
@@ -1,3 +1,15 @@
+2017-11-30  Alex Christensen  <[email protected]>
+
+        Extra PerformanceEntryList entry after iframe navigation
+        https://bugs.webkit.org/show_bug.cgi?id=178433
+
+        Reviewed by Joseph Pecoraro.
+
+        * http/tests/security/PerformanceEntryList-parent-only-first-navigation-expected.txt: Added.
+        * http/tests/security/PerformanceEntryList-parent-only-first-navigation.html: Added.
+        * http/tests/security/resources/navigate-and-postMessage.html: Added.
+        * http/tests/security/resources/postMessage.html: Added.
+
 2017-11-30  Zalan Bujtas  <[email protected]>
 
         [Simple line layout] Incorrect repaint rect with vertically shrinking content.

Added: trunk/LayoutTests/http/tests/security/PerformanceEntryList-parent-only-first-navigation-expected.txt (0 => 225381)


--- trunk/LayoutTests/http/tests/security/PerformanceEntryList-parent-only-first-navigation-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/PerformanceEntryList-parent-only-first-navigation-expected.txt	2017-12-01 05:27:11 UTC (rev 225381)
@@ -0,0 +1,2 @@
+ALERT: posting message 1 http://127.0.0.1:8000/security/resources/navigate-and-postMessage.html
+

Added: trunk/LayoutTests/http/tests/security/PerformanceEntryList-parent-only-first-navigation.html (0 => 225381)


--- trunk/LayoutTests/http/tests/security/PerformanceEntryList-parent-only-first-navigation.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/PerformanceEntryList-parent-only-first-navigation.html	2017-12-01 05:27:11 UTC (rev 225381)
@@ -0,0 +1,13 @@
+<script>
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    }
+    window.addEventListener("message", (e)=>{
+        var entries = performance.getEntriesByType("resource");
+        alert(e.data + " " + entries.length + " " + entries[0].name);
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }, false);
+</script>
+<iframe src=""

Added: trunk/LayoutTests/http/tests/security/resources/navigate-and-postMessage.html (0 => 225381)


--- trunk/LayoutTests/http/tests/security/resources/navigate-and-postMessage.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/navigate-and-postMessage.html	2017-12-01 05:27:11 UTC (rev 225381)
@@ -0,0 +1,3 @@
+<script>
+    window.location = "postMessage.html";
+</script>

Added: trunk/LayoutTests/http/tests/security/resources/postMessage.html (0 => 225381)


--- trunk/LayoutTests/http/tests/security/resources/postMessage.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/security/resources/postMessage.html	2017-12-01 05:27:11 UTC (rev 225381)
@@ -0,0 +1,3 @@
+<script>
+    window.parent.postMessage("posting message", "*");
+</script>

Modified: trunk/Source/WebCore/ChangeLog (225380 => 225381)


--- trunk/Source/WebCore/ChangeLog	2017-12-01 05:24:19 UTC (rev 225380)
+++ trunk/Source/WebCore/ChangeLog	2017-12-01 05:27:11 UTC (rev 225381)
@@ -1,3 +1,20 @@
+2017-11-30  Alex Christensen  <[email protected]>
+
+        Extra PerformanceEntryList entry after iframe navigation
+        https://bugs.webkit.org/show_bug.cgi?id=178433
+
+        Reviewed by Joseph Pecoraro.
+
+        Test: http/tests/security/PerformanceEntryList-parent-only-first-navigation.html
+
+        When an iframe is loaded, its main resource load should be reported to the parent frame's PerformanceEntryList.
+        Subsequent main resource loads should not.
+
+        * loader/FrameLoader.h:
+        (WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
+        * loader/ResourceTimingInformation.cpp:
+        (WebCore::ResourceTimingInformation::addResourceTiming):
+
 2017-11-30  Zalan Bujtas  <[email protected]>
 
         [Simple line layout] Incorrect repaint rect with vertically shrinking content and bottom-padding.

Modified: trunk/Source/WebCore/loader/FrameLoader.h (225380 => 225381)


--- trunk/Source/WebCore/loader/FrameLoader.h	2017-12-01 05:24:19 UTC (rev 225380)
+++ trunk/Source/WebCore/loader/FrameLoader.h	2017-12-01 05:27:11 UTC (rev 225381)
@@ -158,6 +158,9 @@
     DocumentLoader* provisionalDocumentLoader() const { return m_provisionalDocumentLoader.get(); }
     FrameState state() const { return m_state; }
 
+    void setShouldReportResourceTimingToParentFrame(bool value) { m_shouldReportResourceTimingToParentFrame = value; }
+    bool shouldReportResourceTimingToParentFrame() { return m_shouldReportResourceTimingToParentFrame; };
+    
 #if PLATFORM(IOS)
     RetainPtr<CFDictionaryRef> connectionProperties(ResourceLoader*);
 #endif
@@ -416,6 +419,7 @@
     bool m_quickRedirectComing;
     bool m_sentRedirectNotification;
     bool m_inStopAllLoaders;
+    bool m_shouldReportResourceTimingToParentFrame { true };
 
     String m_outgoingReferrer;
 

Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.cpp (225380 => 225381)


--- trunk/Source/WebCore/loader/ResourceTimingInformation.cpp	2017-12-01 05:24:19 UTC (rev 225380)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.cpp	2017-12-01 05:27:11 UTC (rev 225381)
@@ -69,8 +69,10 @@
         return;
 
     Document* initiatorDocument = &document;
-    if (resource.type() == CachedResource::MainResource)
+    if (resource.type() == CachedResource::MainResource && document.frame() && document.frame()->loader().shouldReportResourceTimingToParentFrame()) {
+        document.frame()->loader().setShouldReportResourceTimingToParentFrame(false);
         initiatorDocument = document.parentDocument();
+    }
     if (!initiatorDocument)
         return;
     if (!initiatorDocument->domWindow())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to