Diff
Modified: trunk/LayoutTests/ChangeLog (237394 => 237395)
--- trunk/LayoutTests/ChangeLog 2018-10-24 18:46:39 UTC (rev 237394)
+++ trunk/LayoutTests/ChangeLog 2018-10-24 18:49:03 UTC (rev 237395)
@@ -1,3 +1,20 @@
+2018-10-11 Jiewen Tan <[email protected]>
+
+ Only report resource timing to parent frame for the first iframe load
+ https://bugs.webkit.org/show_bug.cgi?id=190498
+ <rdar://problem/44347398>
+
+ Reviewed by Youenn Fablet.
+
+ The layout test is from Chromium change:
+ https://chromium-review.googlesource.com/c/chromium/src/+/1186215.
+
+ * http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt: Added.
+ * http/tests/misc/resource-timing-navigation-in-restored-iframe.html: Added.
+ * http/tests/misc/resources/alert-then-back.html: Added.
+ * http/tests/misc/resources/navigate-on-message.html: Added.
+ * http/tests/misc/resources/post-message-to-parent.html: Added.
+
2018-10-24 Ryan Haddad <[email protected]>
[macOS] Layout Test legacy-animation-engine/animations/suspend-resume-animation.html is a flaky failure
Added: trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt (0 => 237395)
--- trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt 2018-10-24 18:49:03 UTC (rev 237395)
@@ -0,0 +1,12 @@
+ALERT: Going back.
+Tests that subsequent navigation in 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
+
Added: trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html (0 => 237395)
--- trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html 2018-10-24 18:49:03 UTC (rev 237395)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<script src=""
+<script>
+ description('Tests that subsequent navigation in an iframe restored from history does not report resource timing.');
+ window.jsTestIsAsync = true;
+ function runTest() {
+ if (!sessionStorage.didNav) {
+ sessionStorage.didNav = true;
+ // Navigate a timeout to make sure we generate a history entry that we can go back to.
+ setTimeout(function() {
+ location.href = '';
+ }, 0);
+ } else {
+ delete sessionStorage.didNav;
+ window.addEventListener('message', (event) => {
+ 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();
+ });
+ document.getElementById('target-iframe').contentWindow.postMessage('navigate', '*');
+ }
+ }
+ window._onload_ = runTest;
+</script>
+<iframe id="target-iframe" src=""
Added: trunk/LayoutTests/http/tests/misc/resources/alert-then-back.html (0 => 237395)
--- trunk/LayoutTests/http/tests/misc/resources/alert-then-back.html (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/alert-then-back.html 2018-10-24 18:49:03 UTC (rev 237395)
@@ -0,0 +1 @@
+<script>alert("Going back.");history.back();</script>
Added: trunk/LayoutTests/http/tests/misc/resources/navigate-on-message.html (0 => 237395)
--- trunk/LayoutTests/http/tests/misc/resources/navigate-on-message.html (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/navigate-on-message.html 2018-10-24 18:49:03 UTC (rev 237395)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script>
+function handleMessage() {
+ window.location = 'post-message-to-parent.html';
+}
+
+window.addEventListener("message", handleMessage);
+</script>
Added: trunk/LayoutTests/http/tests/misc/resources/post-message-to-parent.html (0 => 237395)
--- trunk/LayoutTests/http/tests/misc/resources/post-message-to-parent.html (rev 0)
+++ trunk/LayoutTests/http/tests/misc/resources/post-message-to-parent.html 2018-10-24 18:49:03 UTC (rev 237395)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<script>
+ window.parent.postMessage('navigated', '*');
+</script>
Modified: trunk/Source/WebCore/ChangeLog (237394 => 237395)
--- trunk/Source/WebCore/ChangeLog 2018-10-24 18:46:39 UTC (rev 237394)
+++ trunk/Source/WebCore/ChangeLog 2018-10-24 18:49:03 UTC (rev 237395)
@@ -1,3 +1,24 @@
+2018-10-11 Jiewen Tan <[email protected]>
+
+ Only report resource timing to parent frame for the first iframe load
+ https://bugs.webkit.org/show_bug.cgi?id=190498
+ <rdar://problem/44347398>
+
+ Reviewed by Youenn Fablet.
+
+ Only the first iframe navigation or the first iframe navigation after about:blank should be reported.
+ https://www.w3.org/TR/resource-timing-2/#resources-included-in-the-performanceresourcetiming-interface
+
+ Test: http/tests/misc/resource-timing-navigation-in-restored-iframe.html
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::loadWithDocumentLoader):
+ * loader/FrameLoader.h:
+ (WebCore::FrameLoader::shouldReportResourceTimingToParentFrame):
+ (WebCore::FrameLoader::setShouldReportResourceTimingToParentFrame): Deleted.
+ * loader/ResourceTimingInformation.cpp:
+ (WebCore::ResourceTimingInformation::addResourceTiming):
+
2018-10-24 Brent Fulgham <[email protected]>
Cure Windows Direct2D Backend of a nasty case of bitrot
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (237394 => 237395)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2018-10-24 18:46:39 UTC (rev 237394)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2018-10-24 18:49:03 UTC (rev 237395)
@@ -119,6 +119,7 @@
#include "SubframeLoader.h"
#include "SubresourceLoader.h"
#include "TextResourceDecoder.h"
+#include "URL.h"
#include "UserContentController.h"
#include "UserGestureIndicator.h"
#include "WindowFeatures.h"
@@ -1554,6 +1555,11 @@
const URL& newURL = loader->request().url();
+ // Only the first iframe navigation or the first iframe navigation after about:blank should be reported.
+ // https://www.w3.org/TR/resource-timing-2/#resources-included-in-the-performanceresourcetiming-interface
+ if (m_shouldReportResourceTimingToParentFrame && !m_previousURL.isNull() && m_previousURL != blankURL())
+ m_shouldReportResourceTimingToParentFrame = false;
+
// Log main frame navigation types.
if (m_frame.isMainFrame()) {
if (auto* page = m_frame.page()) {
Modified: trunk/Source/WebCore/loader/FrameLoader.h (237394 => 237395)
--- trunk/Source/WebCore/loader/FrameLoader.h 2018-10-24 18:46:39 UTC (rev 237394)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2018-10-24 18:49:03 UTC (rev 237395)
@@ -169,8 +169,7 @@
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; };
+ bool shouldReportResourceTimingToParentFrame() const { return m_shouldReportResourceTimingToParentFrame; };
#if PLATFORM(IOS_FAMILY)
RetainPtr<CFDictionaryRef> connectionProperties(ResourceLoader*);
Modified: trunk/Source/WebCore/loader/ResourceTimingInformation.cpp (237394 => 237395)
--- trunk/Source/WebCore/loader/ResourceTimingInformation.cpp 2018-10-24 18:46:39 UTC (rev 237394)
+++ trunk/Source/WebCore/loader/ResourceTimingInformation.cpp 2018-10-24 18:49:03 UTC (rev 237395)
@@ -70,10 +70,8 @@
return;
Document* initiatorDocument = &document;
- if (resource.type() == CachedResource::Type::MainResource && document.frame() && document.frame()->loader().shouldReportResourceTimingToParentFrame()) {
- document.frame()->loader().setShouldReportResourceTimingToParentFrame(false);
+ if (resource.type() == CachedResource::Type::MainResource && document.frame() && document.frame()->loader().shouldReportResourceTimingToParentFrame())
initiatorDocument = document.parentDocument();
- }
if (!initiatorDocument)
return;