Bug 1493560 - Change test to allow another possibility. r=arai
authorJason Orendorff <jorendorff@mozilla.com>
Mon, 22 Oct 2018 15:03:20 +0000
changeset 490697 23f77dfb5679f3cd4e34250c9511c8a49041a956
parent 490696 4bdddb2c5100121222fef51a89da476fed899b42
child 490698 6c8bbe5f25a750a29707105cc1d57871af9e1fae
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersarai
bugs1493560
milestone64.0a1
Bug 1493560 - Change test to allow another possibility. r=arai This also changes the test to print something informative on failure. Differential Revision: https://phabricator.services.mozilla.com/D9046
js/src/jit-test/tests/ion/bug913749.js
--- a/js/src/jit-test/tests/ion/bug913749.js
+++ b/js/src/jit-test/tests/ion/bug913749.js
@@ -5,17 +5,28 @@ Object.defineProperty(x, 18, {
     get: (function() {
         y.length;
     }),
 });
 this.toSource();
 
 y = undefined;
 
+// The exact error message varies nondeterministically. Accept several
+// variations on the theme.
+var variations = [
+    `y is undefined; can't access its "length" property`,
+    `can't access property "length" of undefined` ,
+    `undefined has no properties`,
+];
+
+var hits = 0;
 for (var i = 0; i < 3; i++) {
     try {
-	x.toString();
-	assertEq(0, 1);
+        x.toString();
     } catch (e) {
-	assertEq(e.message === `y is undefined; can't access its "length" property` ||
-		 e.message === `can't access property "length" of undefined`, true);
+        assertEq(e.constructor.name, 'TypeError');
+        if (!variations.includes(e.message))
+            throw new Error(`expected one of ${uneval(variations)}; got ${uneval(e.message)}`);
+        hits++;
     }
 }
+assertEq(hits, 3);