Bug 664951 - Weaken CallJSNativeConstructor again (r=waldo)

This commit is contained in:
Luke Wagner 2011-06-17 16:51:52 -07:00
parent 3ca1688adf
commit 2ebc3262be
3 changed files with 9 additions and 2 deletions

View File

@ -0,0 +1,4 @@
var handler = { fix: function() { return []; } };
var p = Proxy.createFunction(handler, function(){}, function(){});
Proxy.fix(p);
new p();

View File

@ -317,7 +317,10 @@ CallJSNativeConstructor(JSContext *cx, js::Native native, const CallArgs &args)
* (new Object(Object)) returns the callee.
*/
extern JSBool proxy_Construct(JSContext *, uintN, Value *);
JS_ASSERT_IF(native != proxy_Construct && native != js::CallOrConstructBoundFunction &&
extern JSBool callable_Construct(JSContext *, uintN, Value *);
JS_ASSERT_IF(native != proxy_Construct &&
native != callable_Construct &&
native != js::CallOrConstructBoundFunction &&
(!callee.isFunction() || callee.getFunctionPrivate()->u.n.clasp != &js_ObjectClass),
!args.rval().isPrimitive() && callee != args.rval().toObject());

View File

@ -1332,7 +1332,7 @@ callable_Call(JSContext *cx, uintN argc, Value *vp)
return ok;
}
static JSBool
JSBool
callable_Construct(JSContext *cx, uintN argc, Value *vp)
{
JSObject *thisobj = js_CreateThis(cx, &JS_CALLEE(cx, vp).toObject());