WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch v7
bug-3905-v7.diff (text/plain), 21.95 KB, created by
David Kilzer (:ddkilzer)
on 2006-03-05 11:03:34 PST
(
hide
)
Description:
Patch v7
Filename:
MIME Type:
Creator:
David Kilzer (:ddkilzer)
Created:
2006-03-05 11:03:34 PST
Size:
21.95 KB
patch
obsolete
>Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 13145) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,44 @@ >+2006-03-05 David Kilzer <ddkilzer@kilzer.net> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=3905 >+ Missing </title> makes page blank >+ >+ * fast/js/exception-linenums-in-html-1-expected.txt: Added. >+ * fast/js/exception-linenums-in-html-1.html: Added. >+ >+ Tests line numbers from HTML source files instead of JavaScript source files >+ which is tested by fast/js/exception-linenums.html. This test does not test >+ changes made for Bug 3905, but was added for better coverage. >+ >+ * fast/js/exception-linenums-in-html-2-expected.txt: Added. >+ * fast/js/exception-linenums-in-html-2.html: Added. >+ >+ Identical to fast/js/exception-linenums-in-html-1.html except that it contains >+ an unclosed <title> tag, which causes the code path for Bug 3905 to be tested. >+ >+ * fast/js/missing-title-end-tag-js-expected.txt: Added. >+ * fast/js/missing-title-end-tag-js.html: Added. >+ >+ While developing a fix for Bug 3905, a state variable (scriptCodeSize) was not >+ reset in the tokenizer causing the next <script></script> tags to contain the >+ entire contents of the document after the open <title> tag. This test case >+ tests for that condition. >+ >+ * fast/tokenizer/missing-title-end-tag-1-expected.checksum: Added. >+ * fast/tokenizer/missing-title-end-tag-1-expected.png: Added. >+ * fast/tokenizer/missing-title-end-tag-1-expected.txt: Added. >+ * fast/tokenizer/missing-title-end-tag-1.html: Added. >+ * fast/tokenizer/missing-title-end-tag-2-expected.checksum: Added. >+ * fast/tokenizer/missing-title-end-tag-2-expected.png: Added. >+ * fast/tokenizer/missing-title-end-tag-2-expected.txt: Added. >+ * fast/tokenizer/missing-title-end-tag-2.html: Added. >+ >+ The first test case contains an unclosed <title> tag in <head>, while the >+ second test case contains an unclosed <title> tag in <body>. These two test >+ cases result in different code paths being taken. >+ > 2006-03-05 Alexander Kellett <lypanov@kde.org> > > Reviewed by Eric. >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.txt >=================================================================== >--- LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.txt (revision 0) >+++ LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.txt (revision 0) >@@ -0,0 +1,15 @@ >+layer at (0,0) size 800x600 >+ RenderCanvas at (0,0) size 800x600 >+layer at (0,0) size 800x600 >+ RenderBlock {HTML} at (0,0) size 800x600 >+ RenderBody {BODY} at (8,8) size 784x584 >+ RenderBlock {DIV} at (0,0) size 784x36 >+ RenderText {TEXT} at (0,0) size 775x36 >+ text run at (0,0) width 328: "This document is missing its </title> tag in its body. " >+ text run at (328,0) width 447: "The tokenizer should retokenize this document after consuming all of it" >+ text run at (0,18) width 504: "looking for the missing end tag, then let the parser clean up the missing tag. See " >+ RenderInline {A} at (0,0) size 120x18 [color=#0000EE] >+ RenderText {TEXT} at (504,18) size 120x18 >+ text run at (504,18) width 120: "Bugzilla Bug 3905" >+ RenderText {TEXT} at (624,18) size 4x18 >+ text run at (624,18) width 4: "." >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.png >=================================================================== >Cannot display: file marked as a binary type. >svn:mime-type = image/png > >Property changes on: LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.png >___________________________________________________________________ >Name: svn:mime-type > + image/png > >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-2.html >=================================================================== >--- LayoutTests/fast/tokenizer/missing-title-end-tag-2.html (revision 0) >+++ LayoutTests/fast/tokenizer/missing-title-end-tag-2.html (revision 0) >@@ -0,0 +1,11 @@ >+<html> >+<head> >+</head> >+<body> >+<title>My title >+<div>This document is missing its </title> tag in its body. The tokenizer should retokenize >+this document after consuming all of it looking for the missing end tag, then let the parser clean >+up the missing tag. >+See <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3905">Bugzilla Bug 3905</a>.</div> >+</body> >+</html> >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.txt >=================================================================== >--- LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.txt (revision 0) >+++ LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.txt (revision 0) >@@ -0,0 +1,15 @@ >+layer at (0,0) size 800x600 >+ RenderCanvas at (0,0) size 800x600 >+layer at (0,0) size 800x52 >+ RenderBlock {HTML} at (0,0) size 800x52 >+ RenderBody {BODY} at (8,8) size 784x36 >+ RenderBlock {DIV} at (0,0) size 784x36 >+ RenderText {TEXT} at (0,0) size 773x36 >+ text run at (0,0) width 326: "This document is missing its </title> tag in its head. " >+ text run at (326,0) width 447: "The tokenizer should retokenize this document after consuming all of it" >+ text run at (0,18) width 504: "looking for the missing end tag, then let the parser clean up the missing tag. See " >+ RenderInline {A} at (0,0) size 120x18 [color=#0000EE] >+ RenderText {TEXT} at (504,18) size 120x18 >+ text run at (504,18) width 120: "Bugzilla Bug 3905" >+ RenderText {TEXT} at (624,18) size 4x18 >+ text run at (624,18) width 4: "." >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.png >=================================================================== >Cannot display: file marked as a binary type. >svn:mime-type = image/png > >Property changes on: LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.png >___________________________________________________________________ >Name: svn:mime-type > + image/png > >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.checksum >=================================================================== >--- LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.checksum (revision 0) >+++ LayoutTests/fast/tokenizer/missing-title-end-tag-1-expected.checksum (revision 0) >@@ -0,0 +1 @@ >+79206c9379d2ae0510a021d9763852c4 >\ No newline at end of file >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.checksum >=================================================================== >--- LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.checksum (revision 0) >+++ LayoutTests/fast/tokenizer/missing-title-end-tag-2-expected.checksum (revision 0) >@@ -0,0 +1 @@ >+79acee9455a27401b647f0266bc88ec1 >\ No newline at end of file >Index: LayoutTests/fast/tokenizer/missing-title-end-tag-1.html >=================================================================== >--- LayoutTests/fast/tokenizer/missing-title-end-tag-1.html (revision 0) >+++ LayoutTests/fast/tokenizer/missing-title-end-tag-1.html (revision 0) >@@ -0,0 +1,11 @@ >+<html> >+<head> >+<title>My title >+</head> >+<body> >+<div>This document is missing its </title> tag in its head. The tokenizer should retokenize >+this document after consuming all of it looking for the missing end tag, then let the parser clean >+up the missing tag. >+See <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3905">Bugzilla Bug 3905</a>.</div> >+</body> >+</html> >Index: LayoutTests/fast/js/exception-linenums-in-html-2.html >=================================================================== >--- LayoutTests/fast/js/exception-linenums-in-html-2.html (revision 0) >+++ LayoutTests/fast/js/exception-linenums-in-html-2.html (revision 0) >@@ -0,0 +1,73 @@ >+<html> >+<head><title>title >+<link rel="stylesheet" href="resources/js-test-style.css"> >+<script src="resources/js-test-pre.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+description('This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console. It differs from <span style="font-family: monospace;">exception-linenums-in-html-1.html</span> in that it only works if <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3905">Bugzilla Bug 3905</a> has been fixed.'); >+ >+function exceptionInFunction() >+{ >+ throw Exception(); >+} >+ >+var e = undefined; >+ >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTION >+ document.documentElement.innerHTML(foo); >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '21'); >+ >+e = undefined; >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONVALUE >+ document.documentElement.appendChild('').prefix = ''; >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '31'); >+ >+e = undefined; >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONREFERENCE >+ document.documentElement.appendChild('').innerHTML = ''; >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '41'); >+ >+e = undefined; >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONLIST >+ document.getElementById(1()); >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '51'); >+ >+e = undefined; >+// Raises an exception inside a function to check that its line number >+// isn't overwritten in the assignment node. >+try { >+ var a = exceptionInFunction(); >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '14'); >+ >+var successfullyParsed = true; >+</script> >+<script src="resources/js-test-post.js"></script> >+</body> >+</html> >Index: LayoutTests/fast/js/missing-title-end-tag-js-expected.txt >=================================================================== >--- LayoutTests/fast/js/missing-title-end-tag-js-expected.txt (revision 0) >+++ LayoutTests/fast/js/missing-title-end-tag-js-expected.txt (revision 0) >@@ -0,0 +1,9 @@ >+This test checks that the first <script> tag after an unclosed <title> tag is parsed correctly. Early versions of the patch for Bugzilla Bug 3905 did not reset a state variable properly, causing the first <script></script> tag in the document to contain everything after the <title> tag. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: LayoutTests/fast/js/missing-title-end-tag-js.html >=================================================================== >--- LayoutTests/fast/js/missing-title-end-tag-js.html (revision 0) >+++ LayoutTests/fast/js/missing-title-end-tag-js.html (revision 0) >@@ -0,0 +1,17 @@ >+<html> >+<head><title>title >+<link rel="stylesheet" href="resources/js-test-style.css"> >+<script> >+ var successfullyParsed = true; >+</script> >+<script src="resources/js-test-pre.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+description('This test checks that the first <script> tag after an unclosed <title> tag is parsed correctly. Early versions of the patch for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=3905">Bugzilla Bug 3905</a> did not reset a state variable properly, causing the first <script></script> tag in the document to contain everything after the <title> tag.'); >+</script> >+<script src="resources/js-test-post.js"></script> >+</body> >+</html> >Index: LayoutTests/fast/js/exception-linenums-in-html-1-expected.txt >=================================================================== >--- LayoutTests/fast/js/exception-linenums-in-html-1-expected.txt (revision 0) >+++ LayoutTests/fast/js/exception-linenums-in-html-1-expected.txt (revision 0) >@@ -0,0 +1,19 @@ >+This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console. It differs from exception-linenums.html in that the line numbers are derived from within the HTML source, not a JavaScript source file. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS typeof e.sourceURL is "string" >+PASS e.line is 21 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 31 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 41 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 51 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 14 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: LayoutTests/fast/js/exception-linenums-in-html-1.html >=================================================================== >--- LayoutTests/fast/js/exception-linenums-in-html-1.html (revision 0) >+++ LayoutTests/fast/js/exception-linenums-in-html-1.html (revision 0) >@@ -0,0 +1,73 @@ >+<html> >+<head> >+<link rel="stylesheet" href="resources/js-test-style.css"> >+<script src="resources/js-test-pre.js"></script> >+</head> >+<body> >+<p id="description"></p> >+<div id="console"></div> >+<script> >+description('This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console. It differs from <span style="font-family: monospace;">exception-linenums.html</span> in that the line numbers are derived from within the HTML source, not a JavaScript source file.'); >+ >+function exceptionInFunction() >+{ >+ throw Exception(); >+} >+ >+var e = undefined; >+ >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTION >+ document.documentElement.innerHTML(foo); >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '21'); >+ >+e = undefined; >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONVALUE >+ document.documentElement.appendChild('').prefix = ''; >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '31'); >+ >+e = undefined; >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONREFERENCE >+ document.documentElement.appendChild('').innerHTML = ''; >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '41'); >+ >+e = undefined; >+try { >+ // Raises an exception that gets picked up by KJS_CHECKEXCEPTIONLIST >+ document.getElementById(1()); >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '51'); >+ >+e = undefined; >+// Raises an exception inside a function to check that its line number >+// isn't overwritten in the assignment node. >+try { >+ var a = exceptionInFunction(); >+} catch (exception) { >+ e = exception; >+} >+shouldBe("typeof e.sourceURL", '"string"'); >+shouldBe("e.line", '14'); >+ >+var successfullyParsed = true; >+</script> >+<script src="resources/js-test-post.js"></script> >+</body> >+</html> >Index: LayoutTests/fast/js/exception-linenums-in-html-2-expected.txt >=================================================================== >--- LayoutTests/fast/js/exception-linenums-in-html-2-expected.txt (revision 0) >+++ LayoutTests/fast/js/exception-linenums-in-html-2-expected.txt (revision 0) >@@ -0,0 +1,19 @@ >+This test exercises the source URL and line number that is embedded in JavaScript exceptions, which is displayed in places like the JavaScript console. It differs from exception-linenums-in-html-1.html in that it only works if Bugzilla Bug 3905 has been fixed. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS typeof e.sourceURL is "string" >+PASS e.line is 21 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 31 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 41 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 51 >+PASS typeof e.sourceURL is "string" >+PASS e.line is 14 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >Index: WebCore/khtml/html/htmlparser.cpp >=================================================================== >--- WebCore/khtml/html/htmlparser.cpp (revision 13133) >+++ WebCore/khtml/html/htmlparser.cpp (working copy) >@@ -470,6 +470,9 @@ bool HTMLParser::handleError(NodeImpl* n > handled = true; > } > } >+ } else if (h->hasLocalName(titleTag)) { >+ popBlock(currentTagName); >+ handled = true; > } else if (h->hasLocalName(captionTag)) { > // Illegal content in a caption. Close the caption and try again. > popBlock(currentTagName); >Index: WebCore/khtml/html/htmltokenizer.cpp >=================================================================== >--- WebCore/khtml/html/htmltokenizer.cpp (revision 13133) >+++ WebCore/khtml/html/htmltokenizer.cpp (working copy) >@@ -1264,11 +1264,23 @@ HTMLTokenizer::State HTMLTokenizer::pars > state = parseSpecial(src, state); > } > } else if (tagName == titleTag) { >- if (beginTag) { >+ if (beginTag) { > searchStopper = titleEnd; > searchStopperLen = 7; >+ State savedState = state; >+ SegmentedString savedSrc = src; >+ long savedLineno = lineno; > state.setInTitle(true); > state = parseSpecial(src, state); >+ if (state.inTitle() && src.isEmpty()) { >+ // We just ate the rest of the document as the title #text node! >+ // Reset the state then retokenize without special title handling. >+ // Let the html parser clean up the missing </title> tag. >+ state = savedState; >+ src = savedSrc; >+ lineno = savedLineno; >+ scriptCodeSize = 0; >+ } > } > } else if (tagName == xmpTag) { > if (beginTag) { >Index: WebCore/platform/SegmentedString.cpp >=================================================================== >--- WebCore/platform/SegmentedString.cpp (revision 13133) >+++ WebCore/platform/SegmentedString.cpp (working copy) >@@ -24,6 +24,35 @@ > > namespace WebCore { > >+SegmentedString::SegmentedString(const SegmentedString &other) : >+ m_pushedChar1(other.m_pushedChar1), m_pushedChar2(other.m_pushedChar2), m_currentString(other.m_currentString), >+ m_substrings(other.m_substrings), m_lines(other.m_lines), m_composite(other.m_composite) >+{ >+ if (other.m_currentChar == &other.m_pushedChar1) >+ m_currentChar = &m_pushedChar1; >+ else if (other.m_currentChar == &other.m_pushedChar2) >+ m_currentChar = &m_pushedChar2; >+ else >+ m_currentChar = other.m_currentChar; >+} >+ >+const SegmentedString& SegmentedString::operator=(const SegmentedString &other) >+{ >+ m_pushedChar1 = other.m_pushedChar1; >+ m_pushedChar2 = other.m_pushedChar2; >+ m_currentString = other.m_currentString; >+ m_substrings = other.m_substrings; >+ m_lines = other.m_lines; >+ m_composite = other.m_composite; >+ if (other.m_currentChar == &other.m_pushedChar1) >+ m_currentChar = &m_pushedChar1; >+ else if (other.m_currentChar == &other.m_pushedChar2) >+ m_currentChar = &m_pushedChar2; >+ else >+ m_currentChar = other.m_currentChar; >+ return *this; >+} >+ > uint SegmentedString::length() const > { > uint length = m_currentString.m_length; >Index: WebCore/platform/SegmentedString.h >=================================================================== >--- WebCore/platform/SegmentedString.h (revision 13133) >+++ WebCore/platform/SegmentedString.h (working copy) >@@ -73,6 +73,9 @@ public: > SegmentedString() : m_currentChar(0), m_lines(0), m_composite(false) {} > SegmentedString(const QChar *str, int length) : m_currentString(str, length), m_currentChar(m_currentString.m_current), m_lines(0), m_composite(false) {} > SegmentedString(const QString &str) : m_currentString(str), m_currentChar(m_currentString.m_current), m_lines(0), m_composite(false) {} >+ SegmentedString(const SegmentedString&); >+ >+ const SegmentedString& operator=(const SegmentedString&); > > void clear(); > >Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 13145) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,32 @@ >+2006-03-05 David Kilzer <ddkilzer@kilzer.net> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=3905 >+ Missing </title> makes page blank >+ >+ Test: fast/js/exception-linenums-in-html-1.html >+ Test: fast/js/exception-linenums-in-html-2.html >+ Test: fast/js/missing-title-end-tag-js.html >+ Test: fast/tokenizer/missing-title-end-tag-1.html >+ Test: fast/tokenizer/missing-title-end-tag-2.html >+ >+ * khtml/html/htmlparser.cpp: >+ (WebCore::HTMLParser::handleError): Add check for missing </title> tag and handle >+ this condition if identified. >+ * khtml/html/htmltokenizer.cpp: >+ (WebCore::HTMLTokenizer::parseTag): If parseSpecial() consumes the rest of the >+ document looking for a </title> tag, reset the state of the tokenizer and >+ retokenize with no special handling for <title>. The parser will handle the >+ missing </title> tag in HTMLParser::handleError(). >+ * platform/SegmentedString.cpp: >+ (WebCore::SegmentedString::SegmentedString): Added copy constructor. >+ (WebCore::SegmentedString::operator=): Added assignment operator. Previously the >+ compiler was generating a default method for the assignment operator, but it did >+ not handle m_currentChar properly. >+ * platform/SegmentedString.h: Added prototypes for copy constructor and >+ assignment operator. >+ > 2006-03-05 Eric Seidel <eseidel@apple.com> > > Move improperly placed #endif causing no-svg build to fail.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 3905
:
2867
|
6730
|
6732
|
6733
|
6734
|
6741
|
6753
|
6769
|
6773
|
6820
| 6873