Bug 1342956: Fix promise_test in wasm-testharness.js; r=luke
authorBenjamin Bouvier <benj@benj.me>
Mon, 27 Feb 2017 17:35:18 +0100
changeset 490264 c032cf7f54a06ef03254e450be74b5c54968a27b
parent 490098 fe12200aa33ad5970712ba7cf4c546d12746c9f2
child 490265 5d1ebf7782dfd48afbac00e99f93c1726affec09
child 490308 8e98edd1c6d4a18239d043ec3df15449ab9e622e
push id47045
push useraswan@mozilla.com
push dateMon, 27 Feb 2017 23:59:12 +0000
reviewersluke
bugs1342956
milestone54.0a1
Bug 1342956: Fix promise_test in wasm-testharness.js; r=luke MozReview-Commit-ID: IfPkWSw05pX
js/src/jit-test/lib/wasm-testharness.js
js/src/jit-test/tests/wasm/spec/binary.wast.js
js/src/jit-test/tests/wasm/spec/harness/wasm-constants.js
js/src/jit-test/tests/wasm/spec/jsapi.js
testing/web-platform/mozilla/meta/MANIFEST.json
testing/web-platform/mozilla/tests/wasm/js/binary.wast.js
testing/web-platform/mozilla/tests/wasm/js/harness/wasm-constants.js
testing/web-platform/mozilla/tests/wasm/js/jsapi.js
--- a/js/src/jit-test/lib/wasm-testharness.js
+++ b/js/src/jit-test/lib/wasm-testharness.js
@@ -18,25 +18,29 @@ function test(func, description) {
 ${maybeErr}
 ${maybeErr.stack}`);
     } else {
         print(`${description}: PASS.`);
     }
 }
 
 function promise_test(func, description) {
+    let maybeError = null;
     func()
     .then(_ => {
         print(`${description}: PASS.`);
     })
     .catch(err => {
         print(`${description}: FAIL.
 ${err}`);
+        maybeError = err;
     });
     drainJobQueue();
+    if (maybeError)
+        throw maybeError;
 }
 
 let assert_equals = assertEq;
 let assert_true = (x, errMsg) => { assertEq(x, true); }
 let assert_false = (x, errMsg) => { assertEq(x, false); }
 
 function assert_unreached(description) {
     throw new Error(`unreachable:\n${description}`);
--- a/js/src/jit-test/tests/wasm/spec/binary.wast.js
+++ b/js/src/jit-test/tests/wasm/spec/binary.wast.js
@@ -27,17 +27,17 @@ assert_malformed("\x61\x73\x6d\x00");
 
 // binary.wast:10
 assert_malformed("\x6d\x73\x61\x00");
 
 // binary.wast:11
 assert_malformed("\x6d\x73\x61\x00\x01\x00\x00\x00");
 
 // binary.wast:12
-assert_malformed("\x6d\x73\x61\x00\x00\x00\x00\x0d");
+assert_malformed("\x6d\x73\x61\x00\x00\x00\x00\x01");
 
 // binary.wast:14
 assert_malformed("\x00\x61\x73\x6d");
 
 // binary.wast:15
 assert_malformed("\x00\x61\x73\x6d\x01");
 
 // binary.wast:16
@@ -45,9 +45,9 @@ assert_malformed("\x00\x61\x73\x6d\x01\x
 
 // binary.wast:17
 assert_malformed("\x00\x61\x73\x6d\x0d\x00\x00\x00");
 
 // binary.wast:18
 assert_malformed("\x00\x61\x73\x6d\x0e\x00\x00\x00");
 
 // binary.wast:19
-assert_malformed("\x00\x61\x73\x6d\x00\x00\x00\x0d");
+assert_malformed("\x00\x61\x73\x6d\x00\x00\x00\x01");
--- a/js/src/jit-test/tests/wasm/spec/harness/wasm-constants.js
+++ b/js/src/jit-test/tests/wasm/spec/harness/wasm-constants.js
@@ -16,17 +16,17 @@ function bytes() {
 }
 
 // Header declaration constants
 var kWasmH0 = 0;
 var kWasmH1 = 0x61;
 var kWasmH2 = 0x73;
 var kWasmH3 = 0x6d;
 
-var kWasmV0 = 0x1;
+var kWasmV0 = 1;
 var kWasmV1 = 0;
 var kWasmV2 = 0;
 var kWasmV3 = 0;
 
 var kHeaderSize = 8;
 var kPageSize = 65536;
 
 function bytesWithHeader() {
--- a/js/src/jit-test/tests/wasm/spec/jsapi.js
+++ b/js/src/jit-test/tests/wasm/spec/jsapi.js
@@ -739,23 +739,23 @@ test(() => {
     //assertInstantiateError([new Uint8Array("hi!")], CompileError);
     assertInstantiateError([new ArrayBuffer("hi!")], CompileError);
     assertInstantiateError([importingModule], TypeError);
     assertInstantiateError([importingModule, null], TypeError);
     assertInstantiateError([importingModuleBinary, null], TypeError);
     assertInstantiateError([emptyModule, null], TypeError);
     assertInstantiateError([importingModuleBinary, null], TypeError);
     assertInstantiateError([importingModuleBinary, undefined], TypeError);
-    assertInstantiateError([importingModuleBinary, {}], LinkError);
+    assertInstantiateError([importingModuleBinary, {}], TypeError);
     assertInstantiateError([importingModuleBinary, {"":{g:()=>{}}}], LinkError);
-    assertInstantiateError([importingModuleBinary, {t:{f:()=>{}}}], LinkError);
+    assertInstantiateError([importingModuleBinary, {t:{f:()=>{}}}], TypeError);
     assertInstantiateError([complexImportingModuleBinary, null], TypeError);
     assertInstantiateError([complexImportingModuleBinary, undefined], TypeError);
-    assertInstantiateError([complexImportingModuleBinary, {}], LinkError);
-    assertInstantiateError([complexImportingModuleBinary, {"c": {"d": scratch_memory}}], LinkError);
+    assertInstantiateError([complexImportingModuleBinary, {}], TypeError);
+    assertInstantiateError([complexImportingModuleBinary, {"c": {"d": scratch_memory}}], TypeError);
 
     function assertInstantiateSuccess(module, imports) {
         promise_test(()=> {
             return instantiate(module, imports)
                 .then(result => {
                     if (module instanceof Module) {
                         assert_equals(result instanceof Instance, true);
                     } else {
--- a/testing/web-platform/mozilla/meta/MANIFEST.json
+++ b/testing/web-platform/mozilla/meta/MANIFEST.json
@@ -885,17 +885,17 @@
    "9bd72cc6d4b2c0b7634e30b53e1d76dc4f56a91d",
    "testharness"
   ],
   "wasm/js/address.wast.js": [
    "af0999c8a492985094dbccd091e986ab8f6a295e",
    "support"
   ],
   "wasm/js/binary.wast.js": [
-   "e8b37fad4e8ad066c8a40b635032394711eb1edb",
+   "b8a9c73e523f62a6af2971273cf11c2d11d75787",
    "support"
   ],
   "wasm/js/block.wast.js": [
    "8cefb0160ee7392c635147a5f64585ee4d4e6280",
    "support"
   ],
   "wasm/js/br.wast.js": [
    "89f5db54bbd64b321b7909053e32a7efe3594c54",
@@ -997,17 +997,17 @@
    "86b3c907edd8bb3867c5a5aaaebf6066a215b154",
    "support"
   ],
   "wasm/js/harness/index.js": [
    "654a29a03543230ddd2db8f8a3398f33233cbf69",
    "support"
   ],
   "wasm/js/harness/wasm-constants.js": [
-   "055ddc4d0ddf6a7d0da8967127a58d7080378b74",
+   "6aba4f5fb4127cd56e1381bfb18204edde41abb2",
    "support"
   ],
   "wasm/js/harness/wasm-module-builder.js": [
    "d989de51de5092642de1ea9a1d2d9edc0e605031",
    "support"
   ],
   "wasm/js/harness/wast.js": [
    "fc1d8da9bfdec5681ecd2b6e94590def318b8c76",
@@ -1037,17 +1037,17 @@
    "10e609777838bf8466f1a4ac3167dccbe02aa0fa",
    "support"
   ],
   "wasm/js/int_literals.wast.js": [
    "d93434a6db98561d7e9dcada35de9b890d9fddbd",
    "support"
   ],
   "wasm/js/jsapi.js": [
-   "724096f3561f14c2244f8c31caecbd91d79f223d",
+   "c2ce0201a9607a35a1f535743f9b4e1e8b15a0f7",
    "support"
   ],
   "wasm/js/labels.wast.js": [
    "f495e844ab669663133a22161bef7092000ecbce",
    "support"
   ],
   "wasm/js/left-to-right.wast.js": [
    "03a280b39ef3a65b3ce714c7637c88760055add1",
--- a/testing/web-platform/mozilla/tests/wasm/js/binary.wast.js
+++ b/testing/web-platform/mozilla/tests/wasm/js/binary.wast.js
@@ -27,17 +27,17 @@ assert_malformed("\x61\x73\x6d\x00");
 
 // binary.wast:10
 assert_malformed("\x6d\x73\x61\x00");
 
 // binary.wast:11
 assert_malformed("\x6d\x73\x61\x00\x01\x00\x00\x00");
 
 // binary.wast:12
-assert_malformed("\x6d\x73\x61\x00\x00\x00\x00\x0d");
+assert_malformed("\x6d\x73\x61\x00\x00\x00\x00\x01");
 
 // binary.wast:14
 assert_malformed("\x00\x61\x73\x6d");
 
 // binary.wast:15
 assert_malformed("\x00\x61\x73\x6d\x01");
 
 // binary.wast:16
@@ -45,9 +45,9 @@ assert_malformed("\x00\x61\x73\x6d\x01\x
 
 // binary.wast:17
 assert_malformed("\x00\x61\x73\x6d\x0d\x00\x00\x00");
 
 // binary.wast:18
 assert_malformed("\x00\x61\x73\x6d\x0e\x00\x00\x00");
 
 // binary.wast:19
-assert_malformed("\x00\x61\x73\x6d\x00\x00\x00\x0d");
+assert_malformed("\x00\x61\x73\x6d\x00\x00\x00\x01");
--- a/testing/web-platform/mozilla/tests/wasm/js/harness/wasm-constants.js
+++ b/testing/web-platform/mozilla/tests/wasm/js/harness/wasm-constants.js
@@ -16,17 +16,17 @@ function bytes() {
 }
 
 // Header declaration constants
 var kWasmH0 = 0;
 var kWasmH1 = 0x61;
 var kWasmH2 = 0x73;
 var kWasmH3 = 0x6d;
 
-var kWasmV0 = 0x1;
+var kWasmV0 = 1;
 var kWasmV1 = 0;
 var kWasmV2 = 0;
 var kWasmV3 = 0;
 
 var kHeaderSize = 8;
 var kPageSize = 65536;
 
 function bytesWithHeader() {
--- a/testing/web-platform/mozilla/tests/wasm/js/jsapi.js
+++ b/testing/web-platform/mozilla/tests/wasm/js/jsapi.js
@@ -737,23 +737,23 @@ test(() => {
     assertInstantiateError([new Uint8Array("hi!")], CompileError);
     assertInstantiateError([new ArrayBuffer("hi!")], CompileError);
     assertInstantiateError([importingModule], TypeError);
     assertInstantiateError([importingModule, null], TypeError);
     assertInstantiateError([importingModuleBinary, null], TypeError);
     assertInstantiateError([emptyModule, null], TypeError);
     assertInstantiateError([importingModuleBinary, null], TypeError);
     assertInstantiateError([importingModuleBinary, undefined], TypeError);
-    assertInstantiateError([importingModuleBinary, {}], LinkError);
+    assertInstantiateError([importingModuleBinary, {}], TypeError);
     assertInstantiateError([importingModuleBinary, {"":{g:()=>{}}}], LinkError);
-    assertInstantiateError([importingModuleBinary, {t:{f:()=>{}}}], LinkError);
+    assertInstantiateError([importingModuleBinary, {t:{f:()=>{}}}], TypeError);
     assertInstantiateError([complexImportingModuleBinary, null], TypeError);
     assertInstantiateError([complexImportingModuleBinary, undefined], TypeError);
-    assertInstantiateError([complexImportingModuleBinary, {}], LinkError);
-    assertInstantiateError([complexImportingModuleBinary, {"c": {"d": scratch_memory}}], LinkError);
+    assertInstantiateError([complexImportingModuleBinary, {}], TypeError);
+    assertInstantiateError([complexImportingModuleBinary, {"c": {"d": scratch_memory}}], TypeError);
 
     function assertInstantiateSuccess(module, imports) {
         promise_test(()=> {
             return instantiate(module, imports)
                 .then(result => {
                     if (module instanceof Module) {
                         assert_equals(result instanceof Instance, true);
                     } else {