Bug 110573

Summary: Global constructors should be configurable and not enumerable
Product: WebKit Reporter: Jungkee Song <jungkees>
Component: WebCore Misc.Assignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: ap, buildbot, cdumez, commit-queue, d-r, ggaren, glenn, gyuyoung.kim, hojong.han, jungkee.song, jussi.kukkonen, kihong.kwon, laszlo.gombos, Ms2ger, rakuco, rniwa
Priority: P2 Keywords: WebExposed
Version: 528+ (Nightly build)   
Hardware: All   
OS: Unspecified   
URL: http://dev.w3.org/cvsweb/~checkout~/2006/webapi/WebIDL/Overview.html?rev=1.617;content-type=text%2Fhtml#es-interfaces
Bug Depends on:    
Bug Blocks: 115235    
Attachments:
Description Flags
Patch
buildbot: commit-queue-
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion
none
Patch
none
Patch
ggaren: review+
Patch for landing none

Description Jungkee Song 2013-02-22 01:44:50 PST
Steps to reproduce:

ProgressEvent CR (http://www.w3.org/TR/progress-events/) test
- Test wiki: http://www.w3.org/wiki/Webapps/Interop/ProgressEvents
- Test suite: http://w3c-test.org/webapps/ProgressEvents/tests/
- Test case: http://w3c-test.org/webapps/ProgressEvents/tests/submissions/Ms2ger/interface.html
(6) Interface objects properties should not be Enumerable


Actual results:

Test case failed: 

for (var p in window) {
  assert_not_equals(p, "ProgressEvent")
}
this assertion fails.


Expected results:

ProgressEvent is not enumerable in window object. Hence, the above assertion passes.
(See 4.4. Interfaces of WebIDL: http://dev.w3.org/2006/webapi/WebIDL/#es-interfaces)
Comment 1 Chris Dumez 2013-04-17 07:46:21 PDT
*** Bug 110574 has been marked as a duplicate of this bug. ***
Comment 2 Chris Dumez 2013-04-17 10:36:07 PDT
Created attachment 198584 [details]
Patch
Comment 3 Ryosuke Niwa 2013-04-17 10:40:36 PDT
I'll be great if we can make this change and make our engine more spec. compliant (or rather interoperate well other other browsers) but I'm a little concerned that there could be some websites that depend on our current behavior.  What do other browsers do here?  Also, it seems worthwhile to discuss it on webkit-dev.
Comment 4 Ms2ger (he/him; ⌚ UTC+1/+2) 2013-04-17 10:42:33 PDT
I believe Gecko should match the spec.
Comment 5 Glenn Adams 2013-04-17 10:42:45 PDT
Comment on attachment 198584 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=198584&action=review

> LayoutTests/ChangeLog:14
> +        http://dev.w3.org/2006/webapi/WebIDL/#es-interfaces

Please cite or refer to the particular spec language that applies here.
Comment 6 Chris Dumez 2013-04-17 10:43:21 PDT
(In reply to comment #3)
> I'll be great if we can make this change and make our engine more spec. compliant (or rather interoperate well other other browsers) but I'm a little concerned that there could be some websites that depend on our current behavior.  What do other browsers do here?  Also, it seems worthwhile to discuss it on webkit-dev.

- Firefox follows the spec
- Chromium does not follow the spec
Comment 7 Chris Dumez 2013-04-17 10:43:56 PDT
(In reply to comment #5)
> (From update of attachment 198584 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=198584&action=review
> 
> > LayoutTests/ChangeLog:14
> > +        http://dev.w3.org/2006/webapi/WebIDL/#es-interfaces
> 
> Please cite or refer to the particular spec language that applies here.

From 4.4:
"""
a corresponding property must exist on the ECMAScript global object. The name of the property is the identifier of the interface, and its value is an object called the interface object.

The property has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. The characteristics of an interface object are described in section 4.4.1 below.
"""
Comment 8 Ryosuke Niwa 2013-04-17 10:47:08 PDT
(In reply to comment #6)
> (In reply to comment #3)
> > I'll be great if we can make this change and make our engine more spec. compliant (or rather interoperate well other other browsers) but I'm a little concerned that there could be some websites that depend on our current behavior.  What do other browsers do here?  Also, it seems worthwhile to discuss it on webkit-dev.
> 
> - Firefox follows the spec
> - Chromium does not follow the spec

How about IE?  Also, it would be great to refer to a specific version of the spec. you used so that we'll be able to see which spec you've implemented should the spec change in the future ever so slightly.
Comment 9 Glenn Adams 2013-04-17 10:48:15 PDT
(In reply to comment #7)
> (In reply to comment #5)
> > (From update of attachment 198584 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=198584&action=review
> > 
> > > LayoutTests/ChangeLog:14
> > > +        http://dev.w3.org/2006/webapi/WebIDL/#es-interfaces
> > 
> > Please cite or refer to the particular spec language that applies here.
> 
> From 4.4:
> """
> a corresponding property must exist on the ECMAScript global object. The name of the property is the identifier of the interface, and its value is an object called the interface object.
> 
> The property has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. The characteristics of an interface object are described in section 4.4.1 below.
> """

Thanks. I also wonder if you should test the attributes on the prototype object for these non-callback interfaces:

"""
Note
Since an interface object for a non-callback interface is a function object, it will have a “prototype” property with attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
"""
Comment 10 Chris Dumez 2013-04-17 10:50:56 PDT
(In reply to comment #8)
> (In reply to comment #6)
> > (In reply to comment #3)
> > > I'll be great if we can make this change and make our engine more spec. compliant (or rather interoperate well other other browsers) but I'm a little concerned that there could be some websites that depend on our current behavior.  What do other browsers do here?  Also, it seems worthwhile to discuss it on webkit-dev.
> > 
> > - Firefox follows the spec
> > - Chromium does not follow the spec
> 
> How about IE?  Also, it would be great to refer to a specific version of the spec. you used so that we'll be able to see which spec you've implemented should the spec change in the future ever so slightly.

IE9 follows partly the spec:
- The constructors are not enumerable (OK)
- The constructors are not deletable (Not OK)

I actually implemented the Editor Draft as the last TR is becoming a bit old. However, this part of the spec has not changed since last publication:
http://www.w3.org/TR/2012/CR-WebIDL-20120419/#es-interfaces
Comment 11 Chris Dumez 2013-04-17 10:52:35 PDT
(In reply to comment #9)
> (In reply to comment #7)
> > (In reply to comment #5)
> > > (From update of attachment 198584 [details] [details] [details])
> > > View in context: https://bugs.webkit.org/attachment.cgi?id=198584&action=review
> > > 
> > > > LayoutTests/ChangeLog:14
> > > > +        http://dev.w3.org/2006/webapi/WebIDL/#es-interfaces
> > > 
> > > Please cite or refer to the particular spec language that applies here.
> > 
> > From 4.4:
> > """
> > a corresponding property must exist on the ECMAScript global object. The name of the property is the identifier of the interface, and its value is an object called the interface object.
> > 
> > The property has the attributes { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }. The characteristics of an interface object are described in section 4.4.1 below.
> > """
> 
> Thanks. I also wonder if you should test the attributes on the prototype object for these non-callback interfaces:
> 
> """
> Note
> Since an interface object for a non-callback interface is a function object, it will have a “prototype” property with attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }.
> """

For now, I'm trying to get the following test cases to pass:
http://w3c-test.org/webapps/ProgressEvents/tests/submissions/Ms2ger/interface.html

I think it is a good idea to go incrementally.
Comment 12 Ms2ger (he/him; ⌚ UTC+1/+2) 2013-04-17 11:12:56 PDT
Please don't reference the TR draft, it's almost a year out of date. If you want a particular revision, you can use <http://dev.w3.org/cvsweb/~checkout~/2006/webapi/WebIDL/Overview.html?rev=1.617;content-type=text%2Fhtml>.
Comment 13 Chris Dumez 2013-04-17 11:34:41 PDT
(In reply to comment #3)
> I'll be great if we can make this change and make our engine more spec. compliant (or rather interoperate well other other browsers) but I'm a little concerned that there could be some websites that depend on our current behavior.  What do other browsers do here?  Also, it seems worthwhile to discuss it on webkit-dev.

Agreed. I sent an email to the webkit-dev mailing list.
Comment 14 Build Bot 2013-04-17 11:57:34 PDT
Comment on attachment 198584 [details]
Patch

Attachment 198584 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/69334

New failing tests:
canvas/philip/tests/type.delete.html
fast/js/global-constructors-attributes.html
fast/js/global-constructors-deletable.html
Comment 15 Build Bot 2013-04-17 11:57:37 PDT
Created attachment 198592 [details]
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-05  Port: mac-mountainlion  Platform: Mac OS X 10.8.2
Comment 16 Chris Dumez 2013-04-17 12:37:42 PDT
Created attachment 198595 [details]
Patch

Should make ews happy.
Comment 17 Chris Dumez 2013-04-17 14:02:57 PDT
Created attachment 198607 [details]
Patch

Fix Web IDL spec URL in the Changelog to point to the right section.
Comment 18 Chris Dumez 2013-04-23 12:23:09 PDT
ping review?
Comment 19 Geoffrey Garen 2013-04-23 12:36:13 PDT
Comment on attachment 198607 [details]
Patch

r=me
Comment 20 Chris Dumez 2013-04-23 14:36:07 PDT
Created attachment 199327 [details]
Patch for landing
Comment 21 WebKit Commit Bot 2013-04-23 15:33:38 PDT
Comment on attachment 199327 [details]
Patch for landing

Clearing flags on attachment: 199327

Committed r149001: <http://trac.webkit.org/changeset/149001>
Comment 22 WebKit Commit Bot 2013-04-23 15:33:43 PDT
All reviewed patches have been landed.  Closing bug.
Comment 23 Alexey Proskuryakov 2013-04-24 15:05:41 PDT
Removed fast/js/global-constructors.html from TestExpectations in <http://trac.webkit.org/changeset/149068>.