Commit 883c6a72 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

Make sure TaskWorklet and WorkerTaskQueue are exposed only on secure contexts

Bug: 879306
Change-Id: Ibecaadbe13f27aa887426279efccaeab06defa2c
Reviewed-on: https://chromium-review.googlesource.com/c/1334671Reviewed-by: default avatarHiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608309}
parent 7b0308d5
<!DOCTYPE html>
<title>WorkerTaskQueue on an insecure context</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/get-host-info.js"></script>
<script>
if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
test(t => assert_not_equals(window.WorkerTaskQueue, undefined),
'WorkerTaskQueue should be available on a secure context.');
window.location = get_host_info().UNAUTHENTICATED_ORIGIN +
window.location.pathname;
} else {
test(t => assert_equals(window.WorkerTaskQueue, undefined),
'WorkerTaskQueue should not be available on an insecure context.');
}
</script>
<!DOCTYPE html>
<title>taskWorklet on an insecure context</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/get-host-info.js"></script>
<script>
if (window.location.origin != get_host_info().UNAUTHENTICATED_ORIGIN) {
test(t => assert_not_equals(window.taskWorklet, undefined),
'taskWorklet should be available on a secure context.');
window.location = get_host_info().UNAUTHENTICATED_ORIGIN +
window.location.pathname;
} else {
test(t => assert_equals(window.taskWorklet, undefined),
'taskWorklet should not be available on an insecure context.');
}
</script>
......@@ -4,7 +4,8 @@
[
RuntimeEnabled=WorkerTaskQueue,
ImplementedAs=WindowTaskWorklet
ImplementedAs=WindowTaskWorklet,
SecureContext
] partial interface Window {
[SameObject] readonly attribute TaskWorklet taskWorklet;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment