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

This commit is contained in:
Bobby Holley 2013-02-26 11:04:12 -08:00
parent 138401e1b0
commit 65df4a86fd

View File

@ -6174,6 +6174,7 @@ private:
*/
static nsresult
GetContextAndScope(nsIDocument* aOldDocument, nsIDocument* aNewDocument,
nsCxPusher& aPusher,
JSContext** aCx, JSObject** aNewScope)
{
MOZ_ASSERT(aOldDocument);
@ -6216,6 +6217,9 @@ GetContextAndScope(nsIDocument* aOldDocument, nsIDocument* aNewDocument,
}
}
if (cx) {
aPusher.Push(cx);
}
if (!newScope && cx) {
JS::Value v;
nsresult rv = nsContentUtils::WrapNative(cx, global, aNewDocument,
@ -6349,8 +6353,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;
}