Rhino parser accepts XML literals containing multiple nodes

NEW
Unassigned

Status

Rhino
E4X
P4
normal
11 years ago
11 years ago

People

(Reporter: Robert Sayre, Unassigned)

Tracking

Details

(Reporter)

Description

11 years ago
Rhino 1.6r3 should not accept XML literals that would for XMLLists. see bug 351371 for details.


5 test cases:

1.) var x = function(){ var x = <?foo bar?><y>asdf</y>; }
2.) var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; }
3.) var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; }
4.) var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; }
5.) var x = function(){ var x = <y><?foo bar?>asdf</y>; }




Spidermonkey trunk
----------------------------------

js> var x = function(){ var x = <?foo bar?><y>asdf</y>; }
typein:1: SyntaxError: unterminated regular expression literal:
typein:1: var x = function(){ var x = <?foo bar?><y>asdf</y>; }

typein:1: ...............................................^
js> var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; }
typein:2: SyntaxError: unterminated regular expression literal:
typein:2: var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; }

typein:2: ...............................................^
js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; }
typein:3: SyntaxError: missing ; before statement:
typein:3: var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; }

typein:3: .....................................................^
js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; }
typein:4: SyntaxError: missing ; before statement:
typein:4: var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo
bar?>; }

typein:4: .....................................................^
js> var x = function(){ var x = <y><?foo bar?>asdf</y>; }
js> x
function () {
    var x = <y><?foo bar?>asdf</y>;
}
js> 


Rhino 1.6r3
----------------------------

js> var x = function(){ var x = <?foo bar?><y>asdf</y>; }
js> x

function () {
    var x = <?foo bar?><y>asdf</y>;
}

js> var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; }
js: "<stdin>", line 6: syntax error
js: var x = function(){ var x = <?foo bar?><y>asdf</y><?foo bar?>; }
js: ...................................................^
js: "<stdin>", line 6: Compilation produced 1 syntax errors.
js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y>; }
js> x

function () {
    var x = <?foo bar?><y><?foo bar?>asdf</y>;
}

js> var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; }
js: "<stdin>", line 9: syntax error
js: var x = function(){ var x = <?foo bar?><y><?foo bar?>asdf</y><?foo bar?>; }
js: ..............................................................^
js: "<stdin>", line 9: Compilation produced 1 syntax errors.
js> var x = function(){ var x = <y><?foo bar?>asdf</y>; }
js> x

function () {
    var x = <y><?foo bar?>asdf</y>;
}

Comment 1

11 years ago
The parser doesn't correctly enforce the rules given in ECMA357 11.1.4 and 8.3.  According to 11.1.4, an XML literal must match an element OR an XMLMarkup (which according to 8.3 is a comment or PI or CDATA).  We allow XML literals to also match a series of these.

Adding bug 368520 (parser) as a blocker for this bug.
Depends on: 368520

Updated

11 years ago
Summary: e4x XML literal parsing is too lax → Rhino parser accepts XML literals containing multiple nodes

Updated

11 years ago
Priority: -- → P4
You need to log in before you can comment on or make changes to this bug.