Title: [271774] trunk
Revision
271774
Author
[email protected]
Date
2021-01-22 20:58:43 -0800 (Fri, 22 Jan 2021)

Log Message

Should SharedArrayBuffer/WebAssembly.Memory really throw?
https://bugs.webkit.org/show_bug.cgi?id=220364

Reviewed by Mark Lam.

LayoutTests/imported/w3c:

Update common/sab.js and wasm/.

* web-platform-tests/common/sab.js:
(const.createBuffer):
* web-platform-tests/wasm/jsapi/META.yml: Added.
* web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt:
* web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt:
* web-platform-tests/wasm/jsapi/global/type.tentative.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/type.tentative.any.html: Added.
* web-platform-tests/wasm/jsapi/global/type.tentative.any.js: Added.
(assert_type):
(test):
(string_appeared_here.test):
* web-platform-tests/wasm/jsapi/global/type.tentative.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/global/type.tentative.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/global/w3c-import.log:
* web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt:
* web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt:
* web-platform-tests/wasm/jsapi/instanceTestFactory.js:
(const.imports.string_appeared_here.string_appeared_here):
(return.verify):
* web-platform-tests/wasm/jsapi/memory/type.tentative.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/type.tentative.any.html: Added.
* web-platform-tests/wasm/jsapi/memory/type.tentative.any.js: Added.
(assert_type):
(test):
* web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/memory/w3c-import.log:
* web-platform-tests/wasm/jsapi/module/exports.any-expected.txt:
* web-platform-tests/wasm/jsapi/module/exports.any.js:
(test):
* web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt:
* web-platform-tests/wasm/jsapi/module/imports.any-expected.txt:
* web-platform-tests/wasm/jsapi/module/imports.any.js:
(test):
* web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt:
* web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.html: Added.
* web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.html: Added.
* web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.js: Added.
(test):
* web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker-expected.txt: Added.
* web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker.html: Added.
* web-platform-tests/wasm/jsapi/table/w3c-import.log:
* web-platform-tests/wasm/jsapi/w3c-import.log:
* web-platform-tests/wasm/webapi/META.yml: Added.
* web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt:
* web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt:
* web-platform-tests/wasm/webapi/invalid-code.any-expected.txt:
* web-platform-tests/wasm/webapi/invalid-code.any.js:
(string_appeared_here.Invalid.code):
* web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt:
* web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt: Added.
* web-platform-tests/wasm/webapi/modified-contenttype.any.html: Added.
* web-platform-tests/wasm/webapi/modified-contenttype.any.js: Added.
(string_appeared_here.forEach.method.promise_test.async t):
(string_appeared_here.forEach.method.with.Content.Type.set late):
* web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt: Added.
* web-platform-tests/wasm/webapi/modified-contenttype.any.worker.html: Added.
* web-platform-tests/wasm/webapi/w3c-import.log:

Source/_javascript_Core:

Not accessing "shared" field if Options::useSharedArrayBuffer() is false.

* wasm/js/WebAssemblyMemoryConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-01-23 04:58:43 UTC (rev 271774)
@@ -1,3 +1,77 @@
+2021-01-22  Yusuke Suzuki  <[email protected]>
+
+        Should SharedArrayBuffer/WebAssembly.Memory really throw?
+        https://bugs.webkit.org/show_bug.cgi?id=220364
+
+        Reviewed by Mark Lam.
+
+        Update common/sab.js and wasm/.
+
+        * web-platform-tests/common/sab.js:
+        (const.createBuffer):
+        * web-platform-tests/wasm/jsapi/META.yml: Added.
+        * web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt:
+        * web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt:
+        * web-platform-tests/wasm/jsapi/global/type.tentative.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/type.tentative.any.html: Added.
+        * web-platform-tests/wasm/jsapi/global/type.tentative.any.js: Added.
+        (assert_type):
+        (test):
+        (string_appeared_here.test):
+        * web-platform-tests/wasm/jsapi/global/type.tentative.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/global/type.tentative.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/global/w3c-import.log:
+        * web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt:
+        * web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt:
+        * web-platform-tests/wasm/jsapi/instanceTestFactory.js:
+        (const.imports.string_appeared_here.string_appeared_here):
+        (return.verify):
+        * web-platform-tests/wasm/jsapi/memory/type.tentative.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/type.tentative.any.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/type.tentative.any.js: Added.
+        (assert_type):
+        (test):
+        * web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/memory/w3c-import.log:
+        * web-platform-tests/wasm/jsapi/module/exports.any-expected.txt:
+        * web-platform-tests/wasm/jsapi/module/exports.any.js:
+        (test):
+        * web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt:
+        * web-platform-tests/wasm/jsapi/module/imports.any-expected.txt:
+        * web-platform-tests/wasm/jsapi/module/imports.any.js:
+        (test):
+        * web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt:
+        * web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.html: Added.
+        * web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.js: Added.
+        (test):
+        * web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker.html: Added.
+        * web-platform-tests/wasm/jsapi/table/w3c-import.log:
+        * web-platform-tests/wasm/jsapi/w3c-import.log:
+        * web-platform-tests/wasm/webapi/META.yml: Added.
+        * web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt:
+        * web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt:
+        * web-platform-tests/wasm/webapi/invalid-code.any-expected.txt:
+        * web-platform-tests/wasm/webapi/invalid-code.any.js:
+        (string_appeared_here.Invalid.code):
+        * web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt:
+        * web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt: Added.
+        * web-platform-tests/wasm/webapi/modified-contenttype.any.html: Added.
+        * web-platform-tests/wasm/webapi/modified-contenttype.any.js: Added.
+        (string_appeared_here.forEach.method.promise_test.async t):
+        (string_appeared_here.forEach.method.with.Content.Type.set late):
+        * web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt: Added.
+        * web-platform-tests/wasm/webapi/modified-contenttype.any.worker.html: Added.
+        * web-platform-tests/wasm/webapi/w3c-import.log:
+
 2021-01-22  Devin Rousso  <[email protected]>
 
         [WPT] [Payment Request] slight adjustment to payment-request/payment-request-constructor-thcrash.https.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/common/sab.js (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/common/sab.js	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/common/sab.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -5,6 +5,9 @@
     if (type === "ArrayBuffer") {
       return new ArrayBuffer(length);
     } else if (type === "SharedArrayBuffer") {
+      if (sabConstructor.name !== "SharedArrayBuffer") {
+        throw new Error("WebAssembly.Memory does not support shared:true");
+      }
       return new sabConstructor(length);
     } else {
       throw new Error("type has to be ArrayBuffer or SharedArrayBuffer");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/META.yml (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/META.yml	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/META.yml	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+spec: https://webassembly.github.io/spec/js-api/

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -13,6 +13,16 @@
 FAIL getter order for imports object: Module argument assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
 PASS imports: BufferSource argument
 PASS imports: Module argument
+PASS imports with empty module names: BufferSource argument
+PASS imports with empty module names: Module argument
+PASS imports with empty names: BufferSource argument
+PASS imports with empty names: Module argument
+PASS exports with empty name: function: BufferSource argument
+PASS exports with empty name: function: Module argument
+PASS exports with empty name: table: BufferSource argument
+PASS exports with empty name: table: Module argument
+PASS exports with empty name: global: BufferSource argument
+PASS exports with empty name: global: Module argument
 PASS No imports: BufferSource argument
 PASS No imports: Module argument
 PASS exports and imports: BufferSource argument

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/constructor/instantiate.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -13,6 +13,16 @@
 FAIL getter order for imports object: Module argument assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
 PASS imports: BufferSource argument
 PASS imports: Module argument
+PASS imports with empty module names: BufferSource argument
+PASS imports with empty module names: Module argument
+PASS imports with empty names: BufferSource argument
+PASS imports with empty names: Module argument
+PASS exports with empty name: function: BufferSource argument
+PASS exports with empty name: function: Module argument
+PASS exports with empty name: table: BufferSource argument
+PASS exports with empty name: table: Module argument
+PASS exports with empty name: global: BufferSource argument
+PASS exports with empty name: global: Module argument
 PASS No imports: BufferSource argument
 PASS No imports: Module argument
 PASS exports and imports: BufferSource argument

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,15 @@
+
+FAIL i32, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL i32, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL i64, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL i64, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f32, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f32, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f64, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f64, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL anyref, mutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL anyref, immutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL funcref, mutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL funcref, immutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL key ordering undefined is not an object (evaluating 'Object.getOwnPropertyNames(myglobal.type)')
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.js (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,64 @@
+// META: global=window,dedicatedworker,jsshell
+// META: script=/wasm/jsapi/assertions.js
+
+function assert_type(argument) {
+    const myglobal = new WebAssembly.Global(argument);
+
+    assert_equals(myglobal.type.value, argument.value);
+    assert_equals(myglobal.type.mutable, argument.mutable);
+}
+
+test(() => {
+    assert_type({ "value": "i32", "mutable": true});
+}, "i32, mutable");
+
+test(() => {
+    assert_type({ "value": "i32", "mutable": false});
+}, "i32, immutable");
+
+test(() => {
+    assert_type({ "value": "i64", "mutable": true});
+}, "i64, mutable");
+
+test(() => {
+    assert_type({ "value": "i64", "mutable": false});
+}, "i64, immutable");
+
+test(() => {
+    assert_type({ "value": "f32", "mutable": true});
+}, "f32, mutable");
+
+test(() => {
+    assert_type({ "value": "f32", "mutable": false});
+}, "f32, immutable");
+
+test(() => {
+    assert_type({ "value": "f64", "mutable": true});
+}, "f64, mutable");
+
+test(() => {
+    assert_type({ "value": "f64", "mutable": false});
+}, "f64, immutable");
+
+test(() => {
+    assert_type({"value": "externref", "mutable": true})
+}, "anyref, mutable")
+
+test(() => {
+    assert_type({"value": "externref", "mutable": false})
+}, "anyref, immutable")
+
+test(() => {
+    assert_type({"value": "funcref", "mutable": true})
+}, "funcref, mutable")
+
+test(() => {
+    assert_type({"value": "funcref", "mutable": false})
+}, "funcref, immutable")
+
+test(() => {
+    const myglobal = new WebAssembly.Global({"value": "i32", "mutable": true});
+    const propertyNames = Object.getOwnPropertyNames(myglobal.type);
+    assert_equals(propertyNames[0], "mutable");
+    assert_equals(propertyNames[1], "value");
+}, "key ordering");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.worker-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,15 @@
+
+FAIL i32, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL i32, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL i64, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL i64, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f32, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f32, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f64, mutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL f64, immutable undefined is not an object (evaluating 'myglobal.type.value')
+FAIL anyref, mutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL anyref, immutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL funcref, mutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL funcref, immutable WebAssembly.Global expects its 'value' field to be the string 'i32', 'i64', 'f32', or 'f64'
+FAIL key ordering undefined is not an object (evaluating 'Object.getOwnPropertyNames(myglobal.type)')
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.worker.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.worker.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/w3c-import.log	2021-01-23 04:58:43 UTC (rev 271774)
@@ -16,5 +16,6 @@
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/constructor.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/toString.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/type.tentative.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/value-get-set.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/global/valueOf.any.js

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -9,6 +9,11 @@
 PASS Empty module with empty imports argument
 FAIL getter order for imports object assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
 PASS imports
+PASS imports with empty module names
+PASS imports with empty names
+PASS exports with empty name: function
+PASS exports with empty name: table
+PASS exports with empty name: global
 PASS No imports
 PASS exports and imports
 PASS i64 exports and imports

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instance/constructor.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -9,6 +9,11 @@
 PASS Empty module with empty imports argument
 FAIL getter order for imports object assert_array_equals: expected property 1 to be "global1 getter" but got "memory getter" (expected array ["module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "memory getter", "module getter", "global2 getter"] got ["module getter", "memory getter", "module getter", "global1 getter", "module2 getter", "global3 getter", "module getter", "global2 getter"])
 PASS imports
+PASS imports with empty module names
+PASS imports with empty names
+PASS exports with empty name: function
+PASS exports with empty name: table
+PASS exports with empty name: global
 PASS No imports
 PASS exports and imports
 PASS i64 exports and imports

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instanceTestFactory.js (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instanceTestFactory.js	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/instanceTestFactory.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -127,6 +127,134 @@
   ],
 
   [
+    "imports with empty module names",
+    function() {
+      const builder = new WasmModuleBuilder();
+
+      builder.addImport("", "fn", kSig_v_v);
+      builder.addImportedGlobal("", "global", kWasmI32);
+      builder.addImportedMemory("", "memory", 0, 128);
+      builder.addImportedTable("", "table", 0, 128);
+
+      const buffer = builder.toBuffer();
+      const imports = {
+        "": {
+          "fn": function() {},
+          "global": 0,
+          "memory": new WebAssembly.Memory({ "initial": 64, maximum: 128 }),
+          "table": new WebAssembly.Table({ "element": "anyfunc", "initial": 64, maximum: 128 }),
+        },
+      };
+
+      return {
+        buffer,
+        args: [imports],
+        exports: {},
+        verify: () => {},
+      };
+    }
+  ],
+
+  [
+    "imports with empty names",
+    function() {
+      const builder = new WasmModuleBuilder();
+
+      builder.addImport("a", "", kSig_v_v);
+      builder.addImportedGlobal("b", "", kWasmI32);
+      builder.addImportedMemory("c", "", 0, 128);
+      builder.addImportedTable("d", "", 0, 128);
+
+      const buffer = builder.toBuffer();
+      const imports = {
+        "a": { "": function() {} },
+        "b": { "": 0 },
+        "c": { "": new WebAssembly.Memory({ "initial": 64, maximum: 128 }) },
+        "d": { "": new WebAssembly.Table({ "element": "anyfunc", "initial": 64, maximum: 128 }) },
+      };
+
+      return {
+        buffer,
+        args: [imports],
+        exports: {},
+        verify: () => {},
+      };
+    }
+  ],
+
+  [
+    "exports with empty name: function",
+    function() {
+      const builder = new WasmModuleBuilder();
+
+      builder
+        .addFunction("", kSig_v_d)
+        .addBody([])
+        .exportFunc();
+
+      const buffer = builder.toBuffer();
+
+      const exports = {
+        "": { "kind": "function", "name": "0", "length": 1 },
+      };
+
+      return {
+        buffer,
+        args: [],
+        exports,
+        verify: () => {},
+      };
+    }
+  ],
+
+  [
+    "exports with empty name: table",
+    function() {
+      const builder = new WasmModuleBuilder();
+
+      builder.setTableBounds(1);
+      builder.addExportOfKind("", kExternalTable, 0);
+
+      const buffer = builder.toBuffer();
+
+      const exports = {
+        "": { "kind": "table", "length": 1 },
+      };
+
+      return {
+        buffer,
+        args: [],
+        exports,
+        verify: () => {},
+      };
+    }
+  ],
+
+  [
+    "exports with empty name: global",
+    function() {
+      const builder = new WasmModuleBuilder();
+
+      builder.addGlobal(kWasmI32, true)
+        .exportAs("")
+        .init = 7;
+
+      const buffer = builder.toBuffer();
+
+      const exports = {
+        "": { "kind": "global", "value": 7 },
+      };
+
+      return {
+        buffer,
+        args: [],
+        exports,
+        verify: () => {},
+      };
+    }
+  ],
+
+  [
     "No imports",
     function() {
       const builder = new WasmModuleBuilder();

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,8 @@
+
+FAIL Zero initial, no maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL Non-zero initial, no maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL Zero maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL None-zero maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL non-shared memory undefined is not an object (evaluating 'memory.type.minimum')
+FAIL shared memory undefined is not an object (evaluating 'memory.type.minimum')
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.js (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,36 @@
+// META: global=window,dedicatedworker,jsshell
+// META: script=/wasm/jsapi/assertions.js
+
+function assert_type(argument) {
+    const memory = new WebAssembly.Memory(argument);
+
+    assert_equals(memory.type.minimum, argument.minimum);
+    assert_equals(memory.type.maximum, argument.maximum);
+    if (argument.shared !== undefined) {
+        assert_equals(memory.type.shared, argument.shared);
+    }
+}
+
+test(() => {
+    assert_type({ "minimum": 0 });
+}, "Zero initial, no maximum");
+
+test(() => {
+    assert_type({ "minimum": 5 });
+}, "Non-zero initial, no maximum");
+
+test(() => {
+    assert_type({ "minimum": 0, "maximum": 0 });
+}, "Zero maximum");
+
+test(() => {
+    assert_type({ "minimum": 0, "maximum": 5 });
+}, "None-zero maximum");
+
+test(() => {
+    assert_type({ "minimum": 0, "maximum": 10,  "shared": false});
+}, "non-shared memory");
+
+test(() => {
+    assert_type({ "minimum": 0, "maximum": 10, "shared": true});
+}, "shared memory");
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,8 @@
+
+FAIL Zero initial, no maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL Non-zero initial, no maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL Zero maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL None-zero maximum undefined is not an object (evaluating 'memory.type.minimum')
+FAIL non-shared memory undefined is not an object (evaluating 'memory.type.minimum')
+FAIL shared memory undefined is not an object (evaluating 'memory.type.minimum')
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.worker.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/w3c-import.log	2021-01-23 04:58:43 UTC (rev 271774)
@@ -21,3 +21,4 @@
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/constructor.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/grow.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/toString.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/memory/type.tentative.any.js

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -2,8 +2,12 @@
 PASS Missing arguments
 PASS Non-Module arguments
 PASS Branding
+PASS Return type
 PASS Empty module
 PASS Empty module: array caching
 PASS exports
+PASS exports with empty name: function
+PASS exports with empty name: table
+PASS exports with empty name: global
 PASS Stray argument
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -78,6 +78,12 @@
 test(() => {
   const module = new WebAssembly.Module(emptyModuleBinary);
   const exports = WebAssembly.Module.exports(module);
+  assert_true(Array.isArray(exports));
+}, "Return type");
+
+test(() => {
+  const module = new WebAssembly.Module(emptyModuleBinary);
+  const exports = WebAssembly.Module.exports(module);
   assert_exports(exports, []);
 }, "Empty module");
 
@@ -125,6 +131,54 @@
 }, "exports");
 
 test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder
+    .addFunction("", kSig_v_v)
+    .addBody([])
+    .exportFunc();
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const exports = WebAssembly.Module.exports(module);
+  const expected = [
+    { "kind": "function", "name": "" },
+  ];
+  assert_exports(exports, expected);
+}, "exports with empty name: function");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.setTableBounds(1);
+  builder.addExportOfKind("", kExternalTable, 0);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const exports = WebAssembly.Module.exports(module);
+  const expected = [
+    { "kind": "table", "name": "" },
+  ];
+  assert_exports(exports, expected);
+}, "exports with empty name: table");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.addGlobal(kWasmI32, true)
+    .exportAs("")
+    .init = 7;
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const exports = WebAssembly.Module.exports(module);
+  const expected = [
+    { "kind": "global", "name": "" },
+  ];
+  assert_exports(exports, expected);
+}, "exports with empty name: global");
+
+test(() => {
   const module = new WebAssembly.Module(emptyModuleBinary);
   const exports = WebAssembly.Module.exports(module, {});
   assert_exports(exports, []);

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/exports.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -2,8 +2,12 @@
 PASS Missing arguments
 PASS Non-Module arguments
 PASS Branding
+PASS Return type
 PASS Empty module
 PASS Empty module: array caching
 PASS exports
+PASS exports with empty name: function
+PASS exports with empty name: table
+PASS exports with empty name: global
 PASS Stray argument
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -6,5 +6,8 @@
 PASS Empty module
 PASS Empty module: array caching
 PASS imports
+PASS imports with empty module name
+PASS imports with empty names
+PASS imports with empty module names and names
 PASS Stray argument
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -119,6 +119,66 @@
 }, "imports");
 
 test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.addImport("", "fn", kSig_v_v);
+  builder.addImportedGlobal("", "global", kWasmI32);
+  builder.addImportedMemory("", "memory", 0, 128);
+  builder.addImportedTable("", "table", 0, 128);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const imports = WebAssembly.Module.imports(module);
+  const expected = [
+    { "module": "", "kind": "function", "name": "fn" },
+    { "module": "", "kind": "global", "name": "global" },
+    { "module": "", "kind": "memory", "name": "memory" },
+    { "module": "", "kind": "table", "name": "table" },
+  ];
+  assert_imports(imports, expected);
+}, "imports with empty module name");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.addImport("a", "", kSig_v_v);
+  builder.addImportedGlobal("b", "", kWasmI32);
+  builder.addImportedMemory("c", "", 0, 128);
+  builder.addImportedTable("d", "", 0, 128);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const imports = WebAssembly.Module.imports(module);
+  const expected = [
+    { "module": "a", "kind": "function", "name": "" },
+    { "module": "b", "kind": "global", "name": "" },
+    { "module": "c", "kind": "memory", "name": "" },
+    { "module": "d", "kind": "table", "name": "" },
+  ];
+  assert_imports(imports, expected);
+}, "imports with empty names");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+
+  builder.addImport("", "", kSig_v_v);
+  builder.addImportedGlobal("", "", kWasmI32);
+  builder.addImportedMemory("", "", 0, 128);
+  builder.addImportedTable("", "", 0, 128);
+
+  const buffer = builder.toBuffer()
+  const module = new WebAssembly.Module(buffer);
+  const imports = WebAssembly.Module.imports(module);
+  const expected = [
+    { "module": "", "kind": "function", "name": "" },
+    { "module": "", "kind": "global", "name": "" },
+    { "module": "", "kind": "memory", "name": "" },
+    { "module": "", "kind": "table", "name": "" },
+  ];
+  assert_imports(imports, expected);
+}, "imports with empty module names and names");
+
+test(() => {
   const module = new WebAssembly.Module(emptyModuleBinary);
   const imports = WebAssembly.Module.imports(module, {});
   assert_imports(imports, []);

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/module/imports.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -6,5 +6,8 @@
 PASS Empty module
 PASS Empty module: array caching
 PASS imports
+PASS imports with empty module name
+PASS imports with empty names
+PASS imports with empty module names and names
 PASS Stray argument
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,8 @@
+
+FAIL initialize externref table with default value assert_equals: expected object "[object Object]" but got null
+PASS initialize table with a wrong element value
+FAIL initialize anyfunc table with default value assert_equals: expected (function) function "function 0() {
+    [native code]
+}" but got (object) null
+FAIL initialize anyfunc table with a bad default value assert_throws_js: function "() => new WebAssembly.Table(argument, {})" did not throw
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.js (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,49 @@
+// META: global=window,dedicatedworker,jsshell
+// META: script=assertions.js
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+// Test cases for changes to the WebAssembly.Table constructor API that
+// come in with the reftypes proposal: the API takes a default argument, which
+// is used as an initializing value for the WebAssembly.Table.
+//
+// See:
+//   https://webassembly.github.io/reference-types/js-api/index.html#tables
+
+test(() => {
+  const testObject = {};
+  const argument = { "element": "externref", "initial": 3 };
+  const table = new WebAssembly.Table(argument, testObject);
+  assert_equals(table.length, 3);
+  assert_equals(table.get(0), testObject);
+  assert_equals(table.get(1), testObject);
+  assert_equals(table.get(2), testObject);
+}, "initialize externref table with default value");
+
+test(() => {
+  const argument = { "element": "i32", "initial": 3 };
+  assert_throws_js(TypeError, () => new WebAssembly.Table(argument));
+}, "initialize table with a wrong element value");
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+  builder
+    .addFunction("fn", kSig_v_v)
+    .addBody([])
+    .exportFunc();
+  const bin = builder.toBuffer();
+  const fn = new WebAssembly.Instance(new WebAssembly.Module(bin)).exports.fn;
+  const argument = { "element": "anyfunc", "initial": 3 };
+  const table = new WebAssembly.Table(argument, fn);
+  assert_equals(table.length, 3);
+  assert_equals(table.get(0), fn);
+  assert_equals(table.get(1), fn);
+  assert_equals(table.get(2), fn);
+}, "initialize anyfunc table with default value");
+
+test(() => {
+  const argument = { "element": "anyfunc", "initial": 3 };
+  assert_throws_js(TypeError, () => new WebAssembly.Table(argument, {}));
+  assert_throws_js(TypeError, () => new WebAssembly.Table(argument, "cannot be used as a wasm function"));
+  assert_throws_js(TypeError, () => new WebAssembly.Table(argument, 37));
+}, "initialize anyfunc table with a bad default value");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: NetworkError: Response is not 2xx
+
+Harness Error (FAIL), message = NetworkError: Response is not 2xx
+
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.worker.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,6 @@
+
+FAIL Arguments for anyfunc table set assert_equals: expected (function) function "function 0() {
+    [native code]
+}" but got (object) null
+FAIL Arguments for externref table set assert_equals: expected object "[object Object]" but got null
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.js (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,50 @@
+// META: global=window,dedicatedworker,jsshell
+// META: script=assertions.js
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+// Test cases for changes to the WebAssembly.Table.prototype.set() API that
+// come in with the reftypes proposal: the API makes the second argument optional and
+// if it is missing we should use DefaultValue of the table's element type.
+//
+// See:
+//   https://webassembly.github.io/reference-types/js-api/index.html#tables
+
+test(() => {
+  const builder = new WasmModuleBuilder();
+  builder
+    .addFunction("fn", kSig_v_v)
+    .addBody([])
+    .exportFunc();
+  const bin = builder.toBuffer();
+  const fn = new WebAssembly.Instance(new WebAssembly.Module(bin)).exports.fn;
+
+  const argument = { "element": "anyfunc", "initial": 1 };
+  const table = new WebAssembly.Table(argument, fn);
+
+  assert_equals(table.get(0), fn);
+  table.set(0);
+  assert_equals(table.get(0), null);
+
+  table.set(0, fn);
+  assert_equals(table.get(0), fn);
+
+  assert_throws_js(TypeError, () => table.set(0, {}));
+  assert_throws_js(TypeError, () => table.set(0, 37));
+}, "Arguments for anyfunc table set");
+
+test(() => {
+  const testObject = {};
+  const argument = { "element": "externref", "initial": 1 };
+  const table = new WebAssembly.Table(argument, testObject);
+
+  assert_equals(table.get(0), testObject);
+  table.set(0);
+  assert_equals(table.get(0), undefined);
+
+  table.set(0, testObject);
+  assert_equals(table.get(0), testObject);
+
+  table.set(0, 37);
+  assert_equals(table.get(0), 37);
+}, "Arguments for externref table set");

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,5 @@
+CONSOLE MESSAGE: NetworkError: Response is not 2xx
+
+Harness Error (FAIL), message = NetworkError: Response is not 2xx
+
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.worker.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/w3c-import.log	2021-01-23 04:58:43 UTC (rev 271774)
@@ -15,6 +15,7 @@
 ------------------------------------------------------------------------
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/assertions.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-reftypes.tentative.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor-types.tentative.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/constructor.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/get-set.any.js
@@ -21,4 +22,5 @@
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow-reftypes.tentative.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/grow.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/length.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/set-reftypes.tentative.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/table/toString.any.js

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/w3c-import.log	2021-01-23 04:58:43 UTC (rev 271774)
@@ -14,6 +14,7 @@
 None
 ------------------------------------------------------------------------
 List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/META.yml
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/assertions.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/bad-imports.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/jsapi/error-interfaces-no-symbol-tostringtag.js

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/META.yml (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/META.yml	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/META.yml	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+spec: https://webassembly.github.io/spec/web-api/

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -4,6 +4,11 @@
 FAIL Empty module with empty imports argument promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL getter order for imports object promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL imports with empty module names promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL imports with empty names promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL exports with empty name: function promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL exports with empty name: table promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL exports with empty name: global promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL No imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL exports and imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL i64 exports and imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -4,6 +4,11 @@
 FAIL Empty module with empty imports argument promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL getter order for imports object promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL imports with empty module names promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL imports with empty names promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL exports with empty name: function promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL exports with empty name: table promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
+FAIL exports with empty name: global promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL No imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL exports and imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"
 FAIL i64 exports and imports promise_test: Unhandled rejection with value: object "TypeError: WebAssembly.instantiateStreaming is not a function. (In 'WebAssembly.instantiateStreaming(response, ...args)', 'WebAssembly.instantiateStreaming' is undefined)"

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -1,4 +1,6 @@
 
-FAIL Invalid code: compileStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
-FAIL Invalid code: instantiateStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0x0000): compileStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0xCAFE): compileStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0x0000): instantiateStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0xCAFE): instantiateStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.js (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.js	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -8,8 +8,14 @@
 
 for (const method of ["compileStreaming", "instantiateStreaming"]) {
   promise_test(t => {
+    const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0, 0]));
+    const response = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
+    return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](response));
+  }, `Invalid code (0x0000): ${method}`);
+
+  promise_test(t => {
     const buffer = new Uint8Array(Array.from(emptyModuleBinary).concat([0xCA, 0xFE]));
     const response = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
     return promise_rejects_js(t, WebAssembly.CompileError, WebAssembly[method](response));
-  }, `Invalid code: ${method}`);
+  }, `Invalid code (0xCAFE): ${method}`);
 }

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -1,4 +1,6 @@
 
-FAIL Invalid code: compileStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
-FAIL Invalid code: instantiateStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0x0000): compileStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0xCAFE): compileStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0x0000): instantiateStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
+FAIL Invalid code (0xCAFE): instantiateStreaming WebAssembly[method] is not a function. (In 'WebAssembly[method](response)', 'WebAssembly[method]' is undefined)
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,6 @@
+
+FAIL compileStreaming with Content-Type set late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+FAIL compileStreaming with Content-Type removed late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+FAIL instantiateStreaming with Content-Type set late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+FAIL instantiateStreaming with Content-Type removed late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.js (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.js	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.js	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,24 @@
+// META: global=window,worker
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+["compileStreaming", "instantiateStreaming"].forEach(method => {
+  promise_test(async t => {
+    const buffer = new WasmModuleBuilder().toBuffer();
+    const argument = new Response(buffer, { headers: { "Content-Type": "test/test" } });
+    argument.headers.set("Content-Type", "application/wasm");
+    // This should resolve successfully
+    await WebAssembly[method](argument);
+    // Ensure body can only be read once
+    return promise_rejects_js(t, TypeError, argument.blob());
+  }, `${method} with Content-Type set late`);
+
+  promise_test(async t => {
+    const buffer = new WasmModuleBuilder().toBuffer();
+    const argument = new Response(buffer, { headers: { "Content-Type": "application/wasm" } });
+    argument.headers.delete("Content-Type");
+    // Ensure Wasm cannot be created
+    await promise_rejects_js(t, TypeError, WebAssembly[method](argument));
+    // This should resolve successfully
+    await argument.arrayBuffer();
+  }, `${method} with Content-Type removed late`);
+});

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.worker-expected.txt	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1,6 @@
+
+FAIL compileStreaming with Content-Type set late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+FAIL compileStreaming with Content-Type removed late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+FAIL instantiateStreaming with Content-Type set late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+FAIL instantiateStreaming with Content-Type removed late promise_test: Unhandled rejection with value: object "TypeError: WebAssembly[method] is not a function. (In 'WebAssembly[method](argument)', 'WebAssembly[method]' is undefined)"
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.worker.html (0 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.worker.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.worker.html	2021-01-23 04:58:43 UTC (rev 271774)
@@ -0,0 +1 @@
+<!-- This file is required for WebKit test infrastructure to run the templated test -->
\ No newline at end of file

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/w3c-import.log (271773 => 271774)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/w3c-import.log	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/w3c-import.log	2021-01-23 04:58:43 UTC (rev 271774)
@@ -14,6 +14,7 @@
 None
 ------------------------------------------------------------------------
 List of files:
+/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/META.yml
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/abort.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/body.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/contenttype.any.js
@@ -24,6 +25,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/instantiateStreaming.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-args.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/invalid-code.any.js
+/LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/modified-contenttype.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/origin.sub.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/rejected-arg.any.js
 /LayoutTests/imported/w3c/web-platform-tests/wasm/webapi/status.any.js

Modified: trunk/Source/_javascript_Core/ChangeLog (271773 => 271774)


--- trunk/Source/_javascript_Core/ChangeLog	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-01-23 04:58:43 UTC (rev 271774)
@@ -1,3 +1,15 @@
+2021-01-22  Yusuke Suzuki  <[email protected]>
+
+        Should SharedArrayBuffer/WebAssembly.Memory really throw?
+        https://bugs.webkit.org/show_bug.cgi?id=220364
+
+        Reviewed by Mark Lam.
+
+        Not accessing "shared" field if Options::useSharedArrayBuffer() is false.
+
+        * wasm/js/WebAssemblyMemoryConstructor.cpp:
+        (JSC::JSC_DEFINE_HOST_FUNCTION):
+
 2021-01-22  Keith Miller  <[email protected]>
 
         Obj-C API should do correct type checks when using a 32-bit address space

Modified: trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp (271773 => 271774)


--- trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp	2021-01-23 03:55:16 UTC (rev 271773)
+++ trunk/Source/_javascript_Core/wasm/js/WebAssemblyMemoryConstructor.cpp	2021-01-23 04:58:43 UTC (rev 271774)
@@ -117,16 +117,16 @@
     }
 
     Wasm::MemorySharingMode sharingMode = Wasm::MemorySharingMode::Default;
-    JSValue sharedValue = memoryDescriptor->get(globalObject, Identifier::fromString(vm, "shared"));
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    bool shared = sharedValue.toBoolean(globalObject);
-    RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
-    if (shared) {
-        if (!maximumPageCount)
-            return throwVMTypeError(globalObject, throwScope, "'maximum' page count must be defined if 'shared' is true"_s);
-        if (!Options::useSharedArrayBuffer())
-            return throwVMTypeError(globalObject, throwScope, "Shared WebAssembly.Memory and SharedArrayBuffer are not enabled"_s);
-        sharingMode = Wasm::MemorySharingMode::Shared;
+    if (Options::useSharedArrayBuffer()) {
+        JSValue sharedValue = memoryDescriptor->get(globalObject, Identifier::fromString(vm, "shared"));
+        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+        bool shared = sharedValue.toBoolean(globalObject);
+        RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+        if (shared) {
+            if (!maximumPageCount)
+                return throwVMTypeError(globalObject, throwScope, "'maximum' page count must be defined if 'shared' is true"_s);
+            sharingMode = Wasm::MemorySharingMode::Shared;
+        }
     }
 
     auto* jsMemory = JSWebAssemblyMemory::tryCreate(globalObject, vm, webAssemblyMemoryStructure);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to