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;