diff --git a/content/base/public/nsContentUtils.h b/content/base/public/nsContentUtils.h index 44d4ffab883..c4bcb068e79 100644 --- a/content/base/public/nsContentUtils.h +++ b/content/base/public/nsContentUtils.h @@ -1637,6 +1637,7 @@ public: */ static bool CanAccessNativeAnon(); + MOZ_WARN_UNUSED_RESULT static nsresult WrapNative(JSContext *cx, JS::Handle scope, nsISupports *native, const nsIID* aIID, JS::MutableHandle vp, @@ -1646,12 +1647,15 @@ public: } // Same as the WrapNative above, but use this one if aIID is nsISupports' IID. + MOZ_WARN_UNUSED_RESULT static nsresult WrapNative(JSContext *cx, JS::Handle scope, nsISupports *native, JS::MutableHandle vp, bool aAllowWrapping = false) { return WrapNative(cx, scope, native, nullptr, nullptr, vp, aAllowWrapping); } + + MOZ_WARN_UNUSED_RESULT static nsresult WrapNative(JSContext *cx, JS::Handle scope, nsISupports *native, nsWrapperCache *cache, JS::MutableHandle vp, diff --git a/content/base/src/nsFrameMessageManager.cpp b/content/base/src/nsFrameMessageManager.cpp index 09a08bb7cdf..d23118932a4 100644 --- a/content/base/src/nsFrameMessageManager.cpp +++ b/content/base/src/nsFrameMessageManager.cpp @@ -926,7 +926,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, JS::Rooted targetv(ctx); JS::Rooted global(ctx, JS_GetGlobalForObject(ctx, object)); - nsContentUtils::WrapNative(ctx, global, aTarget, &targetv, true); + nsresult rv = nsContentUtils::WrapNative(ctx, global, aTarget, &targetv, true); + NS_ENSURE_SUCCESS(rv, rv); JS::Rooted cpows(ctx); if (aCpows) { @@ -1016,7 +1017,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget, defaultThisValue = aTarget; } JS::Rooted global(ctx, JS_GetGlobalForObject(ctx, object)); - nsContentUtils::WrapNative(ctx, global, defaultThisValue, &thisValue, true); + nsresult rv = nsContentUtils::WrapNative(ctx, global, defaultThisValue, &thisValue, true); + NS_ENSURE_SUCCESS(rv, rv); } else { // If the listener is a JS object which has receiveMessage function: if (!JS_GetProperty(ctx, object, "receiveMessage", &funval) ||