Skip to content

Commit 59dae6f

Browse files
littledanExE-BossMs2ger
authored
Add [Exposed=*] to expose on all globals (#526)
This patch adds support in WebIDL for declaring an interface available in all contexts. Closes #468 Co-authored-by: ExE Boss <[email protected]> Co-authored-by: Ms2ger <[email protected]>
1 parent 81e6fec commit 59dae6f

File tree

1 file changed

+40
-6
lines changed

1 file changed

+40
-6
lines changed

index.bs

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6911,6 +6911,17 @@ which form (or forms) it is in:
69116911
<code>[Exposed=(Window,Worker)]</code>
69126912
</td>
69136913
</tr>
6914+
<tr>
6915+
<td>
6916+
<emu-nt><a href="#prod-ExtendedAttributeWildcard">ExtendedAttributeWildcard</a></emu-nt>
6917+
</td>
6918+
<td>
6919+
<dfn id="dfn-xattr-wildcard" for="extended attribute" export>takes a wildcard</dfn>
6920+
</td>
6921+
<td>
6922+
<code>[Exposed=*]</code>
6923+
</td>
6924+
</tr>
69146925

69156926
</table>
69166927

@@ -6972,6 +6983,7 @@ five forms are allowed.
69726983
"="
69736984
"&gt;"
69746985
"?"
6986+
"*"
69756987
"ByteString"
69766988
"DOMString"
69776989
"FrozenArray"
@@ -7036,6 +7048,11 @@ five forms are allowed.
70367048
identifier "=" identifier
70377049
</pre>
70387050

7051+
<pre class="grammar" id="prod-ExtendedAttributeWildcard">
7052+
ExtendedAttributeWildcard :
7053+
identifier "=" "*"
7054+
</pre>
7055+
70397056
<pre class="grammar" id="prod-ExtendedAttributeIdentList">
70407057
ExtendedAttributeIdentList :
70417058
identifier "=" "(" IdentifierList ")"
@@ -9497,14 +9514,31 @@ it indicates that the construct is exposed
94979514
on that particular set of global interfaces.
94989515

94999516
The [{{Exposed}}] [=extended attribute=] must either
9500-
[=takes an identifier|take an identifier=] or
9501-
[=takes an identifier list|take an identifier list=].
9502-
Each of the identifiers mentioned must be a [=global name=] and be unique.
9503-
This list of identifiers is known as the construct's
9504-
<dfn>own exposure set</dfn>.
9517+
[=takes an identifier|take an identifier=],
9518+
[=takes an identifier list|take an identifier list=] or
9519+
[=takes a wildcard|take a wildcard=].
9520+
Each of the identifiers mentioned must be a [=global name=] of some [=interface=] and be unique.
95059521

9506-
<div algorithm>
9522+
The <dfn>own exposure set</dfn> is the [=/set=] of identifiers defined as follows:
95079523

9524+
<dl class="switch">
9525+
: If the [{{Exposed}}] [=extended attribute=] [=takes an identifier=] |I|
9526+
:: The [=own exposure set=] is the [=/set=] « |I| ».
9527+
: If the [{{Exposed}}] [=extended attribute=] [=takes an identifier list=] |I|
9528+
:: The [=own exposure set=] is the [=/set=] |I|.
9529+
: If the [{{Exposed}}] [=extended attribute=] [=takes a wildcard=]
9530+
:: The [=own exposure set=] is the [=/set=] of all [=global names=] of all [=interfaces=]
9531+
which have the [{{Global}}] [=extended attribute=].
9532+
</dl>
9533+
9534+
<p class="advisement">
9535+
<code>[Exposed=*]</code> is to be used with care.
9536+
It is only appropriate when an API does not expose significant new capabilities.
9537+
If the API might be restricted or disabled in some environments,
9538+
it is preferred to list the globals explicitly.
9539+
</p>
9540+
9541+
<div algorithm>
95089542
To get the <dfn id="dfn-exposure-set" export>exposure set</dfn> of a construct |C|,
95099543
run the following steps:
95109544

0 commit comments

Comments
 (0)