Bug 76085 - IETC audio-interface-inherit.129 claims NETWORK_NO_SOURCE should not be overrideable
Summary: IETC audio-interface-inherit.129 claims NETWORK_NO_SOURCE should not be overr...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Adam Barth
URL:
Keywords:
Depends on:
Blocks: 76198
  Show dependency treegraph
 
Reported: 2012-01-11 11:47 PST by Eric Seidel (no email)
Modified: 2012-01-12 12:10 PST (History)
3 users (show)

See Also:


Attachments
Patch (2.74 KB, patch)
2012-01-11 14:19 PST, Adam Barth
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Seidel (no email) 2012-01-11 11:47:11 PST
IETC audio-interface-inherit.129 claims NETWORK_NO_SOURCE should not be overrideable

http://samples.msdn.microsoft.com/ietestcenter/html5/MediaElements/audio-interface-inherit.129.htm

I'm not sure there is a bug here.  We define NETWORK_NO_SOURCE on HTMLMediaElement, per the spec:
http://www.whatwg.org/specs/web-apps/current-work/#media-elements

Even though that value is constant, it seems any object instance which has HTMLMediaElement can still set its own NETWORK_NO_SOURCE, no?
Comment 1 Eric Seidel (no email) 2012-01-11 13:00:22 PST
Actually, my understanding was incorrect.

This is a bug in our code generator, not implying readonly from const:
http://www.w3.org/TR/WebIDL/#es-constants
Comment 2 Eric Seidel (no email) 2012-01-11 13:02:22 PST
Nope, that's wrong too.  It's already being generated readonly:


    { "NETWORK_NO_SOURCE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsHTMLMediaElementNETWORK_NO_SOURCE), (intptr_t)0, NoIntrinsic },
Comment 3 Eric Seidel (no email) 2012-01-11 13:13:59 PST
I'm unclear from the WebIDL spec.  http://www.w3.org/TR/WebIDL/#es-constants

4.5.4. Constants

For each constant defined on an interface A, there must be a corresponding property on the interface object, if it exists. The property has the following characteristics:

The name of the property is the identifier of the constant.
The value of the property is that which is obtained by converting the constant’s IDL value to an ECMAScript value.
The property has attributes { [[Writable]]: false, [[Enumerable]]: true, [[Configurable]]: false }.
In addition, a property with the same characteristics must exist on the interface prototype object.


Does that mean that each instance of an HTMLAudioElement has to have NETWORK_NO_SOURCE defined readonly?  Currently it appears we just define this on the prototype.
Comment 4 Eric Seidel (no email) 2012-01-11 13:15:17 PST
> audio = document.createElement("audio")
<audio>​</audio>​
> audio.__proto__
HTMLAudioElement
> audio.NETWORK_NO_SOURCE
3
> audio.__proto__ = null
null
> audio.NETWORK_NO_SOURCE
undefined
Comment 5 Adam Barth 2012-01-11 13:19:10 PST
I'm pretty sure the test is wrong.  The constant is supposed to appear in the interface and the interface prototype, not the instance.  Assigning to the property on the instance creates a new property on the instance that shadows the readonly property on the prototype.
Comment 6 Adam Barth 2012-01-11 14:19:30 PST
Created attachment 122097 [details]
Patch
Comment 7 WebKit Review Bot 2012-01-11 16:08:21 PST
Comment on attachment 122097 [details]
Patch

Clearing flags on attachment: 122097

Committed r104761: <http://trac.webkit.org/changeset/104761>
Comment 8 WebKit Review Bot 2012-01-11 16:08:26 PST
All reviewed patches have been landed.  Closing bug.