Bug 1517467. Handle us not having a subframe window in the contentDocument getter. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D15677
This commit is contained in:
Boris Zbarsky
2019-01-03 20:37:01 +00:00
parent d7b4ed56c5
commit 892bd9f878

View File

@@ -76,7 +76,16 @@ nsIDocument* nsGenericHTMLFrameElement::GetContentDocument(
return nullptr;
}
nsIDocument* doc = bc->GetDOMWindow()->GetDoc();
nsPIDOMWindowOuter* window = bc->GetDOMWindow();
if (!window) {
// Either our browsing context contents are out-of-process (in which case
// clearly this is a cross-origin call and we should return null), or our
// browsing context is torn-down enough to no longer have a window or a
// document, and we should still return null.
return nullptr;
}
nsIDocument* doc = window->GetDoc();
if (!doc) {
return nullptr;
}