This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 28765 - It seems better to make DedicatedWorkerGlobalScope _implements_ WorkerGlobalScope so that var foo = foo | webkitFoo | msFoo | ... will work as expected, just like Window.
Summary: It seems better to make DedicatedWorkerGlobalScope _implements_ WorkerGlobalS...
Status: RESOLVED WONTFIX
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: https://html.spec.whatwg.org/#dedicat...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-05 06:29 UTC by contributor
Modified: 2015-09-18 10:54 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2015-06-05 06:29:33 UTC
Specification: https://html.spec.whatwg.org/multipage/workers.html
Multipage: https://html.spec.whatwg.org/multipage/#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
Complete: https://html.spec.whatwg.org/#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
Referrer: https://html.spec.whatwg.org/multipage/workers.html

Comment:
It seems better to make DedicatedWorkerGlobalScope _implements_
WorkerGlobalScope so that var foo = foo | webkitFoo | msFoo | ... will work as
expected, just like Window.

Posted from: 74.125.56.38
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2421.0 Safari/537.36
Comment 1 Ms2ger 2015-09-17 10:46:03 UTC
Are we planning to add any prefixed attributes to WorkerGlobalScope?
Comment 2 Anne 2015-09-17 11:09:48 UTC
I think we'd want the same setup for globals around the platform so if IDL indeed makes this different I think we should change. heycam, bz, what do you think?
Comment 3 Boris Zbarsky 2015-09-17 14:00:42 UTC
The setup is the same for all globals, and the setup is as follows: properties that appear on the [Global] or [PrimaryGlobal] interface appear directly on the object.  Properties that appear on ancestor interfaces of that interface appear on the corresponding prototypes.

So for Window, for example, "addEventListener" appears on EventTarget.prototype, not directly on the window object, while "open" appears on the window object itself, since the latter is defined on the Window interface, which is [PrimaryGlobal].

Now EventTarget is implemented by various things, so it makes sense to put its methods directly on its prototype so that you can hook all event targets (including Window) at once.  But in the worker case, it's not like there are multiple things implementing WorkerGlobalScope around.  So it would not be entirely unreasonable to make WorkerGlobalScope a mixin.  Arguments for:

1)  If someone adds a prefixed property on WorkerGlobalScope and ships it (which would be considered pretty bad web citizenship at this point, given our experience with prefixed properties), the "var foo" thing would not break, as described when the bug was filed.

2)  It makes some property-access optimizations on the global a bit easier (e.g. see https://bugzilla.mozilla.org/show_bug.cgi?id=1063878 and the "not a leaf interface" bit in <https://bugzilla.mozilla.org/show_bug.cgi?id=1063879#c0>).

Arguments against:

I)  It's a backwards-incompatible change to functionality that's been shipping for a while in browsers.  It would break any scripts that add properties to WorkerGlobalScope.prototype or get properties from it.  So we'd need to at least do some due diligence looking for such scripts.
Comment 4 Anne 2015-09-18 10:54:55 UTC
Thank you bz. The churn does not seem worth it based on those arguments.