[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
aestes at apple.com
aestes at apple.com
Wed Dec 22 13:40:39 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f8ad7c72de57dd6e4b66fdc429a7669ac076c6d0
Author: aestes at apple.com <aestes at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Sep 23 02:39:21 2010 +0000
2010-09-22 Andy Estes <aestes at apple.com>
Reviewed by Adam Barth.
REGRESSION (r61285): <script /> parses differently in HTML5
https://bugs.webkit.org/show_bug.cgi?id=42909
If pre-HTML5 parser quirks are enabled, the HTMLTreeBuilder should
handle self-closing script tags like the old parser did. Specifically,
"<script />" should be treated as "<script></script>".
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::HTMLDocumentParser): Instantiate
HTMLTreeBuilder with the value of usePreHTML5ParserQuirks().
* html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::HTMLTreeBuilder):
(WebCore::HTMLTreeBuilder::processEndTag): If the tokenizer is not
currently in DataState, this means that the current end token is fake
and was created by the tree builder to handle a self-closing script tag.
Assert that pre-HTML5 quirks are enabled and set the tokenizer's state
to DataState in this case.
(WebCore::HTMLTreeBuilder::processStartTagForInHead): If pre-HTML5
parser quirks are enabled and the script tag is self-closing, create and
procses a fake script end tag.
* html/parser/HTMLTreeBuilder.h:
(WebCore::HTMLTreeBuilder::create):
2010-09-22 Andy Estes <aestes at apple.com>
Reviewed by Adam Barth.
REGRESSION (r61285): <script /> parses differently in HTML5
https://bugs.webkit.org/show_bug.cgi?id=42909
Add tests for the self-closing script tag quirk.
* fast/parser/pre-html5-parser-quirks-expected.txt:
* fast/parser/pre-html5-parser-quirks.html:
* fast/parser/resources/pre-html5-parser-quirk-document-fragment.html:
* fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-body.html: Added.
* fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-head.html: Added.
* fast/parser/resources/pre-html5-parser-quirk-self-closing-script.js: Added.
(printToConsole):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68115 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 9b4fa2c..02601ed 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-22 Andy Estes <aestes at apple.com>
+
+ Reviewed by Adam Barth.
+
+ REGRESSION (r61285): <script /> parses differently in HTML5
+ https://bugs.webkit.org/show_bug.cgi?id=42909
+
+ Add tests for the self-closing script tag quirk.
+
+ * fast/parser/pre-html5-parser-quirks-expected.txt:
+ * fast/parser/pre-html5-parser-quirks.html:
+ * fast/parser/resources/pre-html5-parser-quirk-document-fragment.html:
+ * fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-body.html: Added.
+ * fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-head.html: Added.
+ * fast/parser/resources/pre-html5-parser-quirk-self-closing-script.js: Added.
+ (printToConsole):
+
2010-09-22 Mihai Parparita <mihaip at chromium.org>
Reviewed by Darin Fisher.
diff --git a/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt b/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt
index 32450fa..5bccd1c 100644
--- a/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt
+++ b/LayoutTests/fast/parser/pre-html5-parser-quirks-expected.txt
@@ -1,6 +1,6 @@
-This tests that certain pre-HTML5 parser rules are applied when the WebKitUsePreHTML5ParserQuirks preference is set. See https://webkit.org/b/40961 for details.
+This tests that certain pre-HTML5 parser rules are applied when the WebKitUsePreHTML5ParserQuirks preference is set. See https://webkit.org/b/40961 and https://webkit.org/b/42909 for details.
-
+
--------
Frame: '<!--framePath //<!--frame0-->-->'
@@ -45,6 +45,8 @@ Frame: '<!--framePath //<!--frame5-->-->'
Document fragment:
Start Tag: PASS
End Tag: PASS
+<script />: PASS
+<script/>: PASS
--------
@@ -53,3 +55,17 @@ Frame: '<!--framePath //<!--frame6-->-->'
TagNameState:
Start Tag: PASS
End Tag: PASS
+
+--------
+Frame: '<!--framePath //<!--frame7-->-->'
+--------
+Self-closing <script> in head:
+Parsing: PASS
+External script loading: PASS
+
+--------
+Frame: '<!--framePath //<!--frame8-->-->'
+--------
+Self-closing <script> in body:
+Parsing: PASS
+External script loading: PASS
diff --git a/LayoutTests/fast/parser/pre-html5-parser-quirks.html b/LayoutTests/fast/parser/pre-html5-parser-quirks.html
index 6ff9ca9..ae21de5 100644
--- a/LayoutTests/fast/parser/pre-html5-parser-quirks.html
+++ b/LayoutTests/fast/parser/pre-html5-parser-quirks.html
@@ -6,7 +6,7 @@
}
</script>
-<p>This tests that certain pre-HTML5 parser rules are applied when the WebKitUsePreHTML5ParserQuirks preference is set. See <a href="https://webkit.org/b/40961">https://webkit.org/b/40961</a> for details.</p>
+<p>This tests that certain pre-HTML5 parser rules are applied when the WebKitUsePreHTML5ParserQuirks preference is set. See <a href="https://webkit.org/b/40961">https://webkit.org/b/40961</a> and <a href="https://webkit.org/b/42909">https://webkit.org/b/42909</a> for details.</p>
<iframe src="resources/pre-html5-parser-quirk-after-attribute-name-state.html"></iframe>
<iframe src="resources/pre-html5-parser-quirk-after-attribute-value-quoted-state.html"></iframe>
@@ -15,4 +15,6 @@
<iframe src="resources/pre-html5-parser-quirk-before-attribute-name-state.html"></iframe>
<iframe src="resources/pre-html5-parser-quirk-document-fragment.html"></iframe>
<iframe src="resources/pre-html5-parser-quirk-tag-name-state.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-self-closing-script-in-head.html"></iframe>
+<iframe src="resources/pre-html5-parser-quirk-self-closing-script-in-body.html"></iframe>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html
index d569550..d6beeb7 100644
--- a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-document-fragment.html
@@ -3,4 +3,6 @@ Document fragment:
<script>
document.getElementById("wrapper").innerHTML += "<div style='visibility:hidden'><p</div>Start Tag: PASS<br>";
document.getElementById("wrapper").innerHTML += "<div style='visibility:hidden'><p></p</div>End Tag: PASS<br>";
+ document.getElementById("wrapper").innerHTML += "<script /><script />: PASS<br>";
+ document.getElementById("wrapper").innerHTML += "<script/><script/>: PASS<br>";
</script>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-body.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-body.html
new file mode 100644
index 0000000..47954c2
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-body.html
@@ -0,0 +1,8 @@
+<html>
+ <body onload="printToConsole()">
+ Self-closing <script> in body:<br>
+ <script src="pre-html5-parser-quirk-self-closing-script.js" />
+ Parsing: PASS
+ <div id="console"></div>
+ </body>
+</html>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-head.html b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-head.html
new file mode 100644
index 0000000..7db3c56
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script-in-head.html
@@ -0,0 +1,10 @@
+<html>
+ <head>
+ <script src="pre-html5-parser-quirk-self-closing-script.js" />
+ </head>
+ <body onload="printToConsole()">
+ Self-closing <script> in head:<br>
+ Parsing: PASS
+ <div id="console"></div>
+ </body>
+</html>
diff --git a/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script.js b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script.js
new file mode 100644
index 0000000..d4a7342
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/pre-html5-parser-quirk-self-closing-script.js
@@ -0,0 +1,4 @@
+function printToConsole()
+{
+ document.getElementById("console").innerHTML = "External script loading: PASS";
+}
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f764940..691316d 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-09-22 Andy Estes <aestes at apple.com>
+
+ Reviewed by Adam Barth.
+
+ REGRESSION (r61285): <script /> parses differently in HTML5
+ https://bugs.webkit.org/show_bug.cgi?id=42909
+
+ If pre-HTML5 parser quirks are enabled, the HTMLTreeBuilder should
+ handle self-closing script tags like the old parser did. Specifically,
+ "<script />" should be treated as "<script></script>".
+
+ * html/parser/HTMLDocumentParser.cpp:
+ (WebCore::HTMLDocumentParser::HTMLDocumentParser): Instantiate
+ HTMLTreeBuilder with the value of usePreHTML5ParserQuirks().
+ * html/parser/HTMLTreeBuilder.cpp:
+ (WebCore::HTMLTreeBuilder::HTMLTreeBuilder):
+ (WebCore::HTMLTreeBuilder::processEndTag): If the tokenizer is not
+ currently in DataState, this means that the current end token is fake
+ and was created by the tree builder to handle a self-closing script tag.
+ Assert that pre-HTML5 quirks are enabled and set the tokenizer's state
+ to DataState in this case.
+ (WebCore::HTMLTreeBuilder::processStartTagForInHead): If pre-HTML5
+ parser quirks are enabled and the script tag is self-closing, create and
+ procses a fake script end tag.
+ * html/parser/HTMLTreeBuilder.h:
+ (WebCore::HTMLTreeBuilder::create):
+
2010-09-22 Mihai Parparita <mihaip at chromium.org>
Reviewed by Darin Fisher.
diff --git a/WebCore/html/parser/HTMLDocumentParser.cpp b/WebCore/html/parser/HTMLDocumentParser.cpp
index 477c761..630b6aa 100644
--- a/WebCore/html/parser/HTMLDocumentParser.cpp
+++ b/WebCore/html/parser/HTMLDocumentParser.cpp
@@ -82,7 +82,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
: ScriptableDocumentParser(document)
, m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(document)))
, m_scriptRunner(HTMLScriptRunner::create(document, this))
- , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), document, reportErrors))
+ , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), document, reportErrors, usePreHTML5ParserQuirks(document)))
, m_parserScheduler(HTMLParserScheduler::create(this))
, m_endWasDelayed(false)
, m_writeNestingLevel(0)
@@ -94,7 +94,7 @@ HTMLDocumentParser::HTMLDocumentParser(HTMLDocument* document, bool reportErrors
HTMLDocumentParser::HTMLDocumentParser(DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission)
: ScriptableDocumentParser(fragment->document())
, m_tokenizer(HTMLTokenizer::create(usePreHTML5ParserQuirks(fragment->document())))
- , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), fragment, contextElement, scriptingPermission))
+ , m_treeBuilder(HTMLTreeBuilder::create(m_tokenizer.get(), fragment, contextElement, scriptingPermission, usePreHTML5ParserQuirks(fragment->document())))
, m_endWasDelayed(false)
, m_writeNestingLevel(0)
{
diff --git a/WebCore/html/parser/HTMLTreeBuilder.cpp b/WebCore/html/parser/HTMLTreeBuilder.cpp
index afac2a0..402ee80 100644
--- a/WebCore/html/parser/HTMLTreeBuilder.cpp
+++ b/WebCore/html/parser/HTMLTreeBuilder.cpp
@@ -323,7 +323,7 @@ private:
};
-HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors)
+HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks)
: m_framesetOk(true)
, m_document(document)
, m_tree(document, FragmentScriptingAllowed, false)
@@ -335,12 +335,13 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, HTMLDocument* documen
, m_tokenizer(tokenizer)
, m_scriptToProcessStartLine(uninitializedLineNumberValue)
, m_lastScriptElementStartLine(uninitializedLineNumberValue)
+ , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks)
{
}
// FIXME: Member variables should be grouped into self-initializing structs to
// minimize code duplication between these constructors.
-HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission)
+HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission, bool usePreHTML5ParserQuirks)
: m_framesetOk(true)
, m_fragmentContext(fragment, contextElement, scriptingPermission)
, m_document(m_fragmentContext.document())
@@ -353,6 +354,7 @@ HTMLTreeBuilder::HTMLTreeBuilder(HTMLTokenizer* tokenizer, DocumentFragment* fra
, m_tokenizer(tokenizer)
, m_scriptToProcessStartLine(uninitializedLineNumberValue)
, m_lastScriptElementStartLine(uninitializedLineNumberValue)
+ , m_usePreHTML5ParserQuirks(usePreHTML5ParserQuirks)
{
if (contextElement) {
// Steps 4.2-4.6 of the HTML5 Fragment Case parsing algorithm:
@@ -2204,6 +2206,13 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
if (isParsingFragment() && m_fragmentContext.scriptingPermission() == FragmentScriptingNotAllowed)
m_scriptToProcess->removeAllChildren();
setInsertionMode(m_originalInsertionMode);
+
+ // This token will not have been created by the tokenizer if a
+ // self-closing script tag was encountered and pre-HTML5 parser
+ // quirks are enabled. We must set the tokenizer's state to
+ // DataState explicitly since the tokenzier didn't have a chance to.
+ ASSERT(m_tokenizer->state() == HTMLTokenizer::DataState || m_usePreHTML5ParserQuirks);
+ m_tokenizer->setState(HTMLTokenizer::DataState);
return;
}
m_tree.openElements()->pop();
@@ -2706,6 +2715,8 @@ bool HTMLTreeBuilder::processStartTagForInHead(AtomicHTMLToken& token)
}
if (token.name() == scriptTag) {
processScriptStartTag(token);
+ if (m_usePreHTML5ParserQuirks && token.selfClosing())
+ processFakeEndTag(scriptTag);
return true;
}
if (token.name() == headTag) {
diff --git a/WebCore/html/parser/HTMLTreeBuilder.h b/WebCore/html/parser/HTMLTreeBuilder.h
index d522ea8..e61fe73 100644
--- a/WebCore/html/parser/HTMLTreeBuilder.h
+++ b/WebCore/html/parser/HTMLTreeBuilder.h
@@ -51,13 +51,13 @@ class Node;
class HTMLTreeBuilder : public Noncopyable {
public:
- static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors)
+ static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, HTMLDocument* document, bool reportErrors, bool usePreHTML5ParserQuirks)
{
- return adoptPtr(new HTMLTreeBuilder(tokenizer, document, reportErrors));
+ return adoptPtr(new HTMLTreeBuilder(tokenizer, document, reportErrors, usePreHTML5ParserQuirks));
}
- static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission)
+ static PassOwnPtr<HTMLTreeBuilder> create(HTMLTokenizer* tokenizer, DocumentFragment* fragment, Element* contextElement, FragmentScriptingPermission scriptingPermission, bool usePreHTML5ParserQuirks)
{
- return adoptPtr(new HTMLTreeBuilder(tokenizer, fragment, contextElement, scriptingPermission));
+ return adoptPtr(new HTMLTreeBuilder(tokenizer, fragment, contextElement, scriptingPermission, usePreHTML5ParserQuirks));
}
~HTMLTreeBuilder();
@@ -110,8 +110,8 @@ private:
AfterAfterFramesetMode,
};
- HTMLTreeBuilder(HTMLTokenizer*, HTMLDocument*, bool reportErrors);
- HTMLTreeBuilder(HTMLTokenizer*, DocumentFragment*, Element* contextElement, FragmentScriptingPermission);
+ HTMLTreeBuilder(HTMLTokenizer*, HTMLDocument*, bool reportErrors, bool usePreHTML5ParserQuirks);
+ HTMLTreeBuilder(HTMLTokenizer*, DocumentFragment*, Element* contextElement, FragmentScriptingPermission, bool usePreHTML5ParserQuirks);
bool isParsingFragment() const { return !!m_fragmentContext.fragment(); }
@@ -252,6 +252,8 @@ private:
// created to service the legacy tree builder, but it seems to be used for
// some other things now.
int m_lastScriptElementStartLine;
+
+ bool m_usePreHTML5ParserQuirks;
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list