From b226332e2e7f2087e22216dd76e6ce77d421bd83 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 29 Feb 2012 18:09:16 -0800 Subject: [PATCH] Bug 691178 - Refuse to wrap windows that are on the way out. r=jst --- dom/base/nsDOMClassInfo.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index 6eabf4eba703..808746e37d68 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -5147,6 +5147,11 @@ nsWindowSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *winObj = win->FastGetGlobalJSObject(); if (!winObj) { + + // See bug 691178 comment 11 for why this is necessary. + if (win->IsClosedOrClosing()) + return NS_ERROR_FAILURE; + NS_ASSERTION(win->GetOuterWindowInternal()->IsCreatingInnerWindow(), "should have a JS object by this point"); return NS_OK;