Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index 03a65cf6a6ec13f79de3710a15377b2db0ef2274..37178b2943fee552d0cfd3da7a05ed7a4b19066f 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -5211,6 +5211,13 @@ DocumentNameCollection* Document::documentNamedItems(const AtomicString& name) { |
name); |
} |
+LocalDOMWindow* Document::defaultView() const { |
+ // The HTML spec requires to return null if the document is detached from a |
+ // frame. However, |m_domWindow| is not cleared on the detachment. So, we |
+ // need to check |m_frame| to tell whether the document is attached or not. |
+ return m_frame ? m_domWindow : nullptr; |
+} |
+ |
void Document::finishedParsing() { |
DCHECK(!scriptableDocumentParser() || !m_parser->isParsing()); |
DCHECK(!scriptableDocumentParser() || m_readyState != Loading); |