Bug 747245: Fix a silly weak reference assertion. r=bent a=mfinkle
authorKyle Huey <khuey@kylehuey.com>
Mon, 23 Apr 2012 14:14:10 -0700
changeset 95428 142fe408f5b4a805ca76406b62b2a2163ddeed2c
parent 95427 b9936b8bcccfa0c3f7e8590127554e1bb19b9d97
child 95458 8acbbeca4f425d99614b981847a5a004516cdb49
child 96316 938220fa0928ed3dc1e4701d16b83aef24cf772a
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent, mfinkle
bugs747245
milestone14.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 747245: Fix a silly weak reference assertion. r=bent a=mfinkle
js/xpconnect/src/XPCJSWeakReference.cpp
--- a/js/xpconnect/src/XPCJSWeakReference.cpp
+++ b/js/xpconnect/src/XPCJSWeakReference.cpp
@@ -55,18 +55,20 @@ nsresult xpcJSWeakReference::Init(JSCont
 
     JSObject& obj = object.toObject();
 
     XPCCallContext ccx(NATIVE_CALLER, cx);
 
     // See if the object is a wrapped native that supports weak references.
     nsISupports* supports =
         nsXPConnect::GetXPConnect()->GetNativeOfWrapper(cx, &obj);
-    if (supports) {
-        mReferent = do_GetWeakReference(supports);
+    nsCOMPtr<nsISupportsWeakReference> supportsWeakRef =
+        do_QueryInterface(supports);
+    if (supportsWeakRef) {
+        supportsWeakRef->GetWeakReference(getter_AddRefs(mReferent));
         if (mReferent) {
             return NS_OK;
         }
     }
     // If it's not a wrapped native, or it is a wrapped native that does not
     // support weak references, fall back to getting a weak ref to the object.
 
     // See if object is a wrapped JSObject.