mirror of
https://github.com/servo/servo.git
synced 2025-08-23 22:35:33 +01:00
Update web-platform-tests to revision 2b7dace05fc1869398ee24f84fda4c0e4c0455ae
This commit is contained in:
parent
b23125d590
commit
6c901de216
844 changed files with 19802 additions and 3093 deletions
|
@ -28,6 +28,7 @@ function assert_Instance(instance, expected_exports) {
|
|||
assert_true(property.enumerable, `${key}: enumerable`);
|
||||
assert_false(property.configurable, `${key}: configurable`);
|
||||
const actual = property.value;
|
||||
assert_true(Object.isExtensible(actual), `${key}: extensible`);
|
||||
|
||||
switch (expected.kind) {
|
||||
case "function":
|
||||
|
@ -75,6 +76,39 @@ test(() => {
|
|||
assert_throws(new TypeError(), () => new WebAssembly.Instance());
|
||||
}, "No arguments");
|
||||
|
||||
test(() => {
|
||||
const invalidArguments = [
|
||||
undefined,
|
||||
null,
|
||||
true,
|
||||
"",
|
||||
Symbol(),
|
||||
1,
|
||||
{},
|
||||
WebAssembly.Module,
|
||||
WebAssembly.Module.prototype,
|
||||
];
|
||||
for (const argument of invalidArguments) {
|
||||
assert_throws(new TypeError(), () => new WebAssembly.Instance(argument),
|
||||
`new Instance(${format_value(argument)})`);
|
||||
}
|
||||
}, "Non-Module arguments");
|
||||
|
||||
test(() => {
|
||||
const module = new WebAssembly.Module(emptyModuleBinary);
|
||||
const invalidArguments = [
|
||||
null,
|
||||
true,
|
||||
"",
|
||||
Symbol(),
|
||||
1,
|
||||
];
|
||||
for (const argument of invalidArguments) {
|
||||
assert_throws(new TypeError(), () => new WebAssembly.Instance(module, argument),
|
||||
`new Instance(module, ${format_value(argument)})`);
|
||||
}
|
||||
}, "Non-object imports");
|
||||
|
||||
test(() => {
|
||||
const module = new WebAssembly.Module(emptyModuleBinary);
|
||||
assert_throws(new TypeError(), () => WebAssembly.Instance(module));
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
// META: global=jsshell
|
||||
// META: script=/wasm/jsapi/wasm-constants.js
|
||||
// META: script=/wasm/jsapi/wasm-module-builder.js
|
||||
|
||||
let emptyModuleBinary;
|
||||
setup(() => {
|
||||
emptyModuleBinary = new WasmModuleBuilder().toBuffer();
|
||||
});
|
||||
|
||||
test(() => {
|
||||
const thisValues = [
|
||||
undefined,
|
||||
null,
|
||||
true,
|
||||
"",
|
||||
Symbol(),
|
||||
1,
|
||||
{},
|
||||
WebAssembly.Instance,
|
||||
WebAssembly.Instance.prototype,
|
||||
];
|
||||
|
||||
const desc = Object.getOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports");
|
||||
assert_equals(typeof desc, "object");
|
||||
|
||||
const getter = desc.get;
|
||||
assert_equals(typeof getter, "function");
|
||||
|
||||
assert_equals(typeof desc.set, "undefined");
|
||||
|
||||
for (const thisValue of thisValues) {
|
||||
assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`);
|
||||
}
|
||||
}, "Branding");
|
||||
|
||||
test(() => {
|
||||
const module = new WebAssembly.Module(emptyModuleBinary);
|
||||
const instance = new WebAssembly.Instance(module);
|
||||
const exports = instance.exports;
|
||||
instance.exports = {};
|
||||
assert_equals(instance.exports, exports, "Should not change the exports");
|
||||
}, "Setting (sloppy mode)");
|
||||
|
||||
test(() => {
|
||||
const module = new WebAssembly.Module(emptyModuleBinary);
|
||||
const instance = new WebAssembly.Instance(module);
|
||||
const exports = instance.exports;
|
||||
assert_throws(new TypeError(), () => {
|
||||
"use strict";
|
||||
instance.exports = {};
|
||||
});
|
||||
assert_equals(instance.exports, exports, "Should not change the exports");
|
||||
}, "Setting (strict mode)");
|
|
@ -0,0 +1,10 @@
|
|||
// META: global=jsshell
|
||||
// META: script=/wasm/jsapi/wasm-constants.js
|
||||
// META: script=/wasm/jsapi/wasm-module-builder.js
|
||||
|
||||
test(() => {
|
||||
const emptyModuleBinary = new WasmModuleBuilder().toBuffer();
|
||||
const module = new WebAssembly.Module(emptyModuleBinary);
|
||||
const instance = new WebAssembly.Instance(module);
|
||||
assert_class_string(instance, "WebAssembly.Instance");
|
||||
}, "Object.prototype.toString on an Instance");
|
Loading…
Add table
Add a link
Reference in a new issue