diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-03-17 14:30:49 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-03-17 14:30:49 +0100 |
commit | 818d7501efd2b64cb13de796522b1f34c704597c (patch) | |
tree | 048f37b89d4eae79137026d1a6bc869c1bab15af /dom/html | |
parent | 71becfaffb40c3bf8ff89ecf81c5dc272e66ee0a (diff) | |
download | uxp-818d7501efd2b64cb13de796522b1f34c704597c.tar.gz |
Bug 1426002. Bail out of document.open if beforeunload tears things down. r=mystor
Diffstat (limited to 'dom/html')
-rw-r--r-- | dom/html/nsHTMLDocument.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index fea78dc37e..be5a34d41e 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -1536,6 +1536,18 @@ nsHTMLDocument::Open(JSContext* cx, nsCOMPtr<nsIDocument> ret = this; return ret.forget(); } + + // Now double-check that our invariants still hold. + if (!mScriptGlobalObject) { + nsCOMPtr<nsIDocument> ret = this; + return ret.forget(); + } + + nsPIDOMWindowOuter* outer = GetWindow(); + if (!outer || (GetInnerWindow() != outer->GetCurrentInnerWindow())) { + nsCOMPtr<nsIDocument> ret = this; + return ret.forget(); + } } nsCOMPtr<nsIWebNavigation> webnav(do_QueryInterface(shell)); |