Bug 1631413 [wpt PR 23112] - Wasm: test SharedArrayBuffer-ness in another way, a=testonly
authorAnne van Kesteren <annevk@annevk.nl>
Tue, 28 Apr 2020 11:36:11 +0000
changeset 527558 b7e0c8136e19666494640a8f928e2edbc78f2e29
parent 527557 cdfb07b2861aae38c97d239bbcf268faf2736e7e
child 527559 8f914edd6e94fbeb18c6eb3be893932ad3e21b5f
push id37368
push userbtara@mozilla.com
push dateFri, 01 May 2020 21:45:51 +0000
treeherdermozilla-central@0f9c5a59e45d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1631413, 23112
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1631413 [wpt PR 23112] - Wasm: test SharedArrayBuffer-ness in another way, a=testonly Automatic update from web-platform-tests Wasm: test SharedArrayBuffer-ness in another way (#23112) -- wpt-commits: 6a1b15e5d699a00d58844b53e8c18d368169018d wpt-pr: 23112
testing/web-platform/tests/wasm/jsapi/memory/grow.any.js
--- a/testing/web-platform/tests/wasm/jsapi/memory/grow.any.js
+++ b/testing/web-platform/tests/wasm/jsapi/memory/grow.any.js
@@ -1,15 +1,18 @@
 // META: global=jsshell
 
 function assert_ArrayBuffer(actual, expected, message) {
   // https://github.com/WebAssembly/spec/issues/840
-  const bufferType = expected.shared ? self.SharedArrayBuffer : ArrayBuffer;
-  assert_equals(Object.getPrototypeOf(actual), bufferType.prototype,
-                `${message}: prototype`);
+  // See https://github.com/whatwg/html/issues/5380 for why not `self.SharedArrayBuffer`
+  const isShared = !("isView" in actual.constructor);
+  assert_equals(isShared, expected.shared, `${message}: constructor`);
+  const sharedString = expected.shared ? "Shared" : "";
+  assert_equals(actual.toString(), `[object ${sharedString}ArrayBuffer]`, `${message}: toString()`);
+  assert_equals(Object.getPrototypeOf(actual).toString(), `[object ${sharedString}ArrayBuffer]`, `${message}: prototype toString()`);
   if (expected.detached) {
     // https://github.com/tc39/ecma262/issues/678
     let byteLength;
     try {
       byteLength = actual.byteLength;
     } catch (e) {
       byteLength = 0;
     }