diff --git a/js/src/xpconnect/src/xpcprivate.h b/js/src/xpconnect/src/xpcprivate.h index 5dad1589c53..8d2a34e8b66 100644 --- a/js/src/xpconnect/src/xpcprivate.h +++ b/js/src/xpconnect/src/xpcprivate.h @@ -1811,6 +1811,8 @@ public: void SetCallback(nsIXPCScriptable* s) {mCallback = s;} + void + SetCallback(already_AddRefed s) {mCallback = s;} void SetScriptableShared(XPCNativeScriptableShared* shared) {mShared = shared;} @@ -1859,6 +1861,9 @@ public: void SetCallback(nsIXPCScriptable* callback) {mCallback = callback;} + void + SetCallback(already_AddRefed callback) + {mCallback = callback;} void SetFlags(const XPCNativeScriptableFlags& flags) {mFlags = flags;} diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index 3a352d1428e..82e89084cba 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -807,7 +807,7 @@ XPCWrappedNative::GatherProtoScriptableCreateInfo( if(NS_FAILED(rv)) flags = 0; - sciProto->SetCallback(helper); + sciProto->SetCallback(helper.forget()); sciProto->SetFlags(flags); } } @@ -846,7 +846,7 @@ XPCWrappedNative::GatherScriptableCreateInfo( if(NS_FAILED(rv)) flags = 0; - sciWrapper->SetCallback(helper); + sciWrapper->SetCallback(helper.forget()); sciWrapper->SetFlags(flags); // A whole series of assertions to catch bad uses of scriptable flags on