[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

ap at apple.com ap at apple.com
Wed Dec 22 14:06:37 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 048c67f5d1d875385efd47df47693d06de6b83ef
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 4 19:48:49 2010 +0000

            Reviewed by Adam Barth.
    
            https://bugs.webkit.org/show_bug.cgi?id=47035
            Application cache selection algorithm should only be invoked after navigation
    
            Tests: http/tests/appcache/document-write-html-element-2.html
                   http/tests/appcache/document-write-html-element.html
                   http/tests/appcache/insert-html-element-with-manifest-2.html
                   http/tests/appcache/insert-html-element-with-manifest.html
    
            * dom/DocumentParser.cpp: (WebCore::DocumentParser::DocumentParser):
            * dom/DocumentParser.h:
            (WebCore::DocumentParser::setDocumentWasLoadedAsPartOfNavigation):
            (WebCore::DocumentParser::documentWasLoadedAsPartOfNavigation):
            Track whether the document being parsed is being loaded as part of navigation.
    
            * html/HTMLHtmlElement.cpp: (WebCore::HTMLHtmlElement::insertedByParser): Only run the
            cache selection algorithm if the document is being loaded as part of navigation. We don't
            want to switch associated appcache is someone document.writes <html manifest=...>.
    
            * html/HTMLHtmlElement.h: We need to differentiate between parsing and DOM manipulation, so
            this code can't be in HTMLHtmlElement::insertedIntoDocument().
    
            * dom/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::startElementNs):
            * dom/XMLDocumentParserQt.cpp: (WebCore::XMLDocumentParser::parseStartElement):
            * html/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure):
            * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure):
            * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::createDocumentStructure):
            * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML):
            Check for manifest attribute in cases specified by HTML5.
    
            * html/parser/HTMLConstructionSite.h: Removed unused insertHTMLHtmlElement().
    
            * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::setDocumentWasLoadedAsPartOfNavigation):
            * loader/DocumentWriter.h:
            Forward this call to DocumentParser, since DocumentWriter is supposed to encapsulate it.
    
            * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): Receiving data from
            loader means being loaded as part of navigation. This notion is used in HTML5 without a rigorous
            definition that I could find - this seems to be a meaningful formalization.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69026 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0198968..6272438 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,31 @@
+2010-10-04  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47035
+        Application cache selection algorithm should only be invoked after navigation
+
+        * http/tests/appcache/document-write-html-element-expected.txt: Added.
+        * http/tests/appcache/document-write-html-element.html: Added.
+        After onload, document.write <html> with manifest. It shouldn't be used for cache selection.
+
+        * http/tests/appcache/document-write-html-element-2-expected.txt: Added.
+        * http/tests/appcache/document-write-html-element-2.html: Added.
+        After onload, document.write some text into a document that already has a manifest. The original
+        cache should stay associated with the document. We used to fail on an assertion here.
+
+        * http/tests/appcache/insert-html-element-with-manifest-expected.txt: Added.
+        * http/tests/appcache/insert-html-element-with-manifest.html: Added.
+        Replace <html> element with another one while parsing. Manifest shouldn't be taken from
+        the new one.
+
+        * http/tests/appcache/insert-html-element-with-manifest-2-expected.txt: Added.
+        * http/tests/appcache/insert-html-element-with-manifest-2.html: Added.
+        Parse a fragment with <html manifest=..> while parsing a document.
+
+        * http/tests/appcache/resources/document-write-html-element.manifest: Added.
+        * http/tests/appcache/resources/insert-html-element-with-manifest.manifest: Added.
+
 2010-10-04  Adam Roben  <aroben at apple.com>
 
         Skip a timing-out test on Windows
diff --git a/LayoutTests/http/tests/appcache/document-write-html-element-2-expected.txt b/LayoutTests/http/tests/appcache/document-write-html-element-2-expected.txt
new file mode 100644
index 0000000..32581f4
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/document-write-html-element-2-expected.txt
@@ -0,0 +1,2 @@
+SUCCESS, no assertion failure
+applicationCache.status == 1
diff --git a/LayoutTests/http/tests/appcache/document-write-html-element-2.html b/LayoutTests/http/tests/appcache/document-write-html-element-2.html
new file mode 100644
index 0000000..bee9fe0
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/document-write-html-element-2.html
@@ -0,0 +1,19 @@
+<html manifest="resources/document-write-html-element.manifest">
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function test()
+{
+    document.write("SUCCESS, no assertion failure");
+    document.write("<br>applicationCache.status == " + applicationCache.status);
+
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+applicationCache.oncached = test;
+applicationCache.onnoupdate = test;
+</script>
diff --git a/LayoutTests/http/tests/appcache/document-write-html-element-expected.txt b/LayoutTests/http/tests/appcache/document-write-html-element-expected.txt
new file mode 100644
index 0000000..08dccd3
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/document-write-html-element-expected.txt
@@ -0,0 +1 @@
+DONE. Passed if there were no alerts displayed.
diff --git a/LayoutTests/http/tests/appcache/document-write-html-element.html b/LayoutTests/http/tests/appcache/document-write-html-element.html
new file mode 100644
index 0000000..83954bb
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/document-write-html-element.html
@@ -0,0 +1,26 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+window.onload = function()
+{
+    document.write("<html manifest='resources/document-write-html-element.manifest'>");
+    applicationCache.oncached = function() {
+        alert("FAIL: appcache cached");
+    }
+    applicationCache.onnoupdate = function() {
+        alert("FAIL: appcache noupdate");
+    }
+    applicationCache.onerror = function() {
+        alert("FAIL: appcache error");
+    }
+
+    setTimeout(function() {
+        document.write("DONE. Passed if there were no alerts displayed.");
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }, 100);
+}
+</script>
diff --git a/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-2-expected.txt b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-2-expected.txt
new file mode 100644
index 0000000..08dccd3
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-2-expected.txt
@@ -0,0 +1 @@
+DONE. Passed if there were no alerts displayed.
diff --git a/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-2.html b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-2.html
new file mode 100644
index 0000000..539d28b
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-2.html
@@ -0,0 +1,30 @@
+<html>
+<div></div>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+var div = document.getElementsByTagName("div")[0];
+div.innerHTML = '<html manifest="resources/insert-html-element-with-manifest.manifest">'
+
+window.onload = function()
+{
+    applicationCache.oncached = function() {
+        alert("FAIL: appcache cached");
+    }
+    applicationCache.onnoupdate = function() {
+        alert("FAIL: appcache noupdate");
+    }
+    applicationCache.onerror = function() {
+        alert("FAIL: appcache error");
+    }
+
+    setTimeout(function() {
+        document.write("DONE. Passed if there were no alerts displayed.");
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }, 100);
+}
+</script>
diff --git a/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-expected.txt b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-expected.txt
new file mode 100644
index 0000000..08dccd3
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest-expected.txt
@@ -0,0 +1 @@
+DONE. Passed if there were no alerts displayed.
diff --git a/LayoutTests/http/tests/appcache/insert-html-element-with-manifest.html b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest.html
new file mode 100644
index 0000000..694392c
--- /dev/null
+++ b/LayoutTests/http/tests/appcache/insert-html-element-with-manifest.html
@@ -0,0 +1,31 @@
+<html>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+document.removeChild(document.documentElement);
+var newHTML = document.createElement("html");
+newHTML.setAttribute("manifest", "resources/insert-html-element-with-manifest.manifest");
+document.appendChild(newHTML);
+
+window.onload = function()
+{
+    applicationCache.oncached = function() {
+        alert("FAIL: appcache cached");
+    }
+    applicationCache.onnoupdate = function() {
+        alert("FAIL: appcache noupdate");
+    }
+    applicationCache.onerror = function() {
+        alert("FAIL: appcache error");
+    }
+
+    setTimeout(function() {
+        document.write("DONE. Passed if there were no alerts displayed.");
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    }, 100);
+}
+</script>
diff --git a/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest b/LayoutTests/http/tests/appcache/resources/document-write-html-element.manifest
similarity index 100%
copy from LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest
copy to LayoutTests/http/tests/appcache/resources/document-write-html-element.manifest
diff --git a/LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest b/LayoutTests/http/tests/appcache/resources/insert-html-element-with-manifest.manifest
similarity index 100%
copy from LayoutTests/http/tests/appcache/resources/access-via-redirect.manifest
copy to LayoutTests/http/tests/appcache/resources/insert-html-element-with-manifest.manifest
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 62c6c92..4d390fd 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,46 @@
+2010-10-04  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Adam Barth.
+
+        https://bugs.webkit.org/show_bug.cgi?id=47035
+        Application cache selection algorithm should only be invoked after navigation
+
+        Tests: http/tests/appcache/document-write-html-element-2.html
+               http/tests/appcache/document-write-html-element.html
+               http/tests/appcache/insert-html-element-with-manifest-2.html
+               http/tests/appcache/insert-html-element-with-manifest.html
+
+        * dom/DocumentParser.cpp: (WebCore::DocumentParser::DocumentParser):
+        * dom/DocumentParser.h:
+        (WebCore::DocumentParser::setDocumentWasLoadedAsPartOfNavigation):
+        (WebCore::DocumentParser::documentWasLoadedAsPartOfNavigation):
+        Track whether the document being parsed is being loaded as part of navigation.
+
+        * html/HTMLHtmlElement.cpp: (WebCore::HTMLHtmlElement::insertedByParser): Only run the
+        cache selection algorithm if the document is being loaded as part of navigation. We don't 
+        want to switch associated appcache is someone document.writes <html manifest=...>.
+
+        * html/HTMLHtmlElement.h: We need to differentiate between parsing and DOM manipulation, so
+        this code can't be in HTMLHtmlElement::insertedIntoDocument().
+
+        * dom/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::startElementNs):
+        * dom/XMLDocumentParserQt.cpp: (WebCore::XMLDocumentParser::parseStartElement):
+        * html/ImageDocument.cpp: (WebCore::ImageDocument::createDocumentStructure):
+        * html/MediaDocument.cpp: (WebCore::MediaDocumentParser::createDocumentStructure):
+        * html/PluginDocument.cpp: (WebCore::PluginDocumentParser::createDocumentStructure):
+        * html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML):
+        Check for manifest attribute in cases specified by HTML5.
+
+        * html/parser/HTMLConstructionSite.h: Removed unused insertHTMLHtmlElement().
+
+        * loader/DocumentWriter.cpp: (WebCore::DocumentWriter::setDocumentWasLoadedAsPartOfNavigation):
+        * loader/DocumentWriter.h:
+        Forward this call to DocumentParser, since DocumentWriter is supposed to encapsulate it.
+
+        * loader/FrameLoader.cpp: (WebCore::FrameLoader::receivedFirstData): Receiving data from
+        loader means being loaded as part of navigation. This notion is used in HTML5 without a rigorous
+        definition that I could find - this seems to be a meaningful formalization.
+
 2010-10-04  David Hyatt  <hyatt at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/dom/DocumentParser.cpp b/WebCore/dom/DocumentParser.cpp
index efb96b0..5f8e04f 100644
--- a/WebCore/dom/DocumentParser.cpp
+++ b/WebCore/dom/DocumentParser.cpp
@@ -32,6 +32,7 @@ namespace WebCore {
 
 DocumentParser::DocumentParser(Document* document)
     : m_state(ParsingState)
+    , m_documentWasLoadedAsPartOfNavigation(false)
     , m_document(document)
 {
     ASSERT(document);
diff --git a/WebCore/dom/DocumentParser.h b/WebCore/dom/DocumentParser.h
index 7cc9e7b..aa18a64 100644
--- a/WebCore/dom/DocumentParser.h
+++ b/WebCore/dom/DocumentParser.h
@@ -88,6 +88,9 @@ public:
     // detach is called.
     virtual void detach();
 
+    void setDocumentWasLoadedAsPartOfNavigation() { m_documentWasLoadedAsPartOfNavigation = true; }
+    bool documentWasLoadedAsPartOfNavigation() const { return m_documentWasLoadedAsPartOfNavigation; }
+
 protected:
     DocumentParser(Document*);
 
@@ -99,6 +102,7 @@ private:
         DetachedState
     };
     ParserState m_state;
+    bool m_documentWasLoadedAsPartOfNavigation;
 
     // Every DocumentParser needs a pointer back to the document.
     // m_document will be 0 after the parser is stopped.
diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp
index 5539072..c01a57e 100644
--- a/WebCore/dom/XMLDocumentParserLibxml2.cpp
+++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp
@@ -38,7 +38,9 @@
 #include "FrameLoader.h"
 #include "FrameView.h"
 #include "HTMLEntityParser.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLLinkElement.h"
+#include "HTMLNames.h"
 #include "HTMLStyleElement.h"
 #include "ProcessingInstruction.h"
 #include "ResourceError.h"
@@ -825,6 +827,11 @@ void XMLDocumentParser::startElementNs(const xmlChar* xmlLocalName, const xmlCha
     if (m_view && !newElement->attached())
         newElement->attach();
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    if (newElement->hasTagName(HTMLNames::htmlTag))
+        static_cast<HTMLHtmlElement*>(newElement.get())->insertedByParser();
+#endif
+
     if (!m_parsingFragment && isFirstElement && document()->frame())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
 }
diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp
index 75a20be..03b083e 100644
--- a/WebCore/dom/XMLDocumentParserQt.cpp
+++ b/WebCore/dom/XMLDocumentParserQt.cpp
@@ -37,7 +37,9 @@
 #include "FrameLoader.h"
 #include "FrameView.h"
 #include "HTMLEntityParser.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLLinkElement.h"
+#include "HTMLNames.h"
 #include "HTMLStyleElement.h"
 #include "ProcessingInstruction.h"
 #include "ResourceError.h"
@@ -524,6 +526,11 @@ void XMLDocumentParser::parseStartElement()
     if (m_view && !newElement->attached())
         newElement->attach();
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    if (newElement->hasTagName(HTMLNames::htmlTag))
+        static_cast<HTMLHtmlElement*>(newElement.get())->insertedByParser();
+#endif
+
     if (isFirstElement && document()->frame())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
 }
diff --git a/WebCore/html/HTMLHtmlElement.cpp b/WebCore/html/HTMLHtmlElement.cpp
index 6007805..59c0d3e 100644
--- a/WebCore/html/HTMLHtmlElement.cpp
+++ b/WebCore/html/HTMLHtmlElement.cpp
@@ -27,6 +27,7 @@
 #include "ApplicationCacheHost.h"
 #include "Document.h"
 #include "DocumentLoader.h"
+#include "DocumentParser.h"
 #include "Frame.h"
 #include "HTMLNames.h"
 
@@ -56,11 +57,10 @@ bool HTMLHtmlElement::isURLAttribute(Attribute* attribute) const
 }
 
 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
-void HTMLHtmlElement::insertedIntoDocument()
+void HTMLHtmlElement::insertedByParser()
 {
-    HTMLElement::insertedIntoDocument();
-    
-    if (!document()->parsing())
+    // When parsing a fragment, its dummy document has a null parser.
+    if (!document()->parser() || !document()->parser()->documentWasLoadedAsPartOfNavigation())
         return;
 
     if (!document()->frame())
@@ -70,12 +70,8 @@ void HTMLHtmlElement::insertedIntoDocument()
     if (!documentLoader)
         return;
 
-    // Check the manifest attribute
-    // FIXME: Revisit this when we get a clarification from whatwg on how to handle empty
-    // manifest attributes. As spec'd, and coded here, the system will initiate an update
-    // passing in the document URL as the manifest URL. That's not a good thing.
     const AtomicString& manifest = getAttribute(manifestAttr);
-    if (manifest.isNull())
+    if (manifest.isEmpty())
         documentLoader->applicationCacheHost()->selectCacheWithoutManifest();
     else
         documentLoader->applicationCacheHost()->selectCacheWithManifest(document()->completeURL(manifest));
diff --git a/WebCore/html/HTMLHtmlElement.h b/WebCore/html/HTMLHtmlElement.h
index 47503f7..9cad44e 100644
--- a/WebCore/html/HTMLHtmlElement.h
+++ b/WebCore/html/HTMLHtmlElement.h
@@ -33,14 +33,14 @@ public:
     static PassRefPtr<HTMLHtmlElement> create(Document*);
     static PassRefPtr<HTMLHtmlElement> create(const QualifiedName&, Document*);
 
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    void insertedByParser();
+#endif
+
 private:
     HTMLHtmlElement(const QualifiedName&, Document*);
 
     virtual bool isURLAttribute(Attribute*) const;
-
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    virtual void insertedIntoDocument();
-#endif
 };
 
 } // namespace
diff --git a/WebCore/html/ImageDocument.cpp b/WebCore/html/ImageDocument.cpp
index db53837..6361f43 100644
--- a/WebCore/html/ImageDocument.cpp
+++ b/WebCore/html/ImageDocument.cpp
@@ -32,6 +32,7 @@
 #include "Frame.h"
 #include "FrameLoaderClient.h"
 #include "FrameView.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLImageElement.h"
 #include "HTMLNames.h"
 #include "LocalizedStrings.h"
@@ -194,6 +195,9 @@ void ImageDocument::createDocumentStructure()
     
     RefPtr<Element> rootElement = Document::createElement(htmlTag, false);
     appendChild(rootElement, ec);
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
+#endif
 
     if (frame() && frame()->loader())
         frame()->loader()->dispatchDocumentElementAvailable();
diff --git a/WebCore/html/MediaDocument.cpp b/WebCore/html/MediaDocument.cpp
index 875141b..c4f0b14 100644
--- a/WebCore/html/MediaDocument.cpp
+++ b/WebCore/html/MediaDocument.cpp
@@ -33,6 +33,7 @@
 #include "Frame.h"
 #include "FrameLoaderClient.h"
 #include "HTMLEmbedElement.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLNames.h"
 #include "HTMLVideoElement.h"
 #include "KeyboardEvent.h"
@@ -71,6 +72,9 @@ void MediaDocumentParser::createDocumentStructure()
     ExceptionCode ec;
     RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
     document()->appendChild(rootElement, ec);
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
+#endif
 
     if (document()->frame())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
diff --git a/WebCore/html/PluginDocument.cpp b/WebCore/html/PluginDocument.cpp
index ee51b23..a7537fb 100644
--- a/WebCore/html/PluginDocument.cpp
+++ b/WebCore/html/PluginDocument.cpp
@@ -29,6 +29,7 @@
 #include "Frame.h"
 #include "FrameLoaderClient.h"
 #include "HTMLEmbedElement.h"
+#include "HTMLHtmlElement.h"
 #include "HTMLNames.h"
 #include "MainResourceLoader.h"
 #include "Page.h"
@@ -83,6 +84,9 @@ void PluginDocumentParser::createDocumentStructure()
     ExceptionCode ec;
     RefPtr<Element> rootElement = document()->createElement(htmlTag, false);
     document()->appendChild(rootElement, ec);
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    static_cast<HTMLHtmlElement*>(rootElement.get())->insertedByParser();
+#endif
 
     if (document()->frame() && document()->frame()->loader())
         document()->frame()->loader()->dispatchDocumentElementAvailable();
diff --git a/WebCore/html/parser/HTMLConstructionSite.cpp b/WebCore/html/parser/HTMLConstructionSite.cpp
index 6215bba..7201ac7 100644
--- a/WebCore/html/parser/HTMLConstructionSite.cpp
+++ b/WebCore/html/parser/HTMLConstructionSite.cpp
@@ -168,9 +168,12 @@ void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded()
 
 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken& token)
 {
-    RefPtr<Element> element = HTMLHtmlElement::create(m_document);
+    RefPtr<HTMLHtmlElement> element = HTMLHtmlElement::create(m_document);
     element->setAttributeMap(token.takeAtributes(), m_fragmentScriptingPermission);
-    m_openElements.pushHTMLHtmlElement(attach(m_document, element.release()));
+    m_openElements.pushHTMLHtmlElement(attach<Element>(m_document, element.get()));
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    element->insertedByParser();
+#endif
     dispatchDocumentElementAvailableIfNeeded();
 }
 
@@ -234,13 +237,6 @@ PassRefPtr<Element> HTMLConstructionSite::attachToCurrent(PassRefPtr<Element> ch
     return attach(currentElement(), child);
 }
 
-void HTMLConstructionSite::insertHTMLHtmlElement(AtomicHTMLToken& token)
-{
-    ASSERT(!shouldFosterParent());
-    m_openElements.pushHTMLHtmlElement(attachToCurrent(createHTMLElement(token)));
-    dispatchDocumentElementAvailableIfNeeded();
-}
-
 void HTMLConstructionSite::insertHTMLHeadElement(AtomicHTMLToken& token)
 {
     ASSERT(!shouldFosterParent());
diff --git a/WebCore/html/parser/HTMLConstructionSite.h b/WebCore/html/parser/HTMLConstructionSite.h
index 6bed6a7..8b09bf5 100644
--- a/WebCore/html/parser/HTMLConstructionSite.h
+++ b/WebCore/html/parser/HTMLConstructionSite.h
@@ -54,7 +54,6 @@ public:
     void insertHTMLElement(AtomicHTMLToken&);
     void insertSelfClosingHTMLElement(AtomicHTMLToken&);
     void insertFormattingElement(AtomicHTMLToken&);
-    void insertHTMLHtmlElement(AtomicHTMLToken&);
     void insertHTMLHeadElement(AtomicHTMLToken&);
     void insertHTMLBodyElement(AtomicHTMLToken&);
     void insertHTMLFormElement(AtomicHTMLToken&, bool isDemoted = false);
diff --git a/WebCore/loader/DocumentWriter.cpp b/WebCore/loader/DocumentWriter.cpp
index cd82d6e..5b03cd7 100644
--- a/WebCore/loader/DocumentWriter.cpp
+++ b/WebCore/loader/DocumentWriter.cpp
@@ -248,4 +248,9 @@ String DocumentWriter::deprecatedFrameEncoding() const
     return m_frame->loader()->url().isEmpty() ? m_encoding : encoding();
 }
 
+void DocumentWriter::setDocumentWasLoadedAsPartOfNavigation()
+{
+    m_frame->document()->parser()->setDocumentWasLoadedAsPartOfNavigation();
+}
+
 } // namespace WebCore
diff --git a/WebCore/loader/DocumentWriter.h b/WebCore/loader/DocumentWriter.h
index 531a632..5fb3dc1 100644
--- a/WebCore/loader/DocumentWriter.h
+++ b/WebCore/loader/DocumentWriter.h
@@ -71,6 +71,8 @@ public:
     TextResourceDecoder* createDecoderIfNeeded();
     void reportDataReceived();
 
+    void setDocumentWasLoadedAsPartOfNavigation();
+
 private:
     PassRefPtr<Document> createDocument(const KURL&);
 
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index e030122..32cf2d1 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -611,6 +611,7 @@ void FrameLoader::clear(bool clearWindowProperties, bool clearScriptObjects, boo
 void FrameLoader::receivedFirstData()
 {
     writer()->begin(m_workingURL, false);
+    writer()->setDocumentWasLoadedAsPartOfNavigation();
 
     dispatchDidCommitLoad();
     dispatchDidClearWindowObjectsInAllWorlds();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list