From b153d61a45c7031a1d801249c92b333729a95687 Mon Sep 17 00:00:00 2001 From: Yutaka Hirano Date: Fri, 20 Dec 2019 11:38:00 +0000 Subject: [PATCH] Bug 1600233 [wpt PR 20526] - Disallow serializing and transferring non-origin-clean ImageBitmap, a=testonly Automatic update from web-platform-tests Disallow serializing and transferring non-origin-clean ImageBitmap (#20526) The tests update for https://github.com/whatwg/html/pull/5114. Add one test case for serialization, add one test case for transferring. The relationship between COOP/COEP is now clear and we can remove no-coop-coep.https.window.js. -- wpt-commits: 578b1c621b57c2ad51442cb273bd5b8ea1dfed63 wpt-pr: 20526 --- .../createImageBitmap-serializable.html | 9 ++++ .../imagebitmap/createImageBitmap-transfer.html | 11 +++++ .../imagebitmap/no-coop-coep.https.window.js | 50 ---------------------- .../imagebitmap/resources/coop-coep-popup.html | 11 ----- .../resources/coop-coep-popup.html.headers | 2 - .../imagebitmap/resources/coop-coep-worker.js | 9 ---- .../resources/coop-coep-worker.js.headers | 1 - 7 files changed, 20 insertions(+), 73 deletions(-) delete mode 100644 testing/web-platform/tests/2dcontext/imagebitmap/no-coop-coep.https.window.js delete mode 100644 testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html delete mode 100644 testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html.headers delete mode 100644 testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js delete mode 100644 testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js.headers diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-serializable.html b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-serializable.html index b40d9cec3f37..a4434aec6e43 100644 --- a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-serializable.html +++ b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-serializable.html @@ -6,6 +6,7 @@ +
diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-transfer.html b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-transfer.html index 580ec8a5ed04..708f97097c16 100644 --- a/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-transfer.html +++ b/testing/web-platform/tests/2dcontext/imagebitmap/createImageBitmap-transfer.html @@ -5,6 +5,7 @@ +
diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/no-coop-coep.https.window.js b/testing/web-platform/tests/2dcontext/imagebitmap/no-coop-coep.https.window.js deleted file mode 100644 index 5295f1e10cfd..000000000000 --- a/testing/web-platform/tests/2dcontext/imagebitmap/no-coop-coep.https.window.js +++ /dev/null @@ -1,50 +0,0 @@ -// META: script=/common/utils.js -// META: script=/common/get-host-info.sub.js - -function taintedImageBitmap(t) { - return new Promise(resolve => { - const img = new Image(); - img.src = `${get_host_info().HTTPS_REMOTE_ORIGIN}/images/blue.png`; - img.onload = t.step_func(() => { - resolve(createImageBitmap(img)); - }); - img.onerror = t.unreached_func(); - }); -} - -async_test(t => { - const bc = new BroadcastChannel(token()); - const popup = window.open(`resources/coop-coep-popup.html?channel=${bc.name}`); - const popupReady = new Promise(resolve => { - bc.onmessage = t.step_func(resolve); - }); - const imageReady = taintedImageBitmap(t); - Promise.all([popupReady, imageReady]).then(t.step_func(([, bitmap]) => { - bc.onmessage = t.step_func_done(e => { - assert_equals(e.data, "Got failure as expected."); - }); - bc.postMessage(bitmap); - })); -}, "BroadcastChannel'ing a tainted ImageBitmap to a COOP+COEP popup"); - -[ - { - "type": "serialize/deserialize", - "message": (port, bitmap) => port.postMessage(bitmap) - }, - { - "type": "transfer", - "message": (port, bitmap) => port.postMessage(bitmap, [bitmap]) - } -].forEach(({ type, message }) => { - async_test(t => { - const sw = new SharedWorker("resources/coop-coep-worker.js"); - const imageReady = taintedImageBitmap(t); - imageReady.then(t.step_func(bitmap => { - sw.port.onmessage = t.step_func_done(e => { - assert_equals(e.data, "Got failure as expected."); - }); - message(sw.port, bitmap); - })); - }, `Messaging a tainted ImageBitMap via ${type} to a COEP shared worker`); -}); diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html b/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html deleted file mode 100644 index f0228503ffa8..000000000000 --- a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html +++ /dev/null @@ -1,11 +0,0 @@ - diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html.headers b/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html.headers deleted file mode 100644 index 63b60e490f47..000000000000 --- a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-popup.html.headers +++ /dev/null @@ -1,2 +0,0 @@ -Cross-Origin-Opener-Policy: same-origin -Cross-Origin-Embedder-Policy: require-corp diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js b/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js deleted file mode 100644 index a6e9cc58935c..000000000000 --- a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js +++ /dev/null @@ -1,9 +0,0 @@ -onconnect = e => { - const port = e.source; - port.onmessageerror = e => { - port.postMessage("Got failure as expected."); - } - port.onmessage = e => { - port.postMessage("Got message, expected failure."); - } -} diff --git a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js.headers b/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js.headers deleted file mode 100644 index 6604450991a1..000000000000 --- a/testing/web-platform/tests/2dcontext/imagebitmap/resources/coop-coep-worker.js.headers +++ /dev/null @@ -1 +0,0 @@ -Cross-Origin-Embedder-Policy: require-corp -- 2.11.4.GIT