Closed Bug 370564 Opened 17 years ago Closed 17 years ago

Javascript String Literal Misinterpretation

Categories

(Firefox :: General, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 32618

People

(Reporter: justin, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

The Weather.com object that should appear on the right side of the page doesn't show up. Error console shows that the a JavaScript string isn't terminated. I think it may be that there is embedded HTML strings within the string to be output. I've tried wrapping the section in a <![CDATA[ section, but it doesn't help as "end" is interpreted before the end is actually reached: you'll see the end of the string on the page.

Reproducible: Always

Steps to Reproduce:
1. Add the Weather.com code to your webpage.
2. View it.

Actual Results:  
JavaScript interpretation error and output of some of the code which should not show.

Expected Results:  
The object shows up correctly.
The problem is that the string contains "</script>" without escaping.  Change the / to \/ and it will work correctly.

The HTML parser, not the JavaScript Engine, decides where the script ends, and the HTML parser doesn't know about JavaScript strings.
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
If weather.com gave you that incorrect HTML+JS code, please tell them to fix it.
You need to log in before you can comment on or make changes to this bug.