Skip to content

Commit

Permalink
Bug 1863416 [wpt PR 42982] - Some WPT tests should run same-process o…
Browse files Browse the repository at this point in the history
…nly., a=testonly

Automatic update from web-platform-tests
Some WPT tests should run same-process only.

In preparation for enabling isolated sandboxed iframes by default, there
are some WPT tests that should not be allowed to run with origin process
isolation. In each case the affected tests are forced to remain same-
process by placing them in the not-site-per-process virtual test
suite.

drag-drop-same-unique-origin.html uses EventSender, and although its
src and target frames are same process, under isolated sandboxed iframes
that process would be remote to the mainframe, which EventSender will
not support.

The longtask* tests all use window.PerformanceLongTaskTiming, which
inherently does not support cross-process frames. The tests want to
exercise data coming from a cross-origin, same-site child frame, and
the safest way to ensure that is to force the frames to remain same-
process.

Note: the cross-origin longtask tests were using sandboxed-srcdoc
frames to simulate being cross-origin (and same-process, since WPT tests
default to process-per-origin), but there's no need for that if the
test is run in not-site-per-process. Therefore the tests have been
revised to be non-sandboxed cross-origin using WPT apis, resulting in
tests that are hopefully easier to understand.

Bug: 550122
Change-Id: Id104439fd34ba0ebb94a516224a21fd832c65828
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5006758
Reviewed-by: Dominic Farolino <[email protected]>
Commit-Queue: W. James Maclean <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1220552}

--

wpt-commits: 6c6e5c6f3634b13cd3af019ca31edbf73fb7cf93
wpt-pr: 42982
  • Loading branch information
W. James MacLean authored and moz-wptsync-bot committed Nov 14, 2023
1 parent c7facc9 commit 22e8ab1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src='resources/utils.js'></script>

<h1>Long Task in Nested Cross-Origin Child Iframe</h1>
<div id="log"></div>
<script>
const child_url = new URL("resources/subframe-with-longtask.html",
new URL(location.pathname,
get_host_info().HTTPS_REMOTE_ORIGIN)).href;

async_test(function (t) {
assert_implements(window.PerformanceLongTaskTiming, 'Longtasks are not supported.');
const observer = new PerformanceObserver(
Expand All @@ -35,8 +40,7 @@ <h1>Long Task in Nested Cross-Origin Child Iframe</h1>
assert_equals(attribution.containerType, 'iframe');
assert_equals(attribution.containerId, 'child-iframe-id');
assert_equals(attribution.containerName, 'child-iframe-name');
assert_equals(attribution.containerSrc,
'resources/subframe-with-longtask.html');
assert_equals(attribution.containerSrc, child_url);
observer.disconnect();
t.done();
})
Expand All @@ -46,10 +50,8 @@ <h1>Long Task in Nested Cross-Origin Child Iframe</h1>
const iframe = document.createElement('iframe');
iframe.id = 'child-iframe-id';
iframe.name = 'child-iframe-name';
// Simulate cross-origin by using sandbox.
iframe.sandbox = "allow-scripts";
document.body.appendChild(iframe);
iframe.src = 'resources/subframe-with-longtask.html';
iframe.src = child_url;
};
}, 'Performance longtask entries in cross-origin child iframe are observable in parent.');
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>

<script>
const sibling_url = new URL("resources/subframe-with-longtask.html",
new URL(location.pathname,
get_host_info().HTTPS_REMOTE_ORIGIN)).href;

async_test(t => {
assert_implements(window.PerformanceLongTaskTiming, 'Longtasks are not supported.');
window.addEventListener('message', t.step_func(e => {
Expand All @@ -30,10 +35,8 @@
const longtaskFrame = document.createElement('iframe');
longtaskFrame.id = 'longtask-iframe-id';
longtaskFrame.name = 'longtask-iframe-name';
// Simulate cross-origin by using sandbox.
longtaskFrame.sandbox = "allow-scripts";
document.body.appendChild(longtaskFrame);
longtaskFrame.src = 'resources/subframe-with-longtask.html'
longtaskFrame.src = sibling_url;
};
}, 'Performance longtask entries from cross-origin iframe are observable in its sibling.');
</script>
Expand Down

0 comments on commit 22e8ab1

Please sign in to comment.