Commit b1299b5f authored by Chromium WPT Sync's avatar Chromium WPT Sync Committed by Commit Bot

Import wpt@b3e9536a7ca2a6fbdb732b85275e13cc6d454237

Using wpt-import in Chromium db533a7b.
With Chromium commits locally applied on WPT:
f79c6fe7 "Reimplementing getDatabaseNames() as databases() for indexeddb."


Build: https://ci.chromium.org/buildbot/chromium.infra.cron/wpt-importer/26609

Note to sheriffs: This CL imports external tests and adds
expectations for those tests; if this CL is large and causes
a few new failures, please fix the failures by adding new
lines to TestExpectations rather than reverting. See:
https://chromium.googlesource.com/chromium/src/+/master/docs/testing/web_platform_tests.md

Directory owners for changes in this CL:
binji@chromium.org:
  external/wpt/wasm

NOAUTOREVERT=true
TBR=markdittmer

No-Export: true
Change-Id: I7cb02d2d5abc4ee69b4f63712de205ba22e719d9
Reviewed-on: https://chromium-review.googlesource.com/c/1296813
Commit-Queue: Blink WPT Bot <blink-w3c-test-autoroller@chromium.org>
Reviewed-by: default avatarBlink WPT Bot <blink-w3c-test-autoroller@chromium.org>
Cr-Commit-Position: refs/heads/master@{#602061}
parent 6ce66e47
......@@ -2907,6 +2907,19 @@ crbug.com/893480 external/wpt/infrastructure/testdriver/actions/eventOrder.html
crbug.com/893480 external/wpt/infrastructure/testdriver/actions/multiDevice.html [ Failure ]
# ====== New tests from wpt-importer added here ======
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming-bad-imports.any.serviceworker.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/rejected-arg.any.html [ Timeout ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming.any.serviceworker.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming.any.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/rejected-arg.any.serviceworker.html [ Timeout ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming-bad-imports.any.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming-bad-imports.any.sharedworker.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/rejected-arg.any.worker.html [ Timeout ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming-bad-imports.any.worker.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/origin.sub.any.serviceworker.html [ Timeout ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming.any.sharedworker.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/instantiateStreaming.any.worker.html [ Crash ]
crbug.com/626703 external/wpt/wasm/webapi/rejected-arg.any.sharedworker.html [ Timeout ]
crbug.com/626703 [ Mac10.11 ] external/wpt/css/vendor-imports/mozilla/mozilla-central-reftests/flexbox/flexbox-intrinsic-ratio-003v.html [ Failure ]
crbug.com/626703 [ Mac10.11 ] virtual/outofblink-cors-ns/external/wpt/referrer-policy/same-origin/attr-referrer/cross-origin/http-https/script-tag/cross-origin.swap-origin-redirect.http.html [ Crash ]
crbug.com/626703 [ Mac10.11 ] virtual/outofblink-cors-ns/external/wpt/referrer-policy/origin-when-cross-origin/http-rp/cross-origin/http-http/img-tag/cross-origin.swap-origin-redirect.http.html [ Crash ]
......
This is a testharness.js-based test.
PASS createImageBitmap with a an HTMLCanvasElement source and sw set to 0
PASS createImageBitmap with a an HTMLCanvasElement source and sh set to 0
PASS createImageBitmap with a an HTMLCanvasElement source and oversized (unallocatable) crop region
PASS createImageBitmap with a an HTMLVideoElement source and sw set to 0
PASS createImageBitmap with a an HTMLVideoElement source and sh set to 0
PASS createImageBitmap with a an HTMLVideoElement source and oversized (unallocatable) crop region
PASS createImageBitmap with a an HTMLVideoElement from a data URL source and sw set to 0
PASS createImageBitmap with a an HTMLVideoElement from a data URL source and sh set to 0
PASS createImageBitmap with a an HTMLVideoElement from a data URL source and oversized (unallocatable) crop region
PASS createImageBitmap with a a bitmap HTMLImageElement source and sw set to 0
PASS createImageBitmap with a a bitmap HTMLImageElement source and sh set to 0
PASS createImageBitmap with a a bitmap HTMLImageElement source and oversized (unallocatable) crop region
PASS createImageBitmap with a a vector HTMLImageElement source and sw set to 0
PASS createImageBitmap with a a vector HTMLImageElement source and sh set to 0
FAIL createImageBitmap with a a vector HTMLImageElement source and oversized (unallocatable) crop region assert_throws: function "function() { throw e }" threw null, not an object
PASS createImageBitmap with a a bitmap SVGImageElement source and sw set to 0
PASS createImageBitmap with a a bitmap SVGImageElement source and sh set to 0
PASS createImageBitmap with a a bitmap SVGImageElement source and oversized (unallocatable) crop region
PASS createImageBitmap with a a vector SVGImageElement source and sw set to 0
PASS createImageBitmap with a a vector SVGImageElement source and sh set to 0
FAIL createImageBitmap with a a vector SVGImageElement source and oversized (unallocatable) crop region assert_throws: function "function() { throw e }" threw null, not an object
PASS createImageBitmap with a an OffscreenCanvas source and sw set to 0
PASS createImageBitmap with a an OffscreenCanvas source and sh set to 0
PASS createImageBitmap with a an OffscreenCanvas source and oversized (unallocatable) crop region
PASS createImageBitmap with a an ImageData source and sw set to 0
PASS createImageBitmap with a an ImageData source and sh set to 0
PASS createImageBitmap with a an ImageData source and oversized (unallocatable) crop region
PASS createImageBitmap with a an ImageBitmap source and sw set to 0
PASS createImageBitmap with a an ImageBitmap source and sh set to 0
PASS createImageBitmap with a an ImageBitmap source and oversized (unallocatable) crop region
PASS createImageBitmap with a a Blob source and sw set to 0
PASS createImageBitmap with a a Blob source and sh set to 0
PASS createImageBitmap with a a Blob source and oversized (unallocatable) crop region
PASS createImageBitmap with an HTMLCanvasElement source and sw set to 0
PASS createImageBitmap with an HTMLCanvasElement source and sh set to 0
PASS createImageBitmap with an HTMLCanvasElement source and oversized (unallocatable) crop region
PASS createImageBitmap with an HTMLVideoElement source and sw set to 0
PASS createImageBitmap with an HTMLVideoElement source and sh set to 0
PASS createImageBitmap with an HTMLVideoElement source and oversized (unallocatable) crop region
PASS createImageBitmap with an HTMLVideoElement from a data URL source and sw set to 0
PASS createImageBitmap with an HTMLVideoElement from a data URL source and sh set to 0
PASS createImageBitmap with an HTMLVideoElement from a data URL source and oversized (unallocatable) crop region
PASS createImageBitmap with a bitmap HTMLImageElement source and sw set to 0
PASS createImageBitmap with a bitmap HTMLImageElement source and sh set to 0
PASS createImageBitmap with a bitmap HTMLImageElement source and oversized (unallocatable) crop region
PASS createImageBitmap with a vector HTMLImageElement source and sw set to 0
PASS createImageBitmap with a vector HTMLImageElement source and sh set to 0
FAIL createImageBitmap with a vector HTMLImageElement source and oversized (unallocatable) crop region assert_throws: function "function() { throw e }" threw null, not an object
PASS createImageBitmap with a bitmap SVGImageElement source and sw set to 0
PASS createImageBitmap with a bitmap SVGImageElement source and sh set to 0
PASS createImageBitmap with a bitmap SVGImageElement source and oversized (unallocatable) crop region
PASS createImageBitmap with a vector SVGImageElement source and sw set to 0
PASS createImageBitmap with a vector SVGImageElement source and sh set to 0
FAIL createImageBitmap with a vector SVGImageElement source and oversized (unallocatable) crop region assert_throws: function "function() { throw e }" threw null, not an object
PASS createImageBitmap with an OffscreenCanvas source and sw set to 0
PASS createImageBitmap with an OffscreenCanvas source and sh set to 0
PASS createImageBitmap with an OffscreenCanvas source and oversized (unallocatable) crop region
PASS createImageBitmap with an ImageData source and sw set to 0
PASS createImageBitmap with an ImageData source and sh set to 0
PASS createImageBitmap with an ImageData source and oversized (unallocatable) crop region
PASS createImageBitmap with an ImageBitmap source and sw set to 0
PASS createImageBitmap with an ImageBitmap source and sh set to 0
PASS createImageBitmap with an ImageBitmap source and oversized (unallocatable) crop region
PASS createImageBitmap with a Blob source and sw set to 0
PASS createImageBitmap with a Blob source and sh set to 0
PASS createImageBitmap with a Blob source and oversized (unallocatable) crop region
PASS createImageBitmap with undefined image source.
PASS createImageBitmap with null image source.
PASS createImageBitmap with CanvasRenderingContext2D image source.
......
......@@ -49,7 +49,7 @@ function makeAvailableButBrokenImage(path) {
testCases = [
{
description: 'createImageBitmap with a <sourceType> source and sw set to 0',
description: 'createImageBitmap with <sourceType> source and sw set to 0',
promiseTestFunction:
(source, t) => {
return promise_rejects(t, new RangeError(),
......@@ -57,7 +57,7 @@ testCases = [
}
},
{
description: 'createImageBitmap with a <sourceType> source and sh set to 0',
description: 'createImageBitmap with <sourceType> source and sh set to 0',
promiseTestFunction:
(source, t) => {
return promise_rejects(t, new RangeError(),
......@@ -70,7 +70,7 @@ testCases = [
// InvalidStateError.
//
// Note: https://bugs.chromium.org/p/chromium/issues/detail?id=799025
description: 'createImageBitmap with a <sourceType> source and oversized ' +
description: 'createImageBitmap with <sourceType> source and oversized ' +
'(unallocatable) crop region',
promiseTestFunction:
(source, t) => {
......
<!DOCTYPE html>
<title>Service Worker: Clients.matchAll ordering</title>
<meta name=timeout content=long>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.sub.js"></script>
......
......@@ -71,3 +71,24 @@ function assert_Instance(instance, expected_exports) {
}
}
}
function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) {
assert_equals(Object.getPrototypeOf(actual), Object.prototype,
"Prototype");
assert_true(Object.isExtensible(actual), "Extensibility");
const module = Object.getOwnPropertyDescriptor(actual, "module");
assert_equals(typeof module, "object", "module: type of descriptor");
assert_true(module.writable, "module: writable");
assert_true(module.enumerable, "module: enumerable");
assert_true(module.configurable, "module: configurable");
assert_equals(Object.getPrototypeOf(module.value), WebAssembly.Module.prototype,
"module: prototype");
const instance = Object.getOwnPropertyDescriptor(actual, "instance");
assert_equals(typeof instance, "object", "instance: type of descriptor");
assert_true(instance.writable, "instance: writable");
assert_true(instance.enumerable, "instance: enumerable");
assert_true(instance.configurable, "instance: configurable");
assert_Instance(instance.value, expected_exports);
}
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = AsyncCompile: Wasm decoding failed: expected string length @+10
Harness Error. harness_status.status = 1 , harness_status.message = AsyncCompile: Wasm decoding failed: expected 4 bytes, fell off end @+0
PASS Missing argument
PASS Invalid arguments
PASS Branding
......
......@@ -78,7 +78,7 @@ promise_test(() => {
}, "Stray argument");
promise_test(() => {
const buffer = new WasmModuleBuilder().toBuffer();
const buffer = new Uint8Array(new WasmModuleBuilder().toBuffer());
assert_equals(buffer[0], 0);
const promise = WebAssembly.compile(buffer);
buffer[0] = 1;
......
This is a testharness.js-based test.
Harness Error. harness_status.status = 1 , harness_status.message = AsyncCompile: Wasm decoding failed: expected string length @+10
Harness Error. harness_status.status = 1 , harness_status.message = AsyncCompile: Wasm decoding failed: expected 4 bytes, fell off end @+0
PASS Missing argument
PASS Invalid arguments
PASS Branding
......
......@@ -4,27 +4,6 @@
// META: script=/wasm/jsapi/assertions.js
// META: script=/wasm/jsapi/instanceTestFactory.js
function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) {
assert_equals(Object.getPrototypeOf(actual), Object.prototype,
"Prototype");
assert_true(Object.isExtensible(actual), "Extensibility");
const module = Object.getOwnPropertyDescriptor(actual, "module");
assert_equals(typeof module, "object", "module: type of descriptor");
assert_true(module.writable, "module: writable");
assert_true(module.enumerable, "module: enumerable");
assert_true(module.configurable, "module: configurable");
assert_equals(Object.getPrototypeOf(module.value), WebAssembly.Module.prototype,
"module: prototype");
const instance = Object.getOwnPropertyDescriptor(actual, "instance");
assert_equals(typeof instance, "object", "instance: type of descriptor");
assert_true(instance.writable, "instance: writable");
assert_true(instance.enumerable, "instance: enumerable");
assert_true(instance.configurable, "instance: configurable");
assert_Instance(instance.value, expected_exports);
}
let emptyModuleBinary;
setup(() => {
emptyModuleBinary = new WasmModuleBuilder().toBuffer();
......@@ -108,7 +87,7 @@ promise_test(t => {
}, "Invalid code");
promise_test(() => {
const buffer = new WasmModuleBuilder().toBuffer();
const buffer = new Uint8Array(new WasmModuleBuilder().toBuffer());
assert_equals(buffer[0], 0);
const promise = WebAssembly.instantiate(buffer);
buffer[0] = 1;
......
......@@ -133,18 +133,14 @@ const instanceTestFactory = [
builder
.addFunction("fn", kSig_v_d)
.addBody([
kExprEnd
])
.addBody([])
.exportFunc();
builder
.addFunction("fn2", kSig_v_v)
.addBody([
kExprEnd
])
.addBody([])
.exportFunc();
builder.setFunctionTableLength(1);
builder.setTableLength(1);
builder.addExportOfKind("table", kExternalTable, 0);
builder.addGlobal(kWasmI32, true)
......@@ -190,7 +186,6 @@ const instanceTestFactory = [
kExprGetGlobal,
index,
kExprReturn,
kExprEnd,
])
.exportFunc();
......
......@@ -92,18 +92,14 @@ test(() => {
builder
.addFunction("fn", kSig_v_v)
.addBody([
kExprEnd
])
.addBody([])
.exportFunc();
builder
.addFunction("fn2", kSig_v_v)
.addBody([
kExprEnd
])
.addBody([])
.exportFunc();
builder.setFunctionTableLength(1);
builder.setTableLength(1);
builder.addExportOfKind("table", kExternalTable, 0);
builder.addGlobal(kWasmI32, true)
......
......@@ -9,15 +9,11 @@ setup(() => {
builder
.addFunction("fn", kSig_v_d)
.addBody([
kExprEnd
])
.addBody([])
.exportFunc();
builder
.addFunction("fn2", kSig_v_v)
.addBody([
kExprEnd
])
.addBody([])
.exportFunc();
const buffer = builder.toBuffer()
......
......@@ -21,7 +21,7 @@ var kWasmH1 = 0x61;
var kWasmH2 = 0x73;
var kWasmH3 = 0x6d;
var kWasmV0 = 1;
var kWasmV0 = 0x1;
var kWasmV1 = 0;
var kWasmV2 = 0;
var kWasmV3 = 0;
......@@ -65,10 +65,15 @@ let kCodeSectionCode = 10; // Function code
let kDataSectionCode = 11; // Data segments
let kNameSectionCode = 12; // Name section (encoded as string)
// Name section types
let kModuleNameCode = 0;
let kFunctionNamesCode = 1;
let kLocalNamesCode = 2;
let kWasmFunctionTypeForm = 0x60;
let kWasmAnyFunctionTypeForm = 0x70;
let kResizableMaximumFlag = 1;
let kHasMaximumFlag = 1;
// Function declaration flags
let kDeclFunctionName = 0x01;
......@@ -82,7 +87,6 @@ let kWasmI32 = 0x7f;
let kWasmI64 = 0x7e;
let kWasmF32 = 0x7d;
let kWasmF64 = 0x7c;
let kWasmS128 = 0x7b;
let kExternalFunction = 0;
let kExternalTable = 1;
......@@ -104,7 +108,7 @@ let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]);
let kSig_v_v = makeSig([], []);
let kSig_i_v = makeSig([], [kWasmI32]);
let kSig_l_v = makeSig([], [kWasmI64]);
let kSig_f_v = makeSig([], [kWasmF64]);
let kSig_f_v = makeSig([], [kWasmF32]);
let kSig_d_v = makeSig([], [kWasmF64]);
let kSig_v_i = makeSig([kWasmI32], []);
let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []);
......@@ -113,7 +117,6 @@ let kSig_v_l = makeSig([kWasmI64], []);
let kSig_v_d = makeSig([kWasmF64], []);
let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []);
let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []);
let kSig_s_v = makeSig([], [kWasmS128]);
function makeSig(params, results) {
return {params: params, results: results};
......@@ -191,7 +194,7 @@ let kExprI64StoreMem8 = 0x3c;
let kExprI64StoreMem16 = 0x3d;
let kExprI64StoreMem32 = 0x3e;
let kExprMemorySize = 0x3f;
let kExprGrowMemory = 0x40;
let kExprMemoryGrow = 0x40;
let kExprI32Eqz = 0x45;
let kExprI32Eq = 0x46;
let kExprI32Ne = 0x47;
......@@ -339,36 +342,34 @@ let kTrapMsgs = [
];
function assertTraps(trap, code) {
var threwException = true;
try {
if (typeof code === 'function') {
code();
} else {
eval(code);
}
threwException = false;
} catch (e) {
assertEquals("object", typeof e);
assertEquals(kTrapMsgs[trap], e.message);
// Success.
return;
try {
if (typeof code === 'function') {
code();
} else {
eval(code);
}
throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]);
} catch (e) {
assertEquals('object', typeof e);
assertEquals(kTrapMsgs[trap], e.message);
// Success.
return;
}
throw new MjsUnitAssertionError('Did not trap, expected: ' + kTrapMsgs[trap]);
}
function assertWasmThrows(value, code) {
assertEquals("number", typeof(value));
try {
if (typeof code === 'function') {
code();
} else {
eval(code);
}
} catch (e) {
assertEquals("number", typeof e);
assertEquals(value, e);
// Success.
return;
assertEquals('number', typeof value);
try {
if (typeof code === 'function') {
code();
} else {
eval(code);
}
throw new MjsUnitAssertionError("Did not throw at all, expected: " + value);
} catch (e) {
assertEquals('number', typeof e);
assertEquals(value, e);
// Success.
return;
}
throw new MjsUnitAssertionError('Did not throw, expected: ' + value);
}
// META: global=window,worker
// META: script=/wasm/jsapi/wasm-constants.js
// META: script=/wasm/jsapi/wasm-module-builder.js
for (const method of ["compileStreaming", "instantiateStreaming"]) {
promise_test(t => {
const buffer = new WasmModuleBuilder().toBuffer();
const argument = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
argument.arrayBuffer();
return promise_rejects(t, new TypeError(), WebAssembly[method](argument));
}, `${method} after consumption`);
promise_test(t => {
const buffer = new WasmModuleBuilder().toBuffer();
const argument = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
const promise = WebAssembly[method](argument);
argument.arrayBuffer();
return promise_rejects(t, new TypeError(), promise);
}, `${method} before consumption`);
}
......@@ -13,5 +13,11 @@ FAIL Response with Content-Type "application/wasm;x": compileStreaming assert_un
FAIL Response with Content-Type "application/wasm;x": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
PASS Response with Content-Type "application/wasm": compileStreaming
PASS Response with Content-Type "application/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/wasm": compileStreaming
PASS Response with Content-Type "APPLICATION/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/WASM": compileStreaming
PASS Response with Content-Type "APPLICATION/WASM": instantiateStreaming
Harness: the test ran to completion.
// META: global=window,worker
// META: script=/wasm/jsapi/assertions.js
const contenttypes = [
const invalidContentTypes = [
"",
"application/javascript",
"application/octet-stream",
......@@ -10,7 +11,7 @@ const contenttypes = [
"application/wasm;charset=UTF-8",
];
for (const contenttype of contenttypes) {
for (const contenttype of invalidContentTypes) {
promise_test(t => {
const response = fetch(`/wasm/incrementer.wasm?pipe=header(Content-Type,${encodeURIComponent(contenttype)})`);
return promise_rejects(t, new TypeError(), WebAssembly.compileStreaming(response));
......@@ -21,3 +22,24 @@ for (const contenttype of contenttypes) {
return promise_rejects(t, new TypeError(), WebAssembly.instantiateStreaming(response));
}, `Response with Content-Type ${format_value(contenttype)}: instantiateStreaming`);
}
const validContentTypes = [
"application/wasm",
"APPLICATION/wasm",
"APPLICATION/WASM",
];
for (const contenttype of validContentTypes) {
promise_test(async t => {
const response = fetch(`/wasm/incrementer.wasm?pipe=header(Content-Type,${encodeURIComponent(contenttype)})`);
const module = await WebAssembly.compileStreaming(response);
assert_equals(Object.getPrototypeOf(module), WebAssembly.Module.prototype,
"prototype");
}, `Response with Content-Type ${format_value(contenttype)}: compileStreaming`);
promise_test(async t => {
const response = fetch(`/wasm/incrementer.wasm?pipe=header(Content-Type,${encodeURIComponent(contenttype)})`);
const result = await WebAssembly.instantiateStreaming(response);
assert_WebAssemblyInstantiatedSource(result);
}, `Response with Content-Type ${format_value(contenttype)}: instantiateStreaming`);
}
......@@ -13,5 +13,11 @@ FAIL Response with Content-Type "application/wasm;x": compileStreaming assert_un
FAIL Response with Content-Type "application/wasm;x": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
PASS Response with Content-Type "application/wasm": compileStreaming
PASS Response with Content-Type "application/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/wasm": compileStreaming
PASS Response with Content-Type "APPLICATION/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/WASM": compileStreaming
PASS Response with Content-Type "APPLICATION/WASM": instantiateStreaming
Harness: the test ran to completion.
......@@ -13,5 +13,11 @@ FAIL Response with Content-Type "application/wasm;x": compileStreaming assert_un
FAIL Response with Content-Type "application/wasm;x": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
PASS Response with Content-Type "application/wasm": compileStreaming
PASS Response with Content-Type "application/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/wasm": compileStreaming
PASS Response with Content-Type "APPLICATION/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/WASM": compileStreaming
PASS Response with Content-Type "APPLICATION/WASM": instantiateStreaming
Harness: the test ran to completion.
......@@ -13,5 +13,11 @@ FAIL Response with Content-Type "application/wasm;x": compileStreaming assert_un
FAIL Response with Content-Type "application/wasm;x": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Response with Content-Type "application/wasm;charset=UTF-8": instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
PASS Response with Content-Type "application/wasm": compileStreaming
PASS Response with Content-Type "application/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/wasm": compileStreaming
PASS Response with Content-Type "APPLICATION/wasm": instantiateStreaming
PASS Response with Content-Type "APPLICATION/WASM": compileStreaming
PASS Response with Content-Type "APPLICATION/WASM": instantiateStreaming
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL compileStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL compileStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS compileStreaming: empty body
PASS compileStreaming: empty body in a promise
FAIL instantiateStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL instantiateStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS instantiateStreaming: empty body
PASS instantiateStreaming: empty body in a promise
Harness: the test ran to completion.
// META: global=window,worker
const invalidArguments = [
[() => new Response(undefined, { headers: { "Content-Type": "application/wasm" } }), "no body"],
[() => new Response("", { headers: { "Content-Type": "application/wasm" } }), "empty body"],
];
for (const method of ["compileStreaming", "instantiateStreaming"]) {
for (const [argumentFactory, name] of invalidArguments) {
promise_test(t => {
const argument = argumentFactory();
return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly[method](argument));
}, `${method}: ${name}`);
promise_test(t => {
const argument = Promise.resolve(argumentFactory());
return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly[method](argument));
}, `${method}: ${name} in a promise`);
}
}
This is a testharness.js-based test.
FAIL compileStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL compileStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS compileStreaming: empty body
PASS compileStreaming: empty body in a promise
FAIL instantiateStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL instantiateStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS instantiateStreaming: empty body
PASS instantiateStreaming: empty body in a promise
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL compileStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL compileStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS compileStreaming: empty body
PASS compileStreaming: empty body in a promise
FAIL instantiateStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL instantiateStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS instantiateStreaming: empty body
PASS instantiateStreaming: empty body in a promise
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL compileStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL compileStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS compileStreaming: empty body
PASS compileStreaming: empty body in a promise
FAIL instantiateStreaming: no body assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
FAIL instantiateStreaming: no body in a promise assert_throws: function "function() { throw e }" threw object "TypeError: Failed to execute 'compile' on 'WebAssembly': Response object has a null body." ("TypeError") expected object "CompileError" ("CompileError")
PASS instantiateStreaming: empty body
PASS instantiateStreaming: empty body in a promise
Harness: the test ran to completion.
// META: global=window,worker
// META: script=/wasm/jsapi/wasm-constants.js
// META: script=/wasm/jsapi/wasm-module-builder.js
// META: script=/wasm/jsapi/bad-imports.js
test_bad_imports((name, error, build, ...args) => {
promise_test(t => {
const builder = new WasmModuleBuilder();
build(builder);
const buffer = builder.toBuffer();
const response = new Response(buffer, { "headers": { "Content-Type": "application/wasm" } });
return promise_rejects(t, error, WebAssembly.instantiateStreaming(response, ...args));
}, name);
});
// META: global=window,worker
// META: script=/wasm/jsapi/wasm-constants.js
// META: script=/wasm/jsapi/wasm-module-builder.js
// META: script=/wasm/jsapi/assertions.js
// META: script=/wasm/jsapi/instanceTestFactory.js
let emptyModuleBinary;
setup(() => {
emptyModuleBinary = new WasmModuleBuilder().toBuffer();
});
for (const [name, fn] of instanceTestFactory) {
promise_test(async () => {
const { buffer, args, exports, verify } = fn();
const response = new Response(buffer, { "headers": { "Content-Type": "application/wasm" } });
const result = await WebAssembly.instantiateStreaming(response, ...args);
assert_WebAssemblyInstantiatedSource(result, exports);
verify(result.instance);
}, name);
}
// META: global=window,worker
const invalidArguments = [
[undefined],
[null],
[true],
["test"],
[Symbol()],
[0],
[0.1],
[NaN],
[{}, "Empty object"],
[Response, "Response interface object"],
[Response.prototype, "Response interface prototype object"],
];
for (const method of ["compileStreaming", "instantiateStreaming"]) {
for (const [argument, name = format_value(argument)] of invalidArguments) {
promise_test(t => {
return promise_rejects(t, new TypeError(), WebAssembly[method](argument));
}, `${method}: ${name}`);
promise_test(t => {
const promise = Promise.resolve(argument);
return promise_rejects(t, new TypeError(), WebAssembly[method](argument));
}, `${method}: ${name} in a promise`);
}
}
This is a testharness.js-based test.
FAIL Invalid code: compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Invalid code: instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Invalid code: compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Invalid code: instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Invalid code: compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Invalid code: instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
FAIL Invalid code: compileStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
FAIL Invalid code: instantiateStreaming assert_unreached: Should have rejected: undefined Reached unreachable code
Harness: the test ran to completion.
// META: global=window,worker
for (const method of ["compileStreaming", "instantiateStreaming"]) {
promise_test(t => {
const url = "http://{{domains[www]}}:{{ports[http][0]}}/wasm/incrementer.wasm";
const response = fetch(url, { "mode": "no-cors" });
return promise_rejects(t, new TypeError(), WebAssembly[method](response));
}, `Opaque response: ${method}`);
promise_test(t => {
const url = "/fetch/api/resources/redirect.py?redirect_status=301&location=/wasm/incrementer.wasm";
const response = fetch(url, { "mode": "no-cors", "redirect": "manual" });
return promise_rejects(t, new TypeError(), WebAssembly[method](response));
}, `Opaque redirect response: ${method}`);
}
// META: global=window,worker
for (const method of ["compileStreaming", "instantiateStreaming"]) {
promise_test(t => {
const error = { "name": "custom error" };
const promise = Promise.reject(error);
return promise_rejects(t, error, WebAssembly[method](promise));
}, `${method}`);
}
// META: global=window,worker
const statuses = [
0,
300,
400,
404,
500,
600,
700,
999,
];
for (const method of ["compileStreaming", "instantiateStreaming"]) {
for (const status of statuses) {
promise_test(t => {
const response = fetch(`status.py?status=${status}`);
return promise_rejects(t, new TypeError(), WebAssembly[method](response));
}, `Response with status ${status}: ${method}`);
}
}
def main(request, response):
status = int(request.GET["status"])
module = b"\0asm\1\0\0\0"
return status, [("Content-Type", "application/wasm")], module
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