Closed Bug 348332 Opened 18 years ago Closed 12 years ago

e4x related problem while initializing string in a script.

Categories

(Core :: JavaScript Engine, defect)

1.8 Branch
x86
Linux
defect
Not set
major

Tracking

()

RESOLVED WONTFIX

People

(Reporter: vidyab, Unassigned)

References

Details

Attachments

(3 files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6

here is an example of what I experienced.

<script type="application/x-javascript" e4x="1">
var text="<howdy><partner/></howdy>";
</script>

This causes a syntax error at var text="
unterminated string literal error at line 1^


I have this error if I include this script in an xul file. 
While this does not cause a syntax error in an html page.

The e4x behaviour works as expected.

Reproducible: Always

Steps to Reproduce:
look at comments above.
I am using firefox 1.5.0.6 on ubuntu linux 5.10.

Insert the example script segment in an xul file and run it. The javascript console should show the error.


Expected Results:  
var text="<howdy><partner/></howdy>"; 

should initialize the string text.
then I will try to do 

var textXML = new XML(text);

That is when this should become an XML object (or whatever it should be called).
The assignment to the variable should not cause a syntax error

allow the assignment of the string to the variable. This should work in XUL as it does in html pages.
Severity: normal → major
Version: unspecified → 1.5.0.x Branch
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
QA Contact: general → general
Version: 1.5.0.x Branch → 1.8 Branch
What fixed this in the trunk and 1.8 branch?

/be
Whiteboard: DUPEME
If this is an XHTML or XUL page you probably want to wrap the script in <![CDATA[ and ]]> .
dupe of bug 293392

*** This bug has been marked as a duplicate of 293392 ***
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → DUPLICATE
(In reply to comment #3)

I was wrong to mark this a dupe. Jesse is right that if you wrap the script contents in CDATA the script will work in 1.8. Without the CDATA on the trunk you don't get a syntax error but the script doesn't get executed.
Status: RESOLVED → UNCONFIRMED
Resolution: DUPLICATE → ---
Bob, do you want to CONFIRM this?

In HTML, no CDATA marked section should be required.  Please confirm that HTML works, and that this bug is only about XML types (XHTML, XUL), and if so, please update the summary.

Cc'ing mrbkap in case this is some kind of content sink or parser regression.  Or is it not a regression?  (If it is a regression, please use the keyword.)

/be
Attached file testcase html
html with no cdata, works in 1.8
xul with cdata, works in 1.8
xul without cdata, syntax error in 1.8, no syntax error in trunk but script does not execute.
Blocks: e4x
E4X will be removed again from Spidermonkey (bug 788293)
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago12 years ago
Resolution: --- → WONTFIX
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: