Reduce flakiness of COOP tests by using timeouts
The COOP WPTs requiring a popup to be navigated were waiting before navigating: - that the onload event triggered - requestAnimationFrame was executed, twice. The latter is not always executed when the tab doesn't have the focus, and gets executed as soon as it gets it. As an alternative, we added a timeout, which avoids waiting for too long. It still achieves the same goal in the tests I conducted than requestAnimationFrame: Make sure the navigation is not considered as a redirection, and that a history entry is created as a result. Bug: 1233840 Change-Id: I5c8bbbccdc9b76ec32c795e7f5a4cdc594823e27 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3297849 Auto-Submit: Pâris Meuleman <pmeuleman@chromium.org> Commit-Queue: Pâris Meuleman <pmeuleman@chromium.org> Reviewed-by: Arthur Sonzogni <arthursonzogni@chromium.org> Cr-Commit-Position: refs/heads/main@{#945351}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
11b985d09d
commit
9038778418
third_party/blink/web_tests/external/wpt
@ -1,10 +1,6 @@
|
||||
<!doctype html>
|
||||
<title>Historical: Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy: a navigating popup</title>
|
||||
<meta name=timeout content=long>
|
||||
<meta name=variant content=?0-0>
|
||||
<meta name=variant content=?1-1>
|
||||
<meta name=variant content=?2-2>
|
||||
<meta name=variant content=?3-3>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
@ -24,13 +20,8 @@
|
||||
"coep": "",
|
||||
"opener": false
|
||||
}
|
||||
].forEach((variant, i) => {
|
||||
["same-origin", "same-site"].forEach((site, j) => {
|
||||
|
||||
// Only run specified variants
|
||||
if (!shouldRunSubTest(2*i + j)) {
|
||||
return;
|
||||
}
|
||||
].forEach((variant) => {
|
||||
["same-origin", "same-site"].forEach((site) => {
|
||||
const title = `Popup navigating to ${site} with ${variant.title}`;
|
||||
const channel = title.replace(/ /g,"-");
|
||||
const navigateHost = site === "same-origin" ? SAME_ORIGIN : SAME_SITE;
|
||||
|
14
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/common.js
vendored
14
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/common.js
vendored
@ -113,17 +113,3 @@ function run_coop_test_iframe (documentTitle, iframe_origin, popup_origin, popup
|
||||
}, `${documentTitle} with ${iframe_origin.name} iframe opening popup via ${popup_via} a ${popup_origin.name} with COOP: ${format_value(popup_coop)}`);
|
||||
}
|
||||
}
|
||||
|
||||
// Wait until the page is fully loaded before navigating
|
||||
// so that it creates a history entry properly.
|
||||
function fullyLoaded() {
|
||||
return new Promise((resolve, reject) => {
|
||||
addEventListener('load', () => {
|
||||
requestAnimationFrame(() => {
|
||||
requestAnimationFrame(() => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
2
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/coop-coep.py
vendored
2
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/coop-coep.py
vendored
@ -38,7 +38,7 @@ def main(request, response):
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script src="/html/cross-origin-opener-policy/resources/common.js"></script>
|
||||
<script src="/html/cross-origin-opener-policy/resources/fully-loaded.js"></script>
|
||||
<body>
|
||||
<script>
|
||||
const params = %s;
|
||||
|
2
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/csp-sandbox.py
vendored
2
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/csp-sandbox.py
vendored
@ -13,7 +13,7 @@ def main(request, response):
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/common/get-host-info.sub.js"></script>
|
||||
<script src="/html/cross-origin-opener-policy/resources/common.js"></script>
|
||||
<script src="/html/cross-origin-opener-policy/resources/fully-loaded.js"></script>
|
||||
<script>
|
||||
const params = new URL(location).searchParams;
|
||||
params.delete("sandbox");
|
||||
|
10
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/fully-loaded.js
vendored
Normal file
10
third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/resources/fully-loaded.js
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
r// Return a promise, which resolves when new navigations aren't considered
|
||||
// client-side redirects anymore.
|
||||
//
|
||||
// Note: A long `setTimeout` is used, because client-side redirect is an
|
||||
// heuristic and isn't clearly specified.
|
||||
function fullyLoaded() {
|
||||
return new Promise((resolve, reject) => {
|
||||
addEventListener('load', () => setTimeout(resolve, 2000))
|
||||
});
|
||||
}
|
@ -159,6 +159,7 @@ SET TIMEOUT: html/browsers/history/the-location-interface/*
|
||||
SET TIMEOUT: html/browsers/history/the-session-history-of-browsing-contexts/*
|
||||
SET TIMEOUT: html/browsers/offline/*
|
||||
SET TIMEOUT: html/browsers/the-window-object/*
|
||||
SET TIMEOUT: html/cross-origin-opener-policy/resources/fully-loaded.js
|
||||
SET TIMEOUT: html/editing/dnd/*
|
||||
SET TIMEOUT: html/semantics/embedded-content/the-iframe-element/*
|
||||
SET TIMEOUT: html/semantics/embedded-content/the-img-element/*
|
||||
|
Reference in New Issue
Block a user