Index: Source/WebCore/dom/Document.cpp |
=================================================================== |
--- Source/WebCore/dom/Document.cpp (revision 88811) |
+++ Source/WebCore/dom/Document.cpp (working copy) |
@@ -443,7 +443,6 @@ |
m_ignoreAutofocus = false; |
m_frame = frame; |
- m_documentLoader = frame ? frame->loader()->activeDocumentLoader() : 0; |
// We depend on the url getting immediately set in subframes, but we |
// also depend on the url NOT getting immediately set in opened windows. |
@@ -3733,7 +3732,9 @@ |
DateComponents date; |
bool foundDate = false; |
if (m_frame) { |
- String httpLastModified = m_documentLoader->response().httpHeaderField("Last-Modified"); |
+ String httpLastModified; |
+ if (DocumentLoader* documentLoader = loader()) |
+ httpLastModified = documentLoader->response().httpHeaderField("Last-Modified"); |
if (!httpLastModified.isEmpty()) { |
date.setMillisecondsSinceEpochForDateTime(parseDate(httpLastModified)); |
foundDate = true; |
@@ -4441,7 +4442,9 @@ |
// load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16756 |
// and https://bugs.webkit.org/show_bug.cgi?id=19760 for further |
// discussion. |
- if (m_documentLoader->substituteData().isValid()) |
+ |
+ DocumentLoader* documentLoader = loader(); |
+ if (documentLoader && documentLoader->substituteData().isValid()) |
securityOrigin()->grantLoadLocalResources(); |
} |
@@ -4522,7 +4525,9 @@ |
setURL(url); |
f->loader()->setOutgoingReferrer(url); |
- m_documentLoader->replaceRequestURLForSameDocumentNavigation(url); |
+ |
+ if (DocumentLoader* documentLoader = loader()) |
+ documentLoader->replaceRequestURLForSameDocumentNavigation(url); |
} |
void Document::statePopped(SerializedScriptValue* stateObject) |
@@ -4988,4 +4993,19 @@ |
} |
#endif |
+DocumentLoader* Document::loader() const |
+{ |
+ if (!m_frame) |
+ return 0; |
+ |
+ DocumentLoader* loader = m_frame->loader()->activeDocumentLoader(); |
+ if (!loader) |
+ return 0; |
+ |
+ if (m_frame->document() != this) |
+ return 0; |
+ |
+ return loader; |
+} |
+ |
} // namespace WebCore |