Bug 956569 - Make nsContentUtils::WrapNative MOZ_WARN_UNUSED_RESULT. r=smaug

This commit is contained in:
Andrew McCreight 2014-01-06 11:54:43 -08:00
parent 63edb97f7a
commit e5bb2e7801
2 changed files with 8 additions and 2 deletions

View File

@ -1637,6 +1637,7 @@ public:
*/
static bool CanAccessNativeAnon();
MOZ_WARN_UNUSED_RESULT
static nsresult WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
nsISupports *native, const nsIID* aIID,
JS::MutableHandle<JS::Value> 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<JSObject*> scope,
nsISupports *native, JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = false)
{
return WrapNative(cx, scope, native, nullptr, nullptr, vp, aAllowWrapping);
}
MOZ_WARN_UNUSED_RESULT
static nsresult WrapNative(JSContext *cx, JS::Handle<JSObject*> scope,
nsISupports *native, nsWrapperCache *cache,
JS::MutableHandle<JS::Value> vp,

View File

@ -926,7 +926,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
JS::Rooted<JS::Value> targetv(ctx);
JS::Rooted<JSObject*> 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<JSObject*> cpows(ctx);
if (aCpows) {
@ -1016,7 +1017,8 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
defaultThisValue = aTarget;
}
JS::Rooted<JSObject*> 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) ||