Files
sousa-gecko/testing/web-platform/tests/js-self-profiling/with-document-policy/dedicated-worker-no-policy.https.html
T
Monica Chintala 48eafe51c7 Bug 2021195 [wpt PR 58274] - Allow JS Self-Profiling in Dedicated Workers, a=testonly
Automatic update from web-platform-tests
Allow JS Self-Profiling in Dedicated Workers

Document Policy is now inherited by Dedicated Workers (see
https://chromium-review.googlesource.com/c/chromium/src/+/7236250).

This change allows the JS Self-Profiling API to be used in workers when
Document Policy is enabled and the js-profiling feature is allowed via
the Document-Policy: js-profiling response header.

This CL also adds WPT tests to verify that Dedicated Workers can use the
profiling API when the js-profiling feature is enabled through Document
Policy.

Spec PR (merged) - https://github.com/WICG/js-self-profiling/pull/88
ChromeStatus - https://chromestatus.com/feature/5159559872249856 I2P -
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/69975252.050a0220.1f729.0da6.GAE%40google.com

Bug: 482085416
Change-Id: Ica61d6d2169926095f29f7a82e482acba56c7fc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7546208
Reviewed-by: Scott Haseley <shaseley@chromium.org>
Commit-Queue: Monica Chintala <monicach@microsoft.com>
Reviewed-by: Liang Zhao <lzhao@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1594390}

--

wpt-commits: a8eccee92ad9f1160d03c228126a1d7bfd803c73
wpt-pr: 58274
2026-03-12 15:56:11 +00:00

27 lines
1.1 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
// A network-loaded worker script served WITHOUT Document-Policy header
// should NOT inherit js-profiling from the creator document. This verifies
// no unintentional policy inheritance occurs for network workers.
promise_test(async t => {
const worker = new Worker('/js-self-profiling/without-document-policy/dedicated-worker-profiler-test.js');
const result = await new Promise((resolve, reject) => {
worker.onmessage = e => resolve(e.data);
worker.onerror = e => reject(new Error(e.message));
});
assert_false(result.success,
'profiling should fail in dedicated worker without document policy header');
assert_equals(result.error, 'NotAllowedError',
'profiling should be blocked without document policy header');
worker.terminate();
}, 'profiling should be blocked for network worker without document policy header');
</script>
</body>
</html>