mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1166351 - Add an assertion to make sure that we use the correct cached XBL binding prototypes. r=bobbyholley+313730
MozReview-Commit-ID: 7MfslXmortQ --HG-- extra : rebase_source : 478d19031d5820acf2eeb077d689159769318b2a
This commit is contained in:
parent
0abb0a4c79
commit
4e5e8f7b73
@ -957,6 +957,15 @@ GetOrCreateMapEntryForPrototype(JSContext *cx, JS::Handle<JSObject*> proto)
|
||||
return entry;
|
||||
}
|
||||
|
||||
static
|
||||
nsXBLPrototypeBinding*
|
||||
GetProtoBindingFromClassObject(JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(JS_GetClass(obj) == &gPrototypeJSClass);
|
||||
return static_cast<nsXBLPrototypeBinding*>(::JS_GetReservedSlot(obj, 0).toPrivate());
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
nsresult
|
||||
nsXBLBinding::DoInitJSClass(JSContext *cx,
|
||||
@ -1012,7 +1021,9 @@ nsXBLBinding::DoInitJSClass(JSContext *cx,
|
||||
*aNew = !desc.object();
|
||||
if (desc.object()) {
|
||||
proto = &desc.value().toObject();
|
||||
MOZ_ASSERT(JS_GetClass(js::UncheckedUnwrap(proto)) == &gPrototypeJSClass);
|
||||
DebugOnly<nsXBLPrototypeBinding*> cachedBinding =
|
||||
GetProtoBindingFromClassObject(js::UncheckedUnwrap(proto));
|
||||
MOZ_ASSERT(cachedBinding == aProtoBinding);
|
||||
} else {
|
||||
|
||||
// We need to create the prototype. First, enter the compartment where it's
|
||||
|
Loading…
Reference in New Issue
Block a user