Closed
Bug 410192
Opened 17 years ago
Closed 17 years ago
E4X: incorrect ([e4x.@x]).toSource()
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.9beta3
People
(Reporter: BijuMailList, Assigned: brendan)
References
Details
Attachments
(1 file)
15.41 KB,
patch
|
mrbkap
:
review+
brendan
:
approval1.9+
|
Details | Diff | Splinter Review |
var a = <a x="blah" />;
([a.@x]).toSource()
gives ==> [blah]
expected ==> ["blah"]
===== also ===
var a = <a>
<a x="blah" />
<a x="blah" />
<a x="blah" />
</a>;
([a..@x]).toSource()
gives ==>
[blah
blah
blah]
expected ==> ? (I dont know !!!)
may be ==> ["blah\nblah\nblah"]
or may be ==> ["blahblahblah"]
Assignee | ||
Comment 1•17 years ago
|
||
Simplest testcase:
js> uneval(<x a="v"/>.@a)
v
Biju, is there anything else like an attribute value that should be quoted by uneval/toSource, but is not quoted by toXMLString? This bug is the result of making toSource an alias for toXMLString. Patch next.
/be
Assignee | ||
Comment 2•17 years ago
|
||
Assignee | ||
Updated•17 years ago
|
OS: Windows XP → All
Priority: -- → P3
Hardware: PC → All
Target Milestone: --- → mozilla1.9 M11
Updated•17 years ago
|
Attachment #294862 -
Flags: review?(mrbkap) → review+
(In reply to comment #1)
> Biju, is there anything else like an attribute value that should be quoted by
> uneval/toSource, but is not quoted by toXMLString?
//with
XML.ignoreComments = false;
XML.ignoreProcessingInstructions = false;
XML.ignoreWhitespace = false;
//following also gives invalid toSource
[<>df</>].toSource();
[<><![CDATA[df]]></>].toSource();
[<><!--df--></>].toSource();
[<><?mypi sds ?></>].toSource();
[XML('df')].toSource();
[XML('<![CDATA[df]]>')].toSource();
[XML('<!--df-->')].toSource();
[XML('<?mypi sds ?>')].toSource();
//along with
[<><a>1</a><a>2</a></>].toSource();
// two more test cases
({a:(<x a="a"/>).@b}).toSource(); // XML Query result is null,
({a:XML('')}).toSource(); // blank XML
({a:XML()}).toSource();
also see bug 410263 ...
[(<a a="
<>"/>).@a].toSource() ==> [
<>]
Assignee | ||
Comment 6•17 years ago
|
||
Biju: thanks for your help getting E4X bugs tracked down. One suggestion here: please simplify tests of the form |[expr].toSource() ==> bad| to avoid the array initialiser and toSource call: |uneval(expr) ==> bad|.
I'm not going to linger fixing E4X bugs, given higher priorities, so I will commit the patch mrbkap reviewed shortly. Remaining problems go in new bugs. Thanks!
/be
Assignee | ||
Updated•17 years ago
|
Attachment #294862 -
Flags: approval1.9+
Assignee | ||
Comment 7•17 years ago
|
||
Last E4X non-crasher I'll fix for 1.9, I swear!
/be
Flags: blocking1.9+
Assignee | ||
Comment 8•17 years ago
|
||
Fixed.
/be
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Here is it....
With
XML.ignoreComments = true;
XML.ignoreProcessingInstructions = true;
XML.ignoreWhitespace = true;
|uneval(<>asdf</>) ==> asdf|
|uneval(<><![CDATA[asdf]]></>) ==> asdf|
|uneval(<><!--asdf--></>) ==> |
|uneval(<><?mypi asdf ?></>) ==> |
|uneval(<></>) ==> |
|uneval(<x a="asdf"/>.@b) ==> |
|uneval(XML('asdf')) ==> asdf|
|uneval(XML('<![CDATA[asdf]]>')) ==> asdf|
|uneval(XML('<!--asdf-->')) ==> |
|uneval(XML('<?mypi asdf ?>')) ==> |
|uneval(XML('')) ==> |
|uneval(XML()) ==> |
also if needed
|uneval({a:(<x a="asdf"/>).@b}) ==> ({a:})|
|uneval({a:<></>}) ==> ({a:})|
|uneval({a:<>asdf</>}) ==> ({a:asdf})|
|uneval({a:XML('')}) ==> ({a:})|
|uneval({a:XML()}) ==> ({a:})|
My bad actually following are GOOD, but I dont know what fix has done,
so I am adding them also
XML.ignoreComments = false;
XML.ignoreProcessingInstructions = false;
XML.ignoreWhitespace = false;
|uneval(<><!--asdf--></>) ==> <!--asdf-->|
|uneval(<><?mypi asdf ?></>) ==> <?mypi asdf ?>|
|uneval(XML('<!--asdf-->')) ==> <!--asdf-->|
|uneval(XML('<?mypi asdf ?>')) ==> <?mypi asdf ?>|
(In reply to comment #6)
> please simplify tests of the form |[expr].toSource() ==> bad| to avoid the
> array initialiser and toSource call: |uneval(expr) ==> bad|.
Why uneval is prefered over toSource?
Assignee | ||
Comment 10•17 years ago
|
||
uneval works for all values, toSource does not for null and undefined (general reason, doesn't apply here of course). Also, uneval is two characters shorter ;-).
Not wrapping in an array initialiser avoids confounding variable to-do with array init and toSource.
Please file followups for uncovered buggy cases. Thanks,
/be
Reporter | ||
Comment 11•17 years ago
|
||
(In reply to comment #10)
> Please file followups for uncovered buggy cases. Thanks,
Sure, thanks...
Comment 12•17 years ago
|
||
/cvsroot/mozilla/js/tests/public-failures.txt
new revision: 1.20; previous revision: 1.19
/cvsroot/mozilla/js/tests/e4x/extensions/regress-410192.js
initial revision: 1.1
Flags: in-testsuite+
Flags: in-litmus-
You need to log in
before you can comment on or make changes to this bug.
Description
•