Closed
Bug 290715
Opened 20 years ago
Closed 18 years ago
assignment of XMLList to named property of XML object causes exception in XML beans: Can't move/copy/insert a whole document
Categories
(Rhino Graveyard :: E4X, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: martin.honnen, Unassigned)
Details
(Keywords: testcase)
Attachments
(2 files)
|
137 bytes,
text/plain
|
Details | |
|
805 bytes,
patch
|
Details | Diff | Splinter Review |
Here is the test case:
var god = <god><name>Kibo</name></god>;
print(god);
god.name = <><prename>James</prename><nickname>Kibo</nickname></>;
print(god);
Rhino prints out the XML of god but then throws an exception on the assigment:
Rhino 1.6 release 1 2004 11 30
js> load('mozillaBugs/e4x/listAssignment1.js')
<god>
<name>Kibo</name>
</god>
java.lang.IllegalArgumentException: Can't move/copy/insert a whole document.
at org.apache.xmlbeans.impl.store.Splay.complain(Splay.java:833)
at
org.apache.xmlbeans.impl.store.Splay.checkInsertionValidity(Splay.java:867)
at org.apache.xmlbeans.impl.store.Cursor.copyXmlImpl(Cursor.java:2446)
at org.apache.xmlbeans.impl.store.Cursor.copyXml(Cursor.java:2410)
at org.mozilla.javascript.xmlimpl.XML.copy(XML.java:711)
at org.mozilla.javascript.xmlimpl.XML.moveSrcToDest(XML.java:661)
at org.mozilla.javascript.xmlimpl.XML.insertChild(XML.java:759)
at org.mozilla.javascript.xmlimpl.XML.doPut(XML.java:1001)
at org.mozilla.javascript.xmlimpl.XML.putXMLProperty(XML.java:1327)
at
org.mozilla.javascript.xmlimpl.XMLObjectImpl.ecmaPut(XMLObjectImpl.java:233)
at
org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1428)
at
org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1420)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2753)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
at
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149)
at org.mozilla.javascript.Context.evaluateReader(Context.java:1251)
at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:443)
at org.mozilla.javascript.tools.shell.Main.processFileSecure(Main.java:427)
at org.mozilla.javascript.tools.shell.Main.processFile(Main.java:364)
at org.mozilla.javascript.tools.shell.Global.load(Global.java:171)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:174)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:393)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:3026)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:304)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2769)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2145)
at
org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140)
at
org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:149)
at org.mozilla.javascript.Context.evaluateString(Context.java:1220)
at org.mozilla.javascript.tools.shell.Main.evaluateScript(Main.java:453)
at org.mozilla.javascript.tools.shell.Main.processSource(Main.java:341)
at org.mozilla.javascript.tools.shell.Main.processFiles(Main.java:160)
at org.mozilla.javascript.tools.shell.Main$IProxy.run(Main.java:83)
at org.mozilla.javascript.Context.call(Context.java:540)
at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:414)
at org.mozilla.javascript.tools.shell.Main.exec(Main.java:140)
at org.mozilla.javascript.tools.shell.Main.main(Main.java:112)
js: "C:\SomePath\mozillaBugs\ex\listAssignment1.js", line 4: uncaught JavaScript
runtime exception: TypeError
: Can't move/copy/insert a whole document.
I am using the latest XML Beans from Apache, 1.0.4, but tried with 1.0.3 too
with the same result.
Spidermonkey runs the sample without problems and prints
<god>
<prename>James</prename>
<nickname>Kibo</nickname>
</god>
as the XML after the assigment. Brendan says that is the correct behaviour, see
the newsgroup thread
<http://groups-beta.google.com/group/netscape.public.mozilla.jseng/browse_frm/thread/5d4b24cf9016e3c6/461803abf820d4de#461803abf820d4de>
in jseng.| Reporter | ||
Comment 1•20 years ago
|
||
| Reporter | ||
Comment 2•20 years ago
|
||
Bob, I am adding you to CC so that you can add a test case to the test suite as suggested a while ago by Igor.
Comment 3•20 years ago
|
||
Martin's test added to: /cvsroot/mozilla/js/tests/e4x/Types/9.1.1.2.js,v <-- 9.1.1.2.js new revision: 1.4; previous revision: 1.3
Comment 4•19 years ago
|
||
Reassigning to please_see_bug_288433@eml.cc pending resolution of bug 288433
Assignee: igor.bukanov → please_see_bug_288433
Updated•19 years ago
|
Assignee: please_see_bug_288433 → nobody
Comment 5•18 years ago
|
||
I haven't done the best possible job of analyzing this bug, but I ran across a related one and patched my local copy with the attached patch. It turns out it also fixes the provided test case. Not sure whether it handles all possible cases.
Comment 6•18 years ago
|
||
Validated that the patch indeed fixes the exception with the testcase; committed it. Thanks.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•