Bug 936040 - Fix a rooting analysis false positive in nsWindowSH::PostCreate; r=smaug
authorTerrence Cole <terrence@mozilla.com>
Thu, 07 Nov 2013 08:27:47 -0800
changeset 169970 3b3ff422444d48de51d6539aada83f42b4cb324f
parent 169969 f410dbf98d0f9e07e266e44ec111bbc92d78adb0
child 169971 13beeed7c60937fce1e100030950f2fa08bb932f
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs936040
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 936040 - Fix a rooting analysis false positive in nsWindowSH::PostCreate; r=smaug
dom/base/nsDOMClassInfo.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -2026,29 +2026,30 @@ nsWindowSH::PostCreatePrototype(JSContex
   WindowNamedPropertiesHandler::Install(aCx, proto);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWindowSH::PostCreate(nsIXPConnectWrappedNative *wrapper,
                        JSContext *cx, JSObject *obj)
 {
+  JS::Rooted<JSObject*> window(cx, obj);
+
 #ifdef DEBUG
   nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryWrappedNative(wrapper));
 
   NS_ASSERTION(sgo && sgo->GetGlobalJSObject() == nullptr,
                "Multiple wrappers created for global object!");
 #endif
 
   const NativeProperties* windowProperties =
     WindowBinding::sNativePropertyHooks->mNativeProperties.regular;
   const NativeProperties* eventTargetProperties =
     EventTargetBinding::sNativePropertyHooks->mNativeProperties.regular;
 
-  JS::Rooted<JSObject*> window(cx, obj);
   return DefineWebIDLBindingPropertiesOnXPCObject(cx, window, windowProperties, true) &&
          DefineWebIDLBindingPropertiesOnXPCObject(cx, window, eventTargetProperties, true) ?
          NS_OK : NS_ERROR_FAILURE;
 }
 
 static nsHTMLDocument*
 GetDocument(JSObject *obj)
 {