Bug 834732 - Push a cx in AdoptNode. r=mrbkap

This commit is contained in:
Bobby Holley 2013-02-13 00:22:27 +01:00
parent 31c388152b
commit fd72f5bc97

View File

@ -6181,6 +6181,7 @@ private:
*/
static nsresult
GetContextAndScope(nsIDocument* aOldDocument, nsIDocument* aNewDocument,
nsCxPusher& aPusher,
JSContext** aCx, JSObject** aNewScope)
{
MOZ_ASSERT(aOldDocument);
@ -6223,6 +6224,9 @@ GetContextAndScope(nsIDocument* aOldDocument, nsIDocument* aNewDocument,
}
}
if (cx) {
aPusher.Push(cx);
}
if (!newScope && cx) {
JS::Value v;
nsresult rv = nsContentUtils::WrapNative(cx, global, aNewDocument,
@ -6356,8 +6360,9 @@ nsIDocument::AdoptNode(nsINode& aAdoptedNode, ErrorResult& rv)
JSContext *cx = nullptr;
JSObject *newScope = nullptr;
nsCxPusher pusher;
if (!sameDocument) {
rv = GetContextAndScope(oldDocument, this, &cx, &newScope);
rv = GetContextAndScope(oldDocument, this, pusher, &cx, &newScope);
if (rv.Failed()) {
return nullptr;
}