Bug 990293 - Pass false to WrapNative in nsIDocument::WrapObject. r=bz

This commit is contained in:
Andrew McCreight 2014-04-10 14:46:20 -04:00
parent 56dc0c1f4b
commit 4d697fc708
2 changed files with 5 additions and 6 deletions

View File

@ -1650,9 +1650,10 @@ public:
MOZ_WARN_UNUSED_RESULT
static nsresult WrapNative(JSContext *cx, nsISupports *native,
const nsIID* aIID, JS::MutableHandle<JS::Value> vp)
const nsIID* aIID, JS::MutableHandle<JS::Value> vp,
bool aAllowWrapping = true)
{
return WrapNative(cx, native, nullptr, aIID, vp, true);
return WrapNative(cx, native, nullptr, aIID, vp, aAllowWrapping);
}
// Same as the WrapNative above, but use this one if aIID is nsISupports' IID.

View File

@ -12151,15 +12151,13 @@ nsIDocument::WrapObject(JSContext *aCx)
JS::Rooted<JS::Value> winVal(aCx);
nsresult rv = nsContentUtils::WrapNative(aCx, win, &NS_GET_IID(nsIDOMWindow),
&winVal);
&winVal,
false);
if (NS_FAILED(rv)) {
Throw(aCx, rv);
return nullptr;
}
MOZ_ASSERT(&winVal.toObject() == js::UncheckedUnwrap(&winVal.toObject()),
"WrapNative shouldn't create a cross-compartment wrapper");
NS_NAMED_LITERAL_STRING(doc_str, "document");
if (!JS_DefineUCProperty(aCx, JSVAL_TO_OBJECT(winVal), doc_str.get(),