Diff
Modified: branches/safari-606-branch/LayoutTests/ChangeLog (237526 => 237527)
--- branches/safari-606-branch/LayoutTests/ChangeLog 2018-10-28 19:12:22 UTC (rev 237526)
+++ branches/safari-606-branch/LayoutTests/ChangeLog 2018-10-28 19:12:27 UTC (rev 237527)
@@ -1,5 +1,60 @@
2018-10-28 Babak Shafiei <[email protected]>
+ Cherry-pick r237395. rdar://problem/45574503
+
+ 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.
+
+ Source/WebCore:
+
+ 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):
+
+ LayoutTests:
+
+ 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.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237395 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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-28 Babak Shafiei <[email protected]>
+
Cherry-pick r237135. rdar://problem/45562440
[iOS] Can't select text after dismissing the keyboard when changing focus
Added: branches/safari-606-branch/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt (0 => 237527)
--- branches/safari-606-branch/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe-expected.txt 2018-10-28 19:12:27 UTC (rev 237527)
@@ -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: branches/safari-606-branch/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html (0 => 237527)
--- branches/safari-606-branch/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/misc/resource-timing-navigation-in-restored-iframe.html 2018-10-28 19:12:27 UTC (rev 237527)
@@ -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: branches/safari-606-branch/LayoutTests/http/tests/misc/resources/alert-then-back.html (0 => 237527)
--- branches/safari-606-branch/LayoutTests/http/tests/misc/resources/alert-then-back.html (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/misc/resources/alert-then-back.html 2018-10-28 19:12:27 UTC (rev 237527)
@@ -0,0 +1 @@
+<script>alert("Going back.");history.back();</script>
Added: branches/safari-606-branch/LayoutTests/http/tests/misc/resources/navigate-on-message.html (0 => 237527)
--- branches/safari-606-branch/LayoutTests/http/tests/misc/resources/navigate-on-message.html (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/misc/resources/navigate-on-message.html 2018-10-28 19:12:27 UTC (rev 237527)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<script>
+function handleMessage() {
+ window.location = 'post-message-to-parent.html';
+}
+
+window.addEventListener("message", handleMessage);
+</script>
Added: branches/safari-606-branch/LayoutTests/http/tests/misc/resources/post-message-to-parent.html (0 => 237527)
--- branches/safari-606-branch/LayoutTests/http/tests/misc/resources/post-message-to-parent.html (rev 0)
+++ branches/safari-606-branch/LayoutTests/http/tests/misc/resources/post-message-to-parent.html 2018-10-28 19:12:27 UTC (rev 237527)
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<script>
+ window.parent.postMessage('navigated', '*');
+</script>
Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (237526 => 237527)
--- branches/safari-606-branch/Source/WebCore/ChangeLog 2018-10-28 19:12:22 UTC (rev 237526)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog 2018-10-28 19:12:27 UTC (rev 237527)
@@ -1,3 +1,62 @@
+2018-10-28 Babak Shafiei <[email protected]>
+
+ Cherry-pick r237395. rdar://problem/45574503
+
+ 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.
+
+ Source/WebCore:
+
+ 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):
+
+ LayoutTests:
+
+ 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.
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237395 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 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 Kocsen Chung <[email protected]>
Cherry-pick r236747. rdar://problem/45491954
Modified: branches/safari-606-branch/Source/WebCore/loader/FrameLoader.cpp (237526 => 237527)
--- branches/safari-606-branch/Source/WebCore/loader/FrameLoader.cpp 2018-10-28 19:12:22 UTC (rev 237526)
+++ branches/safari-606-branch/Source/WebCore/loader/FrameLoader.cpp 2018-10-28 19:12:27 UTC (rev 237527)
@@ -118,6 +118,7 @@
#include "SubframeLoader.h"
#include "SubresourceLoader.h"
#include "TextResourceDecoder.h"
+#include "URL.h"
#include "UserContentController.h"
#include "UserGestureIndicator.h"
#include "WindowFeatures.h"
@@ -1541,6 +1542,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: branches/safari-606-branch/Source/WebCore/loader/FrameLoader.h (237526 => 237527)
--- branches/safari-606-branch/Source/WebCore/loader/FrameLoader.h 2018-10-28 19:12:22 UTC (rev 237526)
+++ branches/safari-606-branch/Source/WebCore/loader/FrameLoader.h 2018-10-28 19:12:27 UTC (rev 237527)
@@ -165,8 +165,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)
RetainPtr<CFDictionaryRef> connectionProperties(ResourceLoader*);
Modified: branches/safari-606-branch/Source/WebCore/loader/ResourceTimingInformation.cpp (237526 => 237527)
--- branches/safari-606-branch/Source/WebCore/loader/ResourceTimingInformation.cpp 2018-10-28 19:12:22 UTC (rev 237526)
+++ branches/safari-606-branch/Source/WebCore/loader/ResourceTimingInformation.cpp 2018-10-28 19:12:27 UTC (rev 237527)
@@ -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;
if (!initiatorDocument->domWindow())