mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 940692 - Fix rooting hazard in CheckForOutdatedParent() r=smaug
This commit is contained in:
parent
ca69392589
commit
cdb8275c7d
@ -1331,15 +1331,15 @@ AdoptNodeIntoOwnerDoc(nsINode *aParent, nsINode *aNode)
|
||||
static nsresult
|
||||
CheckForOutdatedParent(nsINode* aParent, nsINode* aNode)
|
||||
{
|
||||
if (JSObject* existingObj = aNode->GetWrapper()) {
|
||||
if (JSObject* existingObjUnrooted = aNode->GetWrapper()) {
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> existingObj(cx, existingObjUnrooted);
|
||||
nsIGlobalObject* global = aParent->OwnerDoc()->GetScopeObject();
|
||||
MOZ_ASSERT(global);
|
||||
|
||||
if (js::GetGlobalForObjectCrossCompartment(existingObj) !=
|
||||
global->GetGlobalJSObject()) {
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JSObject*> rooted(cx, existingObj);
|
||||
nsresult rv = ReparentWrapper(cx, rooted);
|
||||
nsresult rv = ReparentWrapper(cx, existingObj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user