If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Javascript String Literal Misinterpretation

RESOLVED DUPLICATE of bug 32618

Status

()

Firefox
General
RESOLVED DUPLICATE of bug 32618
11 years ago
11 years ago

People

(Reporter: justin, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(URL)

(Reporter)

Description

11 years ago
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.

Comment 1

11 years ago
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
Last Resolved: 11 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 32618

Comment 2

11 years ago
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.