From f0f2125d1dba30c472c0f9ca99bb705b9973fc39 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Thu, 22 Feb 2018 17:17:49 +0100 Subject: [PATCH] Add [Exposed=*] to expose on all globals This patch adds support in WebIDL for declaring an interface available in all contexts. Closes #468 --- index.bs | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/index.bs b/index.bs index d627c3f04..7213e8362 100644 --- a/index.bs +++ b/index.bs @@ -6539,6 +6539,17 @@ which form (or forms) it is in: [Exposed=(Window,Worker)] + + + ExtendedAttributeWildcard + + + takes a wildcard + + + [Exposed=*] + + @@ -6600,6 +6611,7 @@ five forms are allowed. "=" ">" "?" + "*" "ByteString" "DOMString" "FrozenArray" @@ -6659,6 +6671,11 @@ five forms are allowed. identifier "=" identifier +
+    ExtendedAttributeWildcard :
+        identifier "=" "*"
+
+
     ExtendedAttributeIdentList :
         identifier "=" "(" IdentifierList ")"
@@ -8560,13 +8577,33 @@ it indicates that the construct is exposed
 on that particular set of global interfaces.
 
 The [{{Exposed}}] [=extended attribute=] must either
-[=takes an identifier|take an identifier=] or
-[=takes an identifier list|take an identifier list=].
+[=takes an identifier|take an identifier=],
+[=takes an identifier list|take an identifier list=] or
+[=takes a wildcard|take a wildcard=].
 Each of the identifiers mentioned must be a [=global name=] and be unique.
-This list of identifiers is known as the construct's
-own exposure set.
+
+The own exposure set is the set of [=global name=]s which
+[{{Exposed}}] is applied to.
+
+If the [{{Exposed}}] [=extended attribute=]
+[=takes an identifier|take an identifier=] or
+[=takes an identifier list|take an identifier list=],
+the [=own exposure set=] is the list of identifiers.
+If the [{{Exposed}}] [=extended attribute=]
+[=takes a wildcard|take a wildcard=], the [=own exposure set=] is the
+the set of interfaces which have the [{{Global}}] extended attribute.
+
+

+ [Exposed=*] should be used with care. It is only appropriate + when an interface does not expose significant new capabilities. If the + interface may be restricted or disabled in some environments, it is + recommended to list the globals explicitly. +

+* If the [{{Exposed}}] [=extended attribute=] [=takes a wildcard=], then the + [=exposure set=] is the set of all interfaces which have a [{{Global}}] + or [{{PrimaryGlobal}}] [=extended attribute=]. To get the exposure set of a construct |C|, run the following steps: