diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 725b8dd18105..391fe5ceee0f 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -5156,8 +5156,10 @@ static nsresult LocationSetterGuts(JSContext *cx, JSObject *obj, jsval *vp) { // This function duplicates some of the logic in XPC_WN_HelperSetProperty - XPCWrappedNative *wrapper = - XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj); + obj = js::UnwrapObjectChecked(obj, /* stopAtOuter = */ false); + if (!IS_WN_WRAPPER(obj)) + return NS_ERROR_XPC_BAD_CONVERT_JS; + XPCWrappedNative *wrapper = XPCWrappedNative::Get(obj); // The error checks duplicate code in THROW_AND_RETURN_IF_BAD_WRAPPER NS_ENSURE_TRUE(!wrapper || wrapper->IsValid(), NS_ERROR_XPC_HAS_BEEN_SHUTDOWN);