From 8fa3e31b308b4f418760789e77bb067db7d49de9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Wang?= Date: Thu, 9 Jan 2025 18:45:36 +0100 Subject: [PATCH] Verify the trusted type "sink" value for WorkerGlobalScope.importScripts() (#49999) It's "Worker importScripts" by 1.2.1 of https://html.spec.whatwg.org/multipage/workers.html#importing-scripts-and-libraries --- .../support/WorkerGlobalScope-importScripts.https.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/trusted-types/support/WorkerGlobalScope-importScripts.https.js b/trusted-types/support/WorkerGlobalScope-importScripts.https.js index c40e8550dd659e..a3ecfc481923b5 100644 --- a/trusted-types/support/WorkerGlobalScope-importScripts.https.js +++ b/trusted-types/support/WorkerGlobalScope-importScripts.https.js @@ -64,7 +64,10 @@ test(t => { // Test default policy application: trustedTypes.createPolicy("default", { - createScriptURL: url => url.replace("play", "work") + createScriptURL: (url, _, sink) => { + assert_equals(sink, "Worker importScripts"); + return url.replace("play", "work"); + } }, true); test(t => { self.result = "Fail";