Index: third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp b/third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp |
index a3690db032890765ce31b5e833ba37d791788f2f..955ee29a9381f3661d0cd5f591adf9a803f75f11 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLHtmlElement.cpp |
@@ -50,16 +50,27 @@ bool HTMLHtmlElement::isURLAttribute(const Attribute& attribute) const |
void HTMLHtmlElement::insertedByParser() |
{ |
// When parsing a fragment, its dummy document has a null parser. |
- if (!document().parser() || !document().parser()->documentWasLoadedAsPartOfNavigation()) |
+ if (!document().parser()) |
return; |
+ maybeSetupApplicationCache(); |
+ |
+ document().parser()->documentElementAvailable(); |
+ if (document().frame()) { |
+ document().frame()->loader().dispatchDocumentElementAvailable(); |
+ document().frame()->loader().runScriptsAtDocumentElementAvailable(); |
+ // runScriptsAtDocumentElementAvailable might have invalidated m_document. |
+ } |
+} |
+ |
+void HTMLHtmlElement::maybeSetupApplicationCache() |
+{ |
if (!document().frame()) |
return; |
DocumentLoader* documentLoader = document().frame()->loader().documentLoader(); |
- if (!documentLoader) |
+ if (!documentLoader || !document().parser()->documentWasLoadedAsPartOfNavigation()) |
return; |
- |
const AtomicString& manifest = fastGetAttribute(manifestAttr); |
if (manifest.isEmpty()) |
documentLoader->applicationCacheHost()->selectCacheWithoutManifest(); |