diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 289be2b15beb..b68325fb387b 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -346,8 +346,15 @@ public: JS::MutableHandleObject protop) { RootedObject holder(cx, ensureHolder(cx, wrapper)); - JSProtoKey key = isPrototype(holder) ? JSProto_Object - : getProtoKey(holder); + JSProtoKey key = getProtoKey(holder); + if (isPrototype(holder)) { + if (key == JSProto_Object) { + protop.set(nullptr); + return true; + } + key = JSProto_Object; + } + { JSAutoCompartment ac(cx, target); if (!JS_GetClassPrototype(cx, key, protop))