Bug 1131988 - Fix function/constructor call error tests to work in Ion execution. r=jandem
authorTooru Fujisawa <arai_a@mac.com>
Sat, 14 Feb 2015 14:33:43 +0900
changeset 256342 f395713a11780d576422c70da51938603d24a164
parent 256341 edd04b167f471ad8c3374bbed2d1ed1d45404088
child 256343 2c72917f420bdd6ec68db2048c1f3db7ce7ef4fe
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1131988
milestone38.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 1131988 - Fix function/constructor call error tests to work in Ion execution. r=jandem
js/src/tests/ecma_5/Function/builtin-no-construct.js
js/src/tests/ecma_5/misc/new-with-non-constructor.js
--- a/js/src/tests/ecma_5/Function/builtin-no-construct.js
+++ b/js/src/tests/ecma_5/Function/builtin-no-construct.js
@@ -3,17 +3,17 @@
  * http://creativecommons.org/licenses/publicdomain/
  */
 
 function checkMethod(method) {
     try {
         new method();
         assertEq(0, 1, "not reached " + method);
     } catch (e) {
-        assertEq(e.message, "method is not a constructor");
+        assertEq(e.message.indexOf(" is not a constructor") === -1, false);
     }
 }
 
 function checkMethods(proto) {
     var names = Object.getOwnPropertyNames(proto);
     for (var i = 0; i < names.length; i++) {
         var name = names[i];
         if (["constructor", "arguments", "caller"].indexOf(name) >= 0)
--- a/js/src/tests/ecma_5/misc/new-with-non-constructor.js
+++ b/js/src/tests/ecma_5/misc/new-with-non-constructor.js
@@ -1,39 +1,44 @@
 /*
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/licenses/publicdomain/
  */
 
-function checkConstruct(thing, buggy) {
+function checkConstruct(thing) {
     try {
         new thing();
         assertEq(0, 1, "not reached " + thing);
     } catch (e) {
-        if (buggy)
-            assertEq(String(e.message).indexOf("is not a constructor") === -1, false);
-        else
-            assertEq(String(e.message).indexOf("thing is not a constructor") === -1, false);
+        assertEq(String(e.message).indexOf(" is not a constructor") === -1, false);
     }
 }
 
 var re = /aaa/
-checkConstruct(re, false);
+checkConstruct(re);
 
 var boundFunctionPrototype = Function.prototype.bind();
-checkConstruct(boundFunctionPrototype, true);
+checkConstruct(boundFunctionPrototype);
 
 var boundBuiltin = Math.sin.bind();
-checkConstruct(boundBuiltin, true);
+checkConstruct(boundBuiltin);
 
 /* We set the proxies construct trap to undefined,
  * so the call trap is used as constructor.
  */
 
-var proxiedFunctionPrototype = Proxy.create({}, Function.prototype, undefined);
-checkConstruct(proxiedFunctionPrototype, false);
+var handler = {
+    getPropertyDescriptor(name) {
+        /* toSource may be called to generate error message. */
+        assertEq(name, "toSource");
+        return { value: () => "foo" };
+    }
+};
 
-var proxiedBuiltin = Proxy.create({}, parseInt, undefined);
-checkConstruct(proxiedBuiltin, false);
+var proxiedFunctionPrototype = Proxy.create(handler, Function.prototype, undefined);
+checkConstruct(proxiedFunctionPrototype);
+
+var proxiedBuiltin = Proxy.create(handler, parseInt, undefined);
+checkConstruct(proxiedBuiltin);
 
 
 if (typeof reportCompare == 'function')
     reportCompare(0, 0, "ok");