Skip to content

Commit

Permalink
Add [Exposed=*] to expose on all globals
Browse files Browse the repository at this point in the history
This patch adds support in WebIDL for declaring an interface available
in all contexts.

Closes #468
  • Loading branch information
littledan committed Feb 23, 2018
1 parent 3750d7a commit 35b291d
Showing 1 changed file with 41 additions and 4 deletions.
45 changes: 41 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -6539,6 +6539,17 @@ which form (or forms) it is in:
<code>[Exposed=(Window,Worker)]</code>
</td>
</tr>
<tr>
<td>
<emu-nt><a href="#prod-ExtendedAttributeWildcard">ExtendedAttributeWildcard</a></emu-nt>
</td>
<td>
<dfn id="dfn-xattr-wildcard" for="extended attribute" export>takes a wildcard</dfn>
</td>
<td>
<code>[Exposed=*]</code>
</td>
</tr>

</table>

Expand Down Expand Up @@ -6600,6 +6611,7 @@ five forms are allowed.
"="
"&gt;"
"?"
"*"
"ByteString"
"DOMString"
"FrozenArray"
Expand Down Expand Up @@ -6659,6 +6671,11 @@ five forms are allowed.
identifier "=" identifier
</pre>

<pre class="grammar" id="prod-ExtendedAttributeWildcard">
ExtendedAttributeWildcard :
identifier "=" "*"
</pre>

<pre class="grammar" id="prod-ExtendedAttributeIdentList">
ExtendedAttributeIdentList :
identifier "=" "(" IdentifierList ")"
Expand Down Expand Up @@ -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
<dfn>own exposure set</dfn>.

The <dfn>own exposure set</dfn> 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
set of interfaces which have the [{{Global}}] extended attribute.

<p class="advisement">
<code>[Exposed=*]</code> 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.
</p>

<div algorithm>
* 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 <dfn id="dfn-exposure-set" export>exposure set</dfn> of a construct |C|,
run the following steps:
Expand Down

0 comments on commit 35b291d

Please sign in to comment.