diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index fa1d9724483..2786a833c15 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -2948,7 +2948,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect) mVariantRoots(nullptr), mWrappedJSRoots(nullptr), mObjectHolderRoots(nullptr), - mWatchdogManager(new WatchdogManager(this)), + mWatchdogManager(new WatchdogManager(MOZ_THIS_IN_INITIALIZER_LIST())), mJunkScope(nullptr), mAsyncSnowWhiteFreer(new AsyncFreeSnowWhite()) { diff --git a/js/xpconnect/src/XPCWrappedJS.cpp b/js/xpconnect/src/XPCWrappedJS.cpp index 78ad238c04f..f97b28c84ca 100644 --- a/js/xpconnect/src/XPCWrappedJS.cpp +++ b/js/xpconnect/src/XPCWrappedJS.cpp @@ -339,7 +339,7 @@ nsXPCWrappedJS::nsXPCWrappedJS(JSContext* cx, nsISupports* aOuter) : mJSObj(aJSObj), mClass(aClass), - mRoot(root ? root : this), + mRoot(root ? root : MOZ_THIS_IN_INITIALIZER_LIST()), mNext(nullptr), mOuter(root ? nullptr : aOuter) { diff --git a/js/xpconnect/src/xpcprivate.h b/js/xpconnect/src/xpcprivate.h index 026e5599557..9957ae9659c 100644 --- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -248,11 +248,6 @@ inline JSObject* GetWNExpandoChain(JSObject *obj) return JS_GetReservedSlot(obj, WN_XRAYEXPANDOCHAIN_SLOT).toObjectOrNull(); } -// We PROMISE to never screw this up. -#ifdef _MSC_VER -#pragma warning(disable : 4355) // OK to pass "this" in member initializer -#endif - /*************************************************************************** **************************************************************************** *