Bug 965921 - Handle addons that expose JS-implemented XPCOM components to content. r=mrbkap

This commit is contained in:
Bobby Holley 2014-02-10 10:27:24 -08:00
parent 983a6bbd24
commit 32debe31bf

View File

@ -155,9 +155,12 @@ XPC_WN_DoubleWrappedGetter(JSContext *cx, unsigned argc, jsval *vp)
return true;
}
// It is a double wrapped object. This should never appear in content these
// days, but let's be safe here.
MOZ_RELEASE_ASSERT(nsContentUtils::IsCallerChrome());
// It is a double wrapped object. This should really never appear in
// content these days, but addons still do it - see bug 965921.
if (MOZ_UNLIKELY(!nsContentUtils::IsCallerChrome())) {
JS_ReportError(cx, "Attempt to use .wrappedJSObject in untrusted code");
return false;
}
args.rval().setObject(*realObject);
return JS_WrapValue(cx, args.rval());
}