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 9e6b7c37f71635fba78318c06a7f27d988e7ba0e..3b0b38b56fd88293a6901e60f057e37cfc54546a 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -5314,6 +5314,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 the |
+ // DOM. However, |dom_window_| is not cleared on the detachment. So, we need |
+ // to check |frame_| to tell whether the document is attached or not. |
+ return frame_ ? dom_window_ : nullptr; |
+} |
+ |
void Document::FinishedParsing() { |
DCHECK(!GetScriptableDocumentParser() || !parser_->IsParsing()); |
DCHECK(!GetScriptableDocumentParser() || ready_state_ != kLoading); |