Fixes a bug in the view source parsing of text within <script>,
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 May 2008 03:20:44 +0000 (03:20 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 May 2008 03:20:44 +0000 (03:20 +0000)
commit20de4a0e4cb6064b10bec1b0d676963eb71ea690
treeae8a59036fd188c673a56176a351605b34a60123
parentcffbb53eafcd0f85a45db68c4b701929f4c4303a
Fixes a bug in the view source parsing of text within <script>,
<style>, <xmp>, <textarea> and other special tags. The text was
being parsed as HTML and would be syntax highlighted if a "<"
was encountered.

<rdar://problem/5790805> Inspector's source view missing some words,
doubles others in JS source in <script> tag (17752)

Reviewed by Dave Hyatt.

Added test: fast/frames/viewsource-plain-text-tags.html

* html/HTMLTokenizer.cpp:
(WebCore::HTMLTokenizer::scriptHandler): Set scriptCodeSize and
scriptCodeResync to zero before an early return in view source mode.
This was causing text from a previous script tag to show up in
then next style tag.
(WebCore::HTMLTokenizer::parseTag): Enter an if block in view source
mode even if n is null. The n is property guarded in other places
and not used by view source mode. Removes a redundant null check on n.
Add a new null check of n before setting scriptSrcCharset. Other code
in HTMLTokenizer is already guarded for this code path.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@33509 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/fast/frames/resources/viewsource-frame-2.html [new file with mode: 0644]
LayoutTests/fast/frames/viewsource-plain-text-tags-expected.txt [new file with mode: 0644]
LayoutTests/fast/frames/viewsource-plain-text-tags.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLTokenizer.cpp