Bug 1141863 - Last followup fix for a couple jstest failures. r=orange in a CLOSED TREE
authorJeff Walden <jwalden@mit.edu>
Thu, 08 Oct 2015 20:03:47 -0700
changeset 300407 38f4ce29926d6336c00910f7795ee257be4eb704
parent 300406 fa77b9c41225fbd66e3a0305dd97a1fbaa5d3951
child 300408 4fed2969228466303141ed72f29cba5d123ea079
push id5392
push userraliiev@mozilla.com
push dateMon, 14 Dec 2015 20:08:23 +0000
treeherdermozilla-beta@16ce8562a975 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersorange
bugs1141863
milestone44.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 1141863 - Last followup fix for a couple jstest failures. r=orange in a CLOSED TREE
js/src/tests/ecma_6/Proxy/revoke-as-side-effect.js
js/src/tests/ecma_6/Reflect/construct.js
--- a/js/src/tests/ecma_6/Proxy/revoke-as-side-effect.js
+++ b/js/src/tests/ecma_6/Proxy/revoke-as-side-effect.js
@@ -66,13 +66,18 @@ for (var k in createProxy({a: 5})) {
 // [[OwnPropertyKeys]]
 assertEq(Object.getOwnPropertyNames(createProxy({})).length, 0);
 assertEq(Object.getOwnPropertyNames(createProxy({a: 5})).length, 1);
 
 // [[Call]]
 assertEq(createProxy(function() { return "ok" })(), "ok");
 
 // [[Construct]]
-// This should throw per bug 1141865.
-assertEq(new (createProxy(function(){ return obj; })), obj);
+// This throws because after the "construct" trap on the proxy is consulted,
+// OrdinaryCreateFromConstructor (called because the |q| function's
+// [[ConstructorKind]] is "base" per FunctionAllocate) accesses
+// |new.target.prototype| to create the |this| for the construct operation, that
+// would be returned if |return obj;| didn't override it.
+assertThrowsInstanceOf(() => new (createProxy(function q(){ return obj; })),
+                       TypeError);
 
 if (typeof reportCompare === "function")
   reportCompare(true, true);
--- a/js/src/tests/ecma_6/Reflect/construct.js
+++ b/js/src/tests/ecma_6/Reflect/construct.js
@@ -33,30 +33,25 @@ assertDeepEq(Reflect.construct(bound, []
 if (classesEnabled()) {
     eval(`{
         class Base {
             constructor(...args) {
                 this.args = args;
                 this.newTarget = new.target;
             }
         }
-        //class Derived extends Base {
-        //    constructor(...args) { super(...args); }
-        //}
+        class Derived extends Base {
+            constructor(...args) { super(...args); }
+        }
 
         assertDeepEq(Reflect.construct(Base, []), new Base);
-        //assertDeepEq(Reflect.construct(Derived, [7]), new Derived(7));
-        //g = Derived.bind(null, "q");
-        //assertDeepEq(Reflect.construct(g, [8, 9]), new g(8, 9));
+        assertDeepEq(Reflect.construct(Derived, [7]), new Derived(7));
+        g = Derived.bind(null, "q");
+        assertDeepEq(Reflect.construct(g, [8, 9]), new g(8, 9));
     }`);
-
-    if (classesEnabled("class X extends Y { constructor() { super(); } }")) {
-        throw new Error("Congratulations on implementing super()! " +
-                        "Please uncomment the Derived tests in this file!");
-    }
 }
 
 // Cross-compartment wrappers:
 var g = newGlobal();
 var local = {here: this};
 g.eval("function F(arg) { this.arg = arg }");
 assertDeepEq(Reflect.construct(g.F, [local]), new g.F(local));