mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Fix instanceof for DOM classes when XPCNativeWrappers are around. Bug 294926,
r+sr=jst, a=dbaron
This commit is contained in:
parent
1864138655
commit
0749d74bf2
@ -4088,6 +4088,16 @@ DOMJSClass_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp)
|
||||
JSObject *dom_obj = JSVAL_TO_OBJECT(v);
|
||||
NS_ASSERTION(dom_obj, "DOMJSClass_HasInstance couldn't get object");
|
||||
|
||||
// This might not be the right object, if XPCNativeWrapping
|
||||
// happened. Get the wrapped native for this object, then get its
|
||||
// JS object.
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapped_native;
|
||||
nsContentUtils::XPConnect()->
|
||||
GetWrappedNativeOfJSObject(cx, dom_obj, getter_AddRefs(wrapped_native));
|
||||
if (wrapped_native) {
|
||||
wrapped_native->GetJSObject(&dom_obj);
|
||||
}
|
||||
|
||||
JSClass *dom_class = JS_GET_CLASS(cx, dom_obj);
|
||||
if (!dom_class) {
|
||||
NS_ERROR("DOMJSClass_HasInstance can't get class.");
|
||||
|
Loading…
Reference in New Issue
Block a user