mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision 386d27678c48bf468b8d374e2ba718e32185a5b7
This commit is contained in:
parent
c24420ddbe
commit
dd79cdc697
32 changed files with 336 additions and 167 deletions
|
@ -64,9 +64,9 @@ promise_test(t => {
|
|||
return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.compile(buffer));
|
||||
}, "Empty buffer");
|
||||
|
||||
test(() => {
|
||||
promise_test(t => {
|
||||
const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0, 0]));
|
||||
assert_throws(new WebAssembly.CompileError(), () => WebAssembly.compile(buffer));
|
||||
return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.compile(buffer));
|
||||
}, "Invalid code");
|
||||
|
||||
promise_test(() => {
|
||||
|
|
|
@ -76,6 +76,64 @@ for (const [name, fn] of instanceTestFactory) {
|
|||
}, `${name}: Module argument`);
|
||||
}
|
||||
|
||||
promise_test(() => {
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addImportedGlobal("module", "global", kWasmI32);
|
||||
const buffer = builder.toBuffer();
|
||||
const order = [];
|
||||
|
||||
const imports = {
|
||||
get module() {
|
||||
order.push("module getter");
|
||||
return {
|
||||
get global() {
|
||||
order.push("global getter");
|
||||
return 0;
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const expected = [
|
||||
"module getter",
|
||||
"global getter",
|
||||
];
|
||||
const p = WebAssembly.instantiate(buffer, imports);
|
||||
assert_array_equals(order, []);
|
||||
return p.then(result => {
|
||||
assert_WebAssemblyInstantiatedSource(result);
|
||||
assert_array_equals(order, expected);
|
||||
});
|
||||
}, "Synchronous options handling: Buffer argument");
|
||||
|
||||
promise_test(() => {
|
||||
const builder = new WasmModuleBuilder();
|
||||
builder.addImportedGlobal("module", "global", kWasmI32);
|
||||
const buffer = builder.toBuffer();
|
||||
const module = new WebAssembly.Module(buffer);
|
||||
const order = [];
|
||||
|
||||
const imports = {
|
||||
get module() {
|
||||
order.push("module getter");
|
||||
return {
|
||||
get global() {
|
||||
order.push("global getter");
|
||||
return 0;
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const expected = [
|
||||
"module getter",
|
||||
"global getter",
|
||||
];
|
||||
const p = WebAssembly.instantiate(module, imports);
|
||||
assert_array_equals(order, expected);
|
||||
return p.then(instance => assert_Instance(instance, {}));
|
||||
}, "Synchronous options handling: Module argument");
|
||||
|
||||
promise_test(t => {
|
||||
const buffer = new Uint8Array();
|
||||
return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.instantiate(buffer));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue