Bug 1017988 part 3. Allow the Global extended attribute to take a value. r=khuey
authorBoris Zbarsky <bzbarsky@mit.edu>
Mon, 04 Aug 2014 22:20:33 -0400
changeset 197778 b09a906ead30d72b290973a78cd4cdccc5054e63
parent 197777 e9fb308fb072f70206a5190194b8e042c1743714
child 197779 7fef6abf1e323d4ed69118bc84d4a9a86bf159c7
push id27250
push useremorley@mozilla.com
push dateTue, 05 Aug 2014 14:25:40 +0000
treeherdermozilla-central@2aaedcdf69f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs1017988
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1017988 part 3. Allow the Global extended attribute to take a value. r=khuey
dom/bindings/parser/WebIDL.py
dom/webidl/DedicatedWorkerGlobalScope.webidl
dom/webidl/ServiceWorkerGlobalScope.webidl
dom/webidl/SharedWorkerGlobalScope.webidl
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -1044,19 +1044,22 @@ class IDLInterface(IDLObjectWithScope):
                 if not attr.noArguments():
                     raise WebIDLError("[ExceptionClass] must take no arguments",
                                       [attr.location])
                 if self.parent:
                     raise WebIDLError("[ExceptionClass] must not be specified on "
                                       "an interface with inherited interfaces",
                                       [attr.location, self.location])
             elif identifier == "Global":
-                if not attr.noArguments():
-                    raise WebIDLError("[Global] must take no arguments",
-                                      [attr.location])
+                if attr.hasValue():
+                    self.globalNames = [ attr.value() ]
+                elif attr.hasArgs():
+                    self.globalNames = attr.args()
+                else:
+                    self.globalNames = [ self.identifier.name ]
                 self._isOnGlobalProtoChain = True
             elif (identifier == "NeedNewResolve" or
                   identifier == "OverrideBuiltins" or
                   identifier == "ChromeOnly" or
                   identifier == "Unforgeable" or
                   identifier == "LegacyEventInit" or
                   identifier == "FeatureDetectible"):
                 # Known extended attributes that do not take values
--- a/dom/webidl/DedicatedWorkerGlobalScope.webidl
+++ b/dom/webidl/DedicatedWorkerGlobalScope.webidl
@@ -7,15 +7,16 @@
  * http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera
  * Software ASA.
  * You are granted a license to use, reproduce and create derivative works of
  * this document.
  */
 
-[Global, Func="mozilla::dom::workers::DedicatedWorkerGlobalScope::Visible"]
+[Global=(Worker,DedicatedWorker),
+ Func="mozilla::dom::workers::DedicatedWorkerGlobalScope::Visible"]
 interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
   [Throws]
   void postMessage(any message, optional sequence<any> transfer);
 
   attribute EventHandler onmessage;
 };
--- a/dom/webidl/ServiceWorkerGlobalScope.webidl
+++ b/dom/webidl/ServiceWorkerGlobalScope.webidl
@@ -7,17 +7,18 @@
  * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
  *
  * You are granted a license to use, reproduce and create derivative works of
  * this document.
  */
 
 // The Pref controls exposure in general, the Func restricts it to inside the
 // ServiceWorkerGlobalScope (itself).
-[Global, Func="mozilla::dom::workers::ServiceWorkerGlobalScope::Visible",
+[Global=(Worker,ServiceWorker),
+ Func="mozilla::dom::workers::ServiceWorkerGlobalScope::Visible",
  Pref="dom.serviceWorkers.enabled"]
 interface ServiceWorkerGlobalScope : WorkerGlobalScope {
   // FIXME(nsm): Bug 982725
   // readonly attribute CacheList caches;
 
   // FIXME(nsm): Bug 982726
   // A container for a list of window objects, identifiable by ID, that
   // correspond to windows (or workers) that are "controlled" by this SW
--- a/dom/webidl/SharedWorkerGlobalScope.webidl
+++ b/dom/webidl/SharedWorkerGlobalScope.webidl
@@ -7,13 +7,14 @@
  * http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#the-workerglobalscope-common-interface
  *
  * © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and Opera
  * Software ASA.
  * You are granted a license to use, reproduce and create derivative works of
  * this document.
  */
 
-[Global, Func="mozilla::dom::workers::SharedWorkerGlobalScope::Visible"]
+[Global=(Worker,SharedWorker),
+ Func="mozilla::dom::workers::SharedWorkerGlobalScope::Visible"]
 interface SharedWorkerGlobalScope : WorkerGlobalScope {
   readonly attribute DOMString name;
   attribute EventHandler onconnect;
 };