Closed
Bug 508557
Opened 15 years ago
Closed 13 years ago
delete should not throw an exception on unresolvable references
Categories
(Rhino Graveyard :: Core, defect)
Rhino Graveyard
Core
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: rspeyer, Unassigned)
References
Details
Attachments
(1 file, 1 obsolete file)
4.92 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.196 Safari/532.0
Build Identifier: Rhino 1.7 release 2 2009 03 22
It should just return true, as per 11.4.1 of the spec
Reproducible: Always
Actual Results:
js> delete somethingNotDefined
js: "<stdin>", line 2: uncaught JavaScript runtime exception: TypeError: Cannot delete property "somethingNotDefined" of null
at <stdin>:2
Expected Results:
js> delete somethingNotDefined
true
Comment 2•15 years ago
|
||
SpiderMonkey throws an error on "delete null.p", which I think is correct from 11.4.1 since it's supposed to resolve the UnaryExpression "null.p", which should throw an exception. With the proposed change, "delete null.p" just resolves to true.
Hmm, we need some way to distinguish between the unresolvable reference that results from looking up an absent identifier, and a property access reference on a null or undefined base value.
Comment 4•13 years ago
|
||
Adds a boolean parameter to ScriptRuntime.delete() to tell whether unresolved reference should be accepted. The change in Codegen was relatively straightforward because we have access to the AST tree, but for the Interpreter I had to introduce a new bytecode, Icode_DELNAME.
Attachment #392708 -
Attachment is obsolete: true
Comment 5•13 years ago
|
||
I committed a slightly modified version of the patch.
https://github.com/mozilla/rhino/commit/adad88afabf6d34757e99ca730f65b4872ead96d
Status: UNCONFIRMED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•