Bug 48337 - V8 bindings report readonly idl attributes as writable
Summary: V8 bindings report readonly idl attributes as writable
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
: 71113 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-26 09:48 PDT by Erik Arvidsson
Modified: 2013-09-27 09:49 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Arvidsson 2010-10-26 09:48:26 PDT
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}
Comment 1 anton muhin 2010-10-26 11:40:00 PDT
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.
Comment 2 Dominic Cooney 2011-05-24 16:58:32 PDT
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.
Comment 3 Dominic Cooney 2011-05-24 18:15:50 PDT
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.
Comment 4 Dominic Cooney 2011-11-01 16:08:13 PDT
*** Bug 71113 has been marked as a duplicate of this bug. ***
Comment 5 Erik Arvidsson 2013-09-27 09:49:15 PDT
V8 is gone