mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07: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
a03434327e
commit
7a7599bc24
@ -6636,8 +6636,10 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
JSAutoCompartment ac(cx, winobj);
|
JSAutoCompartment ac(cx, winobj);
|
||||||
dot_prototype = ::JS_NewObject(cx, &sDOMConstructorProtoClass, proto,
|
dot_prototype = ::JS_NewObjectWithUniqueType(cx,
|
||||||
winobj);
|
&sDOMConstructorProtoClass,
|
||||||
|
proto,
|
||||||
|
winobj);
|
||||||
NS_ENSURE_TRUE(dot_prototype, NS_ERROR_OUT_OF_MEMORY);
|
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 proto(cx, protoArg);
|
||||||
RootedObject parent(cx, parentArg);
|
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))
|
if (!obj || !JSObject::setSingletonType(cx, obj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
if (!JS_SplicePrototype(cx, obj, proto))
|
||||||
|
return NULL;
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5653,8 +5653,6 @@ JSObject::splicePrototype(JSContext *cx, Handle<TaggedProto> proto)
|
|||||||
Rooted<TypeObject*> protoType(cx, NULL);
|
Rooted<TypeObject*> protoType(cx, NULL);
|
||||||
if (proto.isObject()) {
|
if (proto.isObject()) {
|
||||||
protoType = proto.toObject()->getType(cx);
|
protoType = proto.toObject()->getType(cx);
|
||||||
if (!proto.toObject()->getNewType(cx))
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cx->typeInferenceEnabled()) {
|
if (!cx->typeInferenceEnabled()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user