Closed Bug 301138 Opened 19 years ago Closed 19 years ago

a page loading with an escaped charector sequence is throwing a javascript error

Categories

(Core :: JavaScript Engine, defect)

PowerPC
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: chris, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.9) Gecko/20050711 Firefox/1.0.5

Javascript is not handling escaped data correctly.

The following page throws the javascript error at the bottom:

Page:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>



<window id="Test" title="PSLD Test"
	xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
	>

	<script>
		expenses=[
			['6','9','0','07/17/2005','07/17/2005','asd','asd','nice &#39; and &quot;
&quot;','Cash','No','$123.12','0']
		];

	</script>

  <vbox>
		<label value="Test"/>

  </vbox>

</window> 


Error:
Error: missing ] after element list
Source File: file:///Volumes/iDisk/Documents/PalomaXUL/****/test.xul
Line: 12, Column: 62
Source Code:
			['6','9','0','07/17/2005','07/17/2005','asd','asd','nice ' and "
"','Cash','No','$123.12','0']

Reproducible: Always

Steps to Reproduce:
1.create the test page listed above
2.open it in firefox
3.

Actual Results:  
The following error is thrown:

Error: missing ] after element list
Source File: file:///Volumes/iDisk/Documents/PalomaXUL/****/test.xul
Line: 12, Column: 62
Source Code:
			['6','9','0','07/17/2005','07/17/2005','asd','asd','nice ' and "
"','Cash','No','$123.12','0']

Expected Results:  
This should load and not throw an error
Since you didn't surround the script with <![CDATA[ ]]>, the entities are
expanded and the string is closed at the corresponding '. Either use CDATA to
surround the script or \ to escape the quotes.

INVALID
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.