Revert "Consolidate iframe & object resource timing code paths"
This reverts commit 5dcb6f7b01d5f51144a9ba847c34bb0cdc344ccb.
Reason for revert: MSan failures crbug.com/1420057
Original change's description:
> Consolidate iframe & object resource timing code paths
>
> So far some of the logic in resource timing for subframe navigations
> iframe/object/embed) was duplicated, e.g. both in blink and in content.
>
> This has led to race conditions, inconsistencies and sometimes
> XSS leaks.
>
> This patch attempts to improve the situation by consolidating the code
> paths:
>
> - NavigationRequest receives is_container_initiated, which ensures only
> container-initiated navigations are reported to the parent. This
> is a clarification of something that was ambiguous in the spec
> previously (https://github.com/whatwg/html/issues/8846).
> It later uses ParentResourceTimingAccess to decide if a navigation
> should report to its parent with/without response details
> (status code and mime-type), or not report at all (TAO-fail, not
> an iframe, not container-initiated).
>
> - Both object fallbacks and cancelled navigations (204/205) report
> to the parent via RenderFrameImpl, and blink converts that to a
> ResourceTimingInfo object. This allows us to remove the duplicated
> resource timing creation code in //content.
>
> - We report fallback resource timing also for plugin error events and
> not only for load events.
>
> Bug: 1399862
> Bug: 1410705
> Change-Id: Id37d23cd02eee9e38f812e6f3da99caedafdee3d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4214695
> Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org>
> Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org>
> Commit-Queue: Noam Rosenthal <nrosenthal@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1110433}
Bug: 1399862
Bug: 1410705
Bug: 1420057
Change-Id: Icfc5b6ca7ebd718b2fff58e3f5c7765c53ee93f9
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4295881
Owners-Override: Dan H <harringtond@chromium.org>
Reviewed-by: Dan H <harringtond@chromium.org>
Commit-Queue: Dan H <harringtond@chromium.org>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1110619}
diff --git a/resource-timing/entries-for-object-frame-options-deny.html b/resource-timing/entries-for-object-frame-options-deny.html
deleted file mode 100644
index a69b642..0000000
--- a/resource-timing/entries-for-object-frame-options-deny.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-<meta charset="utf-8" />
-<meta name="timeout" content="long">
-<link rel="author" title="Noam Rosenthal" href="noam@chromium.org">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<script src="/common/get-host-info.sub.js"></script>
-<script src="resources/entry-invariants.js"></script>
-</head>
-<body>
-<script>
-const {REMOTE_ORIGIN} = get_host_info();
-
-promise_test(async t => {
- const success_url = new URL("/resource-timing/resources/object-frame-options-200.asis", REMOTE_ORIGIN).href;
- const fail_url = new URL("/resource-timing/resources/object-frame-options-403.asis", REMOTE_ORIGIN).href;
- const load_object = async url => {
- const object = document.createElement("object");
- object.data = url;
- document.body.appendChild(object);
- t.add_cleanup(() => object.remove());
- await new Promise(resolve => {
- object.onload = object.onerror = resolve;
- });
- };
-
- await Promise.all([success_url, fail_url].map(load_object));
- assert_equals(performance.getEntriesByName(success_url).length, 1);
- assert_equals(performance.getEntriesByName(fail_url).length, 1);
-}, "Test that object elements with X-Frame-Options: Deny produce resource timing entries");
-</script>
-</body>
-</html>
diff --git a/resource-timing/iframe-sequence-of-events.html b/resource-timing/iframe-sequence-of-events.html
index 5d719fb..02d1c36 100644
--- a/resource-timing/iframe-sequence-of-events.html
+++ b/resource-timing/iframe-sequence-of-events.html
@@ -3,7 +3,6 @@
<title>Test the sequence of events when reporting iframe timing.</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-<script src="resources/entry-invariants.js"></script>
<script src="resources/frame-timing.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/get-host-info.sub.js"></script>
diff --git a/resource-timing/resources/frame-timing.js b/resource-timing/resources/frame-timing.js
index 65710e2..019bd42 100644
--- a/resource-timing/resources/frame-timing.js
+++ b/resource-timing/resources/frame-timing.js
@@ -25,8 +25,8 @@
function test_frame_timing_change_src(type,
- origin1 = location.origin,
- origin2 = location.origin,
+ origin1 = document.origin,
+ origin2 = document.origin,
tao = false, label = '') {
const uid = token();
promise_test(async t => {
@@ -59,11 +59,5 @@
const entries = performance.getEntries().filter(e => e.name.includes(uid));
assert_equals(entries.length, 2);
- for (const entry of entries) {
- if (tao || entry.name.startsWith(location.origin))
- invariants.assert_tao_pass_no_redirect_http(entry);
- else
- invariants.assert_tao_failure_resource(entry);
- }
}, label || `A ${type} should report separate RT entries if its src changed from the outside`);
}
diff --git a/resource-timing/resources/object-frame-options-200.asis b/resource-timing/resources/object-frame-options-200.asis
deleted file mode 100644
index 1224453..0000000
--- a/resource-timing/resources/object-frame-options-200.asis
+++ /dev/null
@@ -1,6 +0,0 @@
-HTTP/1.0 200 OK
-Content-Type: text/html
-X-Frame-Options: DENY
-Content-Security-Policy: frame-ancestors 'none'
-
-Hello
diff --git a/resource-timing/resources/object-frame-options-403.asis b/resource-timing/resources/object-frame-options-403.asis
deleted file mode 100644
index fd64f0b..0000000
--- a/resource-timing/resources/object-frame-options-403.asis
+++ /dev/null
@@ -1,6 +0,0 @@
-HTTP/1.0 403 OK
-Content-Type: text/html
-X-Frame-Options: DENY
-Content-Security-Policy: frame-ancestors 'none'
-
-Hello