[INFER] Look up .prototype on right object when monitoring NEW, bug 621126.

This commit is contained in:
Brian Hackett 2010-12-23 20:31:24 -05:00
parent 5b9156630b
commit 01a2274ce4
2 changed files with 9 additions and 1 deletions

View File

@ -0,0 +1,7 @@
with({}) {
function f() {
this.foo = "bar";
}
o = new f();
assertEq(o.foo, "bar");
}

View File

@ -397,7 +397,8 @@ JSContext::typeMonitorCall(JSScript *caller, const jsbytecode *callerpc,
if (constructing) {
js::Value protov;
if (!callee->getProperty(this, ATOM_TO_JSID(runtime->atomState.classPrototypeAtom), &protov))
jsid id = ATOM_TO_JSID(runtime->atomState.classPrototypeAtom);
if (!args.callee().toObject().getProperty(this, id, &protov))
return; /* :FIXME: */
if (protov.isObject()) {
js::types::TypeObject *otype = protov.toObject().getNewType(this);