Closed Bug 290672 Opened 20 years ago Closed 20 years ago

incorrect parsing of script tag

Categories

(Core :: DOM: HTML Parser, defect)

1.0 Branch
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 219504

People

(Reporter: peterk, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.7) Gecko/20050414 Firefox/1.0.3

The following HTML looks wrong in Mozilla:

<HTML>
   <HEAD>
      <TITLE>FTD - Home </TITLE>
      <SCRIPT language="JavaScript">
//<!--
alert("in first Script")
</SCRIPT>
<script language="javascript">
alert("in second Script")
</script>
   </HEAD>
   <BODY>
   </BODY>
</HTML>

Parser is not ignoring "<!--" inside of <script> tag and try to interpret all
scripts from start tag of the first till closing tag of the last as one script.



Reproducible: Always

Steps to Reproduce:
1. open the following html in firefox

 <HTML>
   <HEAD>
      <TITLE>FTD - Home </TITLE>
      <SCRIPT language="JavaScript">
//<!--
alert("in first Script")
</SCRIPT>
<script language="javascript">
alert("in second Script")
</script>
   </HEAD>
   <BODY>
   </BODY>
</HTML>




Actual Results:  
javascript is not executed correctly.

Expected Results:  
javascript alerts

The fix seems to be in "nsHTMLTokenizer.cpp" file while calling to:

textToken->ConsumeUntil(0,theTag != eHTMLTag_script

and it should be replaced to:

textToken->ConsumeUntil(0,theTag == eHTMLTag_script
Summary: incorrect parsing of javascript → incorrect parsing of script tag
Assignee: firefox → parser
Component: General → HTML: Parser
Product: Firefox → Core
QA Contact: general → mrbkap
Version: unspecified → 1.0 Branch
wfm with a current Mozilla build.
mrbkap: Dupe of Bug 219504?
Yeah. This is a dupe of bug 219504.

Peterk, thanks for trying to look into a fix  for this! The reason that we can't
ignore the comment start in <script> is for compatibility with IE. Bug 219504
has more information about the actual fix.

*** This bug has been marked as a duplicate of 219504 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
v
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.