Closed
Bug 288321
Opened 20 years ago
Closed 8 years ago
setting a readonly attribute from javascript doesn't always throw an error
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: mvl, Unassigned)
Details
Attachments
(1 file)
|
370 bytes,
text/plain
|
Details |
When tryin to find out what the problem was in bug 287985 comment 3, i found out
that setting a readonly property from javascript didn't throw an error.
| Reporter | ||
Comment 1•20 years ago
|
||
attaching testcase to use in xpcshell.
I noticed that trying to set .creationTime does throw an error, but .entryDate
doesn't. This last attribute might be made readwrite to fix 287985, so you
might need to back out any patches for that bug.
| Reporter | ||
Comment 2•20 years ago
|
||
in comment 0, i mean attribute, not property...
Summary: setting a readonly property from javascript doesn't always throw an error → setting a readonly attribute from javascript doesn't always throw an error
Comment 3•20 years ago
|
||
I remember running into this long ago, and brendan having an explanation.
Comment 4•20 years ago
|
||
An explanation for what? ECMA-262 says setting a read-only property silently
fails to update the property's value (but the result of the assignment
expression is the right-hand side). I don't like that, but it got past me
(there was some pseudo-vote, or horse-trading; I forget which) in the ECMA-262
Edition one days back in 1997.
Why some XPIDL-induced properties can't be set without an exception being thrown
is another question. Was that the issue here? If the ECMA-262 spec is the only
issue, this bug is INVALID.
/be
Comment 5•20 years ago
|
||
It was the ECMA spec sitation that I couldn't remember.
Looking at mvl's comment in the other bug, the issue is an interface with read-
only properties.
In the view of trying to mimic JS behavior on native objects this silently
fails in XPConnect as well. It would be easy enough to have this throw an
exception. I wonder how many things would complain if this now became the
behavior? Hopefully no one would have intentionally taken advantage of this.
| Reporter | ||
Comment 6•20 years ago
|
||
Whatever the correct behaviour is, it should be consistent. As it is now,
setting one attribute throws an error, while another doesn't. (see comment 1)
Updated•19 years ago
|
Assignee: dbradley → nobody
Updated•19 years ago
|
QA Contact: pschwartau → xpconnect
Comment 7•14 years ago
|
||
Not throwing is the correct behaviour per WebIDL. -> INVALID?
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•