mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 812392. Make sure we don't allow descendant protoss to confuse whether a proto corresponds to a DOM type. r=bhackett,peterv
This commit is contained in:
parent
4a492da39b
commit
489c78e5dc
@ -6637,8 +6637,13 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
||||
}
|
||||
} else {
|
||||
JSAutoCompartment ac(cx, winobj);
|
||||
dot_prototype = ::JS_NewObject(cx, &sDOMConstructorProtoClass, proto,
|
||||
winobj);
|
||||
if (!proto) {
|
||||
proto = JS_GetObjectPrototype(cx, winobj);
|
||||
}
|
||||
dot_prototype = ::JS_NewObjectWithUniqueType(cx,
|
||||
&sDOMConstructorProtoClass,
|
||||
proto,
|
||||
winobj);
|
||||
NS_ENSURE_TRUE(dot_prototype, NS_ERROR_OUT_OF_MEMORY);
|
||||
}
|
||||
}
|
||||
|
@ -116,9 +116,17 @@ JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *protoArg, JS
|
||||
{
|
||||
RootedObject proto(cx, protoArg);
|
||||
RootedObject parent(cx, parentArg);
|
||||
RootedObject obj(cx, JS_NewObject(cx, clasp, proto, parent));
|
||||
/*
|
||||
* Create our object with a null proto and then splice in the correct proto
|
||||
* after we setSingletonType, so that we don't pollute the default
|
||||
* TypeObject attached to our proto with information about our object, since
|
||||
* we're not going to be using that TypeObject anyway.
|
||||
*/
|
||||
RootedObject obj(cx, JS_NewObjectWithGivenProto(cx, clasp, NULL, parent));
|
||||
if (!obj || !JSObject::setSingletonType(cx, obj))
|
||||
return NULL;
|
||||
if (!JS_SplicePrototype(cx, obj, proto))
|
||||
return NULL;
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
@ -5643,8 +5643,6 @@ JSObject::splicePrototype(JSContext *cx, Handle<TaggedProto> proto)
|
||||
Rooted<TypeObject*> protoType(cx, NULL);
|
||||
if (proto.isObject()) {
|
||||
protoType = proto.toObject()->getType(cx);
|
||||
if (!proto.toObject()->getNewType(cx))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cx->typeInferenceEnabled()) {
|
||||
|
Loading…
Reference in New Issue
Block a user