tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit a82c686a0bbe145f8dec22b5f9c070a7bfe8d3e5
parent fa5eee85b6c380f6d8a8b3553beeecd43bced98e
Author: Ms2ger <Ms2ger@gmail.com>
Date:   Wed,  7 Jan 2026 09:47:40 +0000

Bug 2008563 [wpt PR 56987] - [wasm] generalize some web-api tests to any.js, a=testonly

Automatic update from web-platform-tests
[wasm] generalize some web-api tests to any.js

--

wpt-commits: 637d836e6238e360fadc9313c9169cb05c84fdbb
wpt-pr: 56987

Diffstat:
Mtesting/web-platform/tests/infrastructure/metadata/infrastructure/testdriver/generate_test_report.html.ini | 5+----
Mtesting/web-platform/tests/tools/wptrunner/requirements_firefox.txt | 2+-
Atesting/web-platform/tests/wasm/webapi/wasm_stream_compile_test.any.js | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dtesting/web-platform/tests/wasm/webapi/wasm_stream_compile_test.html | 115-------------------------------------------------------------------------------
Atesting/web-platform/tests/wasm/webapi/wasm_stream_instantiate_test.any.js | 109+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dtesting/web-platform/tests/wasm/webapi/wasm_stream_instantiate_test.html | 115-------------------------------------------------------------------------------
6 files changed, 220 insertions(+), 235 deletions(-)

diff --git a/testing/web-platform/tests/infrastructure/metadata/infrastructure/testdriver/generate_test_report.html.ini b/testing/web-platform/tests/infrastructure/metadata/infrastructure/testdriver/generate_test_report.html.ini @@ -1,7 +1,4 @@ [generate_test_report.html] - expected: - if product == "firefox_android": [OK, TIMEOUT] [TestDriver generate_test_report method] expected: - if (product == "firefox") or (product == "epiphany") or (product == "webkit"): FAIL - if product == "firefox_android": FAIL + if (product == "epiphany") or (product == "webkit"): FAIL diff --git a/testing/web-platform/tests/tools/wptrunner/requirements_firefox.txt b/testing/web-platform/tests/tools/wptrunner/requirements_firefox.txt @@ -1,4 +1,4 @@ -marionette_driver==3.4.0 +marionette_driver==3.5.0 mozcrash==2.2.1 mozdevice==4.2.0 mozinstall==2.1.0 diff --git a/testing/web-platform/tests/wasm/webapi/wasm_stream_compile_test.any.js b/testing/web-platform/tests/wasm/webapi/wasm_stream_compile_test.any.js @@ -0,0 +1,109 @@ +// META: title=WebAssembly.compileStreaming +// META: script=/common/get-host-info.sub.js + promise_test(async function() { + const response = await fetch('resources/incrementer.wasm'); + const module = await WebAssembly.compileStreaming(response); + assert_true(module instanceof WebAssembly.Module); + }, "compileStreaming using resolved response"); + + promise_test(async function() { + const response = await fetch('resources/incrementer.wasm'); + const module = await WebAssembly.compileStreaming(response); + const instance = new WebAssembly.Instance(module); + assert_true(instance instanceof WebAssembly.Instance); + }, "compileStreaming using resolved response and check instantiate"); + + promise_test(async function() { + const result = fetch('resources/incrementer.wasm'); + const module = await WebAssembly.compileStreaming(result); + const instance = new WebAssembly.Instance(module); + assert_true(instance instanceof WebAssembly.Instance); + }, "compileStreaming using promise response from fetch and check instantiate"); + + promise_test(async function(t) { + const result = fetch('resources/incrementer.wrong_mime_type.wasm'); + await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); + }, "compileStreaming raise error if wrong mime type"); + + promise_test(async function(t) { + const result = fetch('resources/incrementer.no_mime_type.wasm?pipe=header(Content-Type,)'); + await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); + }, "compileStreaming raise error if no mime type"); + + promise_test(async function(t) { + const result = fetch('webapi/status.py?status=404'); + await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); + }, "compileStreaming raise error if 404 status"); + + const getWasmUrl = fileName => { + const host_info = get_host_info(); + const url = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + '/wasm/webapi/'; + return url + fileName + "?pipe=header(Access-Control-Allow-Origin,*)"; + }; + + promise_test(async function() { + const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "cors"} ); + const module = await WebAssembly.compileStreaming(result); + assert_true(module instanceof WebAssembly.Module); + }, "compileStreaming check CORS"); + + promise_test(async function(t) { + const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "no-cors"} ); + await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); + }, "compileStreaming raise error if no-cors"); + + promise_test(async function() { + const v = await fetch('resources/incrementer.wasm'); + const buffer = await v.arrayBuffer(); + const response = new Response(buffer, { headers: { "Content-Type" : "application/wasm" }}); + const module = await WebAssembly.compileStreaming(response); + assert_true(module instanceof WebAssembly.Module); + }, "compileStreaming receive promise with response created from ArrayBuffer"); + + promise_test(async function() { + const v = await fetch('resources/incrementer.wasm'); + const buffer = await v.arrayBuffer(); + const stream = new ReadableStream({ + start(controller) { + (async () => { + await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(0, 20)))); + await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(20, buffer.byteLength)))); + await Promise.resolve().then(() => controller.close()); + })(); + } + }); + const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); + const module = await WebAssembly.compileStreaming(response); + assert_true(module instanceof WebAssembly.Module); + }, "compileStreaming using ReadableStream with Uint8Array chunks"); + + promise_test(async function(t) { + const v = await fetch('resources/incrementer.wasm'); + const buffer = await v.arrayBuffer(); + const stream = new ReadableStream({ + start(controller) { + // Enqueuing an ArrayBuffer rather a Uint8Array per + // https://streams.spec.whatwg.org/#read-loop + controller.enqueue(buffer); + controller.close(); + } + }); + const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); + await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(response)); + }, "compileStreaming using ReadableStream with ArrayBuffer chunk"); + + promise_test(async function() { + const response = await fetch('resources/incrementer.wasm'); + const blob = await response.blob(); + const module = await WebAssembly.compileStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); + assert_true(module instanceof WebAssembly.Module); + }, "compileStreaming using blob"); + + promise_test(async function(t) { + const response = await fetch('resources/incrementer.wasm'); + const blob = await response.blob(); + const formData = new FormData; + formData.append('blob', blob); + formData.append('blob2', "Hello"); + await promise_rejects_js(t, WebAssembly.CompileError, WebAssembly.compileStreaming(new Response(formData, { headers: { "Content-Type" : "application/wasm" }}))); + }, "compileStreaming using FormData"); diff --git a/testing/web-platform/tests/wasm/webapi/wasm_stream_compile_test.html b/testing/web-platform/tests/wasm/webapi/wasm_stream_compile_test.html @@ -1,115 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>WebAssembly.compileStreaming</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/common/get-host-info.sub.js"></script> -<script> - promise_test(async function() { - const response = await fetch('resources/incrementer.wasm'); - const module = await WebAssembly.compileStreaming(response); - assert_true(module instanceof WebAssembly.Module); - }, "compileStreaming using resolved response"); - - promise_test(async function() { - const response = await fetch('resources/incrementer.wasm'); - const module = await WebAssembly.compileStreaming(response); - const instance = new WebAssembly.Instance(module); - assert_true(instance instanceof WebAssembly.Instance); - }, "compileStreaming using resolved response and check instantiate"); - - promise_test(async function() { - const result = fetch('resources/incrementer.wasm'); - const module = await WebAssembly.compileStreaming(result); - const instance = new WebAssembly.Instance(module); - assert_true(instance instanceof WebAssembly.Instance); - }, "compileStreaming using promise response from fetch and check instantiate"); - - promise_test(async function(t) { - const result = fetch('resources/incrementer.wrong_mime_type.wasm'); - await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); - }, "compileStreaming raise error if wrong mime type"); - - promise_test(async function(t) { - const result = fetch('resources/incrementer.no_mime_type.wasm?pipe=header(Content-Type,)'); - await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); - }, "compileStreaming raise error if no mime type"); - - promise_test(async function(t) { - const result = fetch('webapi/status.py?status=404'); - await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); - }, "compileStreaming raise error if 404 status"); - - const getWasmUrl = fileName => { - const host_info = get_host_info(); - const url = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + '/wasm/webapi/'; - return url + fileName + "?pipe=header(Access-Control-Allow-Origin,*)"; - }; - - promise_test(async function() { - const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "cors"} ); - const module = await WebAssembly.compileStreaming(result); - assert_true(module instanceof WebAssembly.Module); - }, "compileStreaming check CORS"); - - promise_test(async function(t) { - const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "no-cors"} ); - await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(result)); - }, "compileStreaming raise error if no-cors"); - - promise_test(async function() { - const v = await fetch('resources/incrementer.wasm'); - const buffer = await v.arrayBuffer(); - const response = new Response(buffer, { headers: { "Content-Type" : "application/wasm" }}); - const module = await WebAssembly.compileStreaming(response); - assert_true(module instanceof WebAssembly.Module); - }, "compileStreaming receive promise with response created from ArrayBuffer"); - - promise_test(async function() { - const v = await fetch('resources/incrementer.wasm'); - const buffer = await v.arrayBuffer(); - const stream = new ReadableStream({ - start(controller) { - (async () => { - await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(0, 20)))); - await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(20, buffer.byteLength)))); - await Promise.resolve().then(() => controller.close()); - })(); - } - }); - const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); - const module = await WebAssembly.compileStreaming(response); - assert_true(module instanceof WebAssembly.Module); - }, "compileStreaming using ReadableStream with Uint8Array chunks"); - - promise_test(async function(t) { - const v = await fetch('resources/incrementer.wasm'); - const buffer = await v.arrayBuffer(); - const stream = new ReadableStream({ - start(controller) { - // Enqueuing an ArrayBuffer rather a Uint8Array per - // https://streams.spec.whatwg.org/#read-loop - controller.enqueue(buffer); - controller.close(); - } - }); - const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); - await promise_rejects_js(t, TypeError, WebAssembly.compileStreaming(response)); - }, "compileStreaming using ReadableStream with ArrayBuffer chunk"); - - promise_test(async function() { - const response = await fetch('resources/incrementer.wasm'); - const blob = await response.blob(); - const module = await WebAssembly.compileStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); - assert_true(module instanceof WebAssembly.Module); - }, "compileStreaming using blob"); - - promise_test(async function(t) { - const response = await fetch('resources/incrementer.wasm'); - const blob = await response.blob(); - const formData = new FormData; - formData.append('blob', blob); - formData.append('blob2', "Hello"); - await promise_rejects_js(t, WebAssembly.CompileError, WebAssembly.compileStreaming(new Response(formData, { headers: { "Content-Type" : "application/wasm" }}))); - }, "compileStreaming using FormData"); -</script> diff --git a/testing/web-platform/tests/wasm/webapi/wasm_stream_instantiate_test.any.js b/testing/web-platform/tests/wasm/webapi/wasm_stream_instantiate_test.any.js @@ -0,0 +1,109 @@ +// META: title=WebAssembly.instantiateStreaming +// META: script=/common/get-host-info.sub.js + promise_test(async function() { + const response = await fetch('resources/incrementer.wasm'); + const { instance, module } = await WebAssembly.instantiateStreaming(response); + assert_true(instance instanceof WebAssembly.Instance); + assert_true(module instanceof WebAssembly.Module); + }, "instantiateStreaming using resolved response"); + + promise_test(async function() { + const response = await fetch('resources/incrementer.wasm'); + const { instance } = await WebAssembly.instantiateStreaming(response); + assert_true(instance instanceof WebAssembly.Instance); + }, "instantiateStreaming using resolved response and check instantiate"); + + promise_test(async function() { + const result = fetch('resources/incrementer.wasm'); + const { instance } = await WebAssembly.instantiateStreaming(result); + assert_true(instance instanceof WebAssembly.Instance); + }, "instantiateStreaming using promise response from fetch and check instantiate"); + + promise_test(async function(t) { + const result = fetch('resources/incrementer.wrong_mime_type.wasm'); + await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); + }, "instantiateStreaming raise error if wrong mime type"); + + promise_test(async function(t) { + const result = fetch('resources/incrementer.no_mime_type.wasm?pipe=header(Content-Type,)'); + await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); + }, "instantiateStreaming raise error if no mime type"); + + promise_test(async function(t) { + const result = fetch('webapi/status.py?status=404'); + await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); + }, "instantiateStreaming raise error if 404 status"); + + const getWasmUrl = fileName => { + const host_info = get_host_info(); + const url = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + '/wasm/webapi/'; + return url + fileName + "?pipe=header(Access-Control-Allow-Origin,*)"; + }; + + promise_test(async function() { + const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "cors"} ); + const { instance } = await WebAssembly.instantiateStreaming(result); + assert_true(instance instanceof WebAssembly.Instance); + }, "instantiateStreaming check CORS"); + + promise_test(async function(t) { + const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "no-cors"} ); + await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); + }, "instantiateStreaming raise error if no-cors"); + + promise_test(async function() { + const v = await fetch('resources/incrementer.wasm'); + const buffer = await v.arrayBuffer(); + const response = new Response(buffer, { headers: { "Content-Type" : "application/wasm" }}); + const { instance } = await WebAssembly.instantiateStreaming(response); + assert_true(instance instanceof WebAssembly.Instance); + }, "instantiateStreaming receive promise with response created from ArrayBuffer"); + + promise_test(async function() { + const v = await fetch('resources/incrementer.wasm'); + const buffer = await v.arrayBuffer(); + const stream = new ReadableStream({ + start(controller) { + (async () => { + await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(0, 20)))); + await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(20, buffer.byteLength)))); + await Promise.resolve().then(() => controller.close()); + })(); + } + }); + const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); + const { instance } = await WebAssembly.instantiateStreaming(response); + assert_true(instance instanceof WebAssembly.Instance); + }, "instantiateStreaming using ReadableStream with Uint8Array chunks"); + + promise_test(async function(t) { + const v = await fetch('resources/incrementer.wasm'); + const buffer = await v.arrayBuffer(); + const stream = new ReadableStream({ + start(controller) { + // Enqueuing an ArrayBuffer rather a Uint8Array per + // https://streams.spec.whatwg.org/#read-loop + controller.enqueue(buffer); + controller.close(); + } + }); + const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); + await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(response)); + }, "instantiateStreaming using ReadableStream with ArrayBuffer chunk"); + + promise_test(async function() { + const response = await fetch('resources/incrementer.wasm'); + const blob = await response.blob(); + const { instance, module } = await WebAssembly.instantiateStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); + assert_true(instance instanceof WebAssembly.Instance); + assert_true(module instanceof WebAssembly.Module); + }, "instantiateStreaming using blob"); + + promise_test(async function(t) { + const response = await fetch('resources/incrementer.wasm'); + const blob = await response.blob(); + const formData = new FormData; + formData.append('blob', blob); + formData.append('blob2', "Hello"); + await promise_rejects_js(t, WebAssembly.CompileError, WebAssembly.instantiateStreaming(new Response(formData, { headers: { "Content-Type" : "application/wasm" }}))); + }, "instantiateStreaming using FormData"); diff --git a/testing/web-platform/tests/wasm/webapi/wasm_stream_instantiate_test.html b/testing/web-platform/tests/wasm/webapi/wasm_stream_instantiate_test.html @@ -1,115 +0,0 @@ -<!DOCTYPE html> -<meta charset="utf-8"> -<title>WebAssembly.instantiateStreaming</title> -<script src="/resources/testharness.js"></script> -<script src="/resources/testharnessreport.js"></script> -<script src="/common/get-host-info.sub.js"></script> -<script> - promise_test(async function() { - const response = await fetch('resources/incrementer.wasm'); - const { instance, module } = await WebAssembly.instantiateStreaming(response); - assert_true(instance instanceof WebAssembly.Instance); - assert_true(module instanceof WebAssembly.Module); - }, "instantiateStreaming using resolved response"); - - promise_test(async function() { - const response = await fetch('resources/incrementer.wasm'); - const { instance } = await WebAssembly.instantiateStreaming(response); - assert_true(instance instanceof WebAssembly.Instance); - }, "instantiateStreaming using resolved response and check instantiate"); - - promise_test(async function() { - const result = fetch('resources/incrementer.wasm'); - const { instance } = await WebAssembly.instantiateStreaming(result); - assert_true(instance instanceof WebAssembly.Instance); - }, "instantiateStreaming using promise response from fetch and check instantiate"); - - promise_test(async function(t) { - const result = fetch('resources/incrementer.wrong_mime_type.wasm'); - await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); - }, "instantiateStreaming raise error if wrong mime type"); - - promise_test(async function(t) { - const result = fetch('resources/incrementer.no_mime_type.wasm?pipe=header(Content-Type,)'); - await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); - }, "instantiateStreaming raise error if no mime type"); - - promise_test(async function(t) { - const result = fetch('webapi/status.py?status=404'); - await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); - }, "instantiateStreaming raise error if 404 status"); - - const getWasmUrl = fileName => { - const host_info = get_host_info(); - const url = host_info.HTTP_ORIGIN_WITH_DIFFERENT_PORT + '/wasm/webapi/'; - return url + fileName + "?pipe=header(Access-Control-Allow-Origin,*)"; - }; - - promise_test(async function() { - const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "cors"} ); - const { instance } = await WebAssembly.instantiateStreaming(result); - assert_true(instance instanceof WebAssembly.Instance); - }, "instantiateStreaming check CORS"); - - promise_test(async function(t) { - const result = fetch(getWasmUrl('resources/incrementer.wasm'), {"mode": "no-cors"} ); - await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(result)); - }, "instantiateStreaming raise error if no-cors"); - - promise_test(async function() { - const v = await fetch('resources/incrementer.wasm'); - const buffer = await v.arrayBuffer(); - const response = new Response(buffer, { headers: { "Content-Type" : "application/wasm" }}); - const { instance } = await WebAssembly.instantiateStreaming(response); - assert_true(instance instanceof WebAssembly.Instance); - }, "instantiateStreaming receive promise with response created from ArrayBuffer"); - - promise_test(async function() { - const v = await fetch('resources/incrementer.wasm'); - const buffer = await v.arrayBuffer(); - const stream = new ReadableStream({ - start(controller) { - (async () => { - await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(0, 20)))); - await Promise.resolve().then(() => controller.enqueue(new Uint8Array(buffer.slice(20, buffer.byteLength)))); - await Promise.resolve().then(() => controller.close()); - })(); - } - }); - const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); - const { instance } = await WebAssembly.instantiateStreaming(response); - assert_true(instance instanceof WebAssembly.Instance); - }, "instantiateStreaming using ReadableStream with Uint8Array chunks"); - - promise_test(async function(t) { - const v = await fetch('resources/incrementer.wasm'); - const buffer = await v.arrayBuffer(); - const stream = new ReadableStream({ - start(controller) { - // Enqueuing an ArrayBuffer rather a Uint8Array per - // https://streams.spec.whatwg.org/#read-loop - controller.enqueue(buffer); - controller.close(); - } - }); - const response = new Response(stream, { headers: { "Content-Type" : "application/wasm" }}); - await promise_rejects_js(t, TypeError, WebAssembly.instantiateStreaming(response)); - }, "instantiateStreaming using ReadableStream with ArrayBuffer chunk"); - - promise_test(async function() { - const response = await fetch('resources/incrementer.wasm'); - const blob = await response.blob(); - const { instance, module } = await WebAssembly.instantiateStreaming(new Response(blob, { headers: { "Content-Type" : "application/wasm" }})); - assert_true(instance instanceof WebAssembly.Instance); - assert_true(module instanceof WebAssembly.Module); - }, "instantiateStreaming using blob"); - - promise_test(async function(t) { - const response = await fetch('resources/incrementer.wasm'); - const blob = await response.blob(); - const formData = new FormData; - formData.append('blob', blob); - formData.append('blob2', "Hello"); - await promise_rejects_js(t, WebAssembly.CompileError, WebAssembly.instantiateStreaming(new Response(formData, { headers: { "Content-Type" : "application/wasm" }}))); - }, "instantiateStreaming using FormData"); -</script>