Bug 48337
Summary: | V8 bindings report readonly idl attributes as writable | ||
---|---|---|---|
Product: | WebKit | Reporter: | Erik Arvidsson <arv> |
Component: | DOM | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | Normal | CC: | antonm, dglazkov, dominicc, japhet, raynos2 |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | All | ||
OS: | All |
Erik Arvidsson
Given:
var event = document.createEvent('Event');
JSON.stringify(Object.getOwnPropertyDescriptor(event, 'currentTarget'))
returns
{"value":null,"writable":true,"enumerable":true,"configurable":true}
But the Event.idl file says
readonly attribute EventTarget currentTarget;
Safari + JSC returns
{"value":null,"writable":false,"enumerable":true,"configurable":false}
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
anton muhin
Rico did a lot of work on getOwnPropertyDescriptor, so he is probably the best guy to solve it.
Alas, we have two options to control not-writeability of API callbacks (currentTarget is API callback that is thing like getter where getter is implemented in C++): property attributes and absence of a setter.
Currently v8 believes into attributes (see src/runtime.cc ln. 77 as of bleeding edge@63542) while DOM bindings use missing setter (see third_party/WebKit/WebCore/bindings/scripts/CodeGeneratorV8.pm, ln. 1535 as of @70305).
If memory serves, v8 treats callback properties without setter as readonly anyway (at least it ignores any attempts to write, but we need to double check how it correlates with const), so I think the problem should be fixed on v8 part (checking if a setter is missing).
Rico, any thoughts?
Erik, this issue doesn't look of very high priority and could probably wait a bit (Rico is on paternity leave).
And I cannot just cc Rico, so I am forwarding this bug to him cc'ing this bug cc list instead.
Dominic Cooney
Note that per bug 49739 these attributes should be on Event.prototype. But the bug is still valid re: writable: true, configurable: true being invalid.
Dominic Cooney
Actually, per the Web IDL working draft <http://www.w3.org/TR/2010/WD-WebIDL-20101021/#es-attributes> readonly attributes should be attribute getters and setters.
Dominic Cooney
*** Bug 71113 has been marked as a duplicate of this bug. ***
Erik Arvidsson
V8 is gone