Closed Bug 277935 Opened 21 years ago Closed 21 years ago

Assignments to descendants like "msg..s = something" => failed assert

Categories

(Rhino Graveyard :: E4X, defect)

1.6R1
x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

References

Details

Attachments

(1 file)

Assignments like "msg..s = something" triggers failed assert exception at runtime instead of proper syntax error during compile time. For example, the following test case: var msg = <foo><bar><s/></bar></foo> msg..s = "foo" leads to: Exception in thread "main" java.lang.IllegalStateException: FAILED ASSERTION at org.mozilla.javascript.Kit.codeBug(Kit.java:432) at org.mozilla.javascript.xmlimpl.XMLName.set(XMLName.java:130) at org.mozilla.javascript.ScriptRuntime.refSet(ScriptRuntime.java:1516) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2828) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2164) at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:140) ... It was originally reported by ant_petra@hotmail.com : -------- Original Message -------- Subject: E4X FAILED ASSERTION in Kit.codeBug(Kit.java:425) Date: 11 Jan 2005 04:08:17 -0800 From: ant <ant_petra@hotmail.com> Organization: http://groups.google.com Newsgroups: netscape.public.mozilla.jseng Is it valid to try to modify the contents of an XML element selected with the dot-dot operator? For example, using the msg defined below, if i try: msg..s = "foo" I get an assertion failed, whereas specifying the full path works fine: msg.soap::Body.ns::reverse.s = "foo" Thanks for any help. ...ant Complete details are: js> msg <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www .w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header/> <soapenv:Body> <p728:reverse xmlns:p728="http://ejbs"> <s>petra</s> </p728:reverse> </soapenv:Body> </soapenv:Envelope> js> soap = new Namespace("http://schemas.xmlsoap.org/soap/envelope/") http://schemas.xmlsoap.org/soap/envelope/ js> ns = new Namespace("http://ejbs") http://ejbs js> msg..s = "foo" java.lang.IllegalStateException: FAILED ASSERTION at org.mozilla.javascript.Kit.codeBug(Kit.java:425) at org.mozilla.javascript.xmlimpl.XMLName.set(XMLName.java:130) at org.mozilla.javascript.ScriptRuntime.refSet(ScriptRuntime.java:1516) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2828) 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)
I added the test case for the bug: e4x/Regress/regress-277935.js
I committed the fix
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Blocks: 270779
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: