Closed
Bug 380946
Opened 18 years ago
Closed 15 years ago
Unnecessary use of sharp by uneval with E4X
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jruderman, Unassigned)
References
Details
(Keywords: testcase)
Attachments
(1 file)
2.51 KB,
patch
|
Details | Diff | Splinter Review |
js> o = {}; o.a = <x><y/></x>; uneval(o);
({a:#1=<x>
<y/>
</x>})
The sharp variable doesn't seem necessary here. It isn't used.
(Split from bug 380833.)
Reporter | ||
Comment 1•16 years ago
|
||
Not only is it not used; it prevents the string returned by uneval from working. "SyntaxError: invalid sharp variable definition" -- sharps have to be object literals or array literals, I think.
Comment 2•15 years ago
|
||
Attachment #440726 -
Flags: review?
Reporter | ||
Updated•15 years ago
|
Attachment #440726 -
Flags: review? → review?(jwalden+bmo)
(In reply to comment #2)
> patch that should solve the bug, plus regression test
With the patch what is the output of
js> x=<x/>;a={a:x, b:x};uneval(a);
is it
({a:#1=<x/>, b:#1#})
Also please see Bug 335051
Comment 4•15 years ago
|
||
(In reply to comment #3)
> With the patch what is the output of
> js> x=<x/>;a={a:x, b:x};uneval(a);
>
it is: ({a:<x/>, b:<x/>})
please disregard the patch,
it needs more work, I'll look into it.
Updated•15 years ago
|
Attachment #440726 -
Flags: review?(jwalden+bmo)
Comment 5•15 years ago
|
||
A bit of elaboration:
This error seems to occur with non-empty xml statements within objects, ie. problem with:
uneval({a:<x>foo</x>}) -> "({a:#1=<x>foo</x>})"
but not with:
uneval({a:<x/>}) -> "({a:<x/>})"
Uneval of objects and arrays behaves different,
such that objects use sharps with xml whereas arrays do not, ie:
x=<x/>; uneval({a:x,b:x}) -> "({a:#1=<x/>, b:#1#})"
x=<x/>; uneval([x, x]) -> "[<x/>, <x/>]"
(also demonstrated in Biju's example 11 in bug 335051),
The earlier patch changes uneval of objects such that it does not use sharps on xml - a behavior similar to arrays uneval - and I doubt this is the wanted behaviour, and it adds a bit of code. This bug will probably less of an issue when bug 335051 is done.
This bug may be a sub-bug or duplicate of bug 379519 (together with 335051).
Also, thanks a lot to Waldo, Biju, Brendan, and Gary, for fast feedback on bug 463360, bug 335051, and this bug.
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.3a5pre)
Gecko/20100520 Minefield/3.7a5pre
Case 1 -------------------------------
o = {}; o.a = <x><y/></x>; uneval(o);
==>
({a:#1=<x>
<y/>
</x>})
Case 2 -------------------------------
x=<x/>;a={a:x, b:x};uneval(a);
===>
({a:#1=<x/>, b:#1#})
Case 3 -------------------------------
x=<x/>;a={a:x};uneval(a);
===>
({a:<x/>})
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.3a5pre)
Gecko/20100526 Minefield/3.7a5pre
Case 1 -------------------------------
o = {}; o.a = <x><y/></x>; uneval(o);
===>
({a:<x>
<y/>
</x>})
Case 2 -------------------------------
x=<x/>;a={a:x, b:x};uneval(a);
===>
({a:#1=<x/>, b:#1#})
Case 3 -------------------------------
x=<x/>;a={a:x};uneval(a);
===>
({a:<x/>})
Assuming this is PASSED by bug 335051 attachment 444050 [details] [diff] [review]
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•