Skip to content

Commit d720ef3

Browse files
authored
Ensure [Exposed=*] works when the global object is not defined using IDL
This is important for ShadowRealm globals in particular.
1 parent b3b44cc commit d720ef3

File tree

1 file changed

+32
-19
lines changed

1 file changed

+32
-19
lines changed

index.bs

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9402,16 +9402,16 @@ The [{{Exposed}}] [=extended attribute=] must either
94029402
[=takes a wildcard|take a wildcard=].
94039403
Each of the identifiers mentioned must be a [=global name=] of some [=interface=] and be unique.
94049404

9405-
The <dfn>own exposure set</dfn> is the [=/set=] of identifiers defined as follows:
9405+
The <dfn>own exposure set</dfn> is either a [=/set=] of identifiers or the special value
9406+
<code>*</code>, defined as follows:
94069407

94079408
<dl class="switch">
94089409
: If the [{{Exposed}}] [=extended attribute=] [=takes an identifier=] |I|
94099410
:: The [=own exposure set=] is the [=/set=] « |I| ».
94109411
: If the [{{Exposed}}] [=extended attribute=] [=takes an identifier list=] |I|
94119412
:: The [=own exposure set=] is the [=/set=] |I|.
94129413
: If the [{{Exposed}}] [=extended attribute=] [=takes a wildcard=]
9413-
:: The [=own exposure set=] is the [=/set=] of all [=global names=] of all [=interfaces=]
9414-
which have the [{{Global}}] [=extended attribute=].
9414+
:: The [=own exposure set=] is <code>*</code>.
94159415
</dl>
94169416

94179417
<p class="advisement">
@@ -9421,6 +9421,23 @@ The <dfn>own exposure set</dfn> is the [=/set=] of identifiers defined as follow
94219421
it is preferred to list the globals explicitly.
94229422
</p>
94239423

9424+
<div algorithm>
9425+
9426+
The <dfn>exposure set intersection</dfn> of a construct |C| and interface-or-null |H| is defined as
9427+
follows:
9428+
9429+
1. Assert: |C| is an [=interface member=], [=interface mixin member=], [=namespace member=],
9430+
[=partial interface=], [=partial interface mixin=], [=partial namespace=], or
9431+
[=interface mixin=].
9432+
1. Assert: |H| is an [=interface=] or null.
9433+
1. If |H| is null, return |C|'s [=own exposure set=].
9434+
1. If |C|'s [=own exposure set=] is <code>*</code>, return |H|'s [=exposure set=].
9435+
1. If |H|'s [=exposure set=] is <code>*</code>, return |C|'s [=own exposure set=].
9436+
1. Return the [=set/intersection=] of |C|'s [=own exposure set=] and |H|'s
9437+
[=exposure set=].
9438+
9439+
</div>
9440+
94249441
<div algorithm>
94259442
To get the <dfn id="dfn-exposure-set" export>exposure set</dfn> of a construct |C|,
94269443
run the following steps:
@@ -9429,27 +9446,23 @@ The <dfn>own exposure set</dfn> is the [=/set=] of identifiers defined as follow
94299446
[=interface member=], [=interface mixin member=], or [=namespace member=].
94309447
1. Let |H| be |C|'s [=host interface=] if |C| is an [=interface mixin member=], or null otherwise.
94319448
1. If |C| is an [=interface member=], [=interface mixin member=], or [=namespace member=], then:
9432-
1. If the [{{Exposed}}] [=extended attribute=] is specified on |C|, then:
9433-
1. If |H| is set, return the [=set/intersection=] of |C|'s [=own exposure set=]
9434-
and |H|'s [=exposure set=].
9435-
1. Otherwise, return |C|'s [=own exposure set=].
9436-
1. Otherwise, set |C| to be the
9449+
1. If the [{{Exposed}}] [=extended attribute=] is specified on |C|,
9450+
return the [=exposure set intersection=] of |C| and |H|.
9451+
1. Set |C| to the
94379452
[=interface=], [=partial interface=],
94389453
[=interface mixin=], [=partial interface mixin=],
94399454
[=namespace=], or [=partial namespace=]
94409455
|C| is declared on.
94419456
1. If |C| is a [=partial interface=], [=partial interface mixin=], or [=partial namespace=], then:
9442-
1. If the [{{Exposed}}] [=extended attribute=] is specified on |C|, then:
9443-
1. If |H| is set, return the [=set/intersection=] of |C|'s [=own exposure set=]
9444-
and |H|'s [=exposure set=].
9445-
1. Otherwise, return |C|'s [=own exposure set=].
9446-
1. Otherwise, set |C| to be the original [=interface=], [=interface mixin=], or [=namespace=]
9447-
definition of |C|.
9457+
1. If the [{{Exposed}}] [=extended attribute=] is specified on |C|,
9458+
return the [=exposure set intersection=] of |C| and |H|.
9459+
1. Set |C| to the original [=interface=], [=interface mixin=], or [=namespace=] definition
9460+
of |C|.
94489461
1. If |C| is an [=interface mixin=], then:
9462+
1. Assert: |H| is not null.
94499463
1. If the [{{Exposed}}] [=extended attribute=] is specified on |C|,
9450-
then return the [=set/intersection=] of |C|'s [=own exposure set=]
9451-
and |H|'s [=exposure set=].
9452-
1. Otherwise, set |C| to |H|.
9464+
return the [=exposure set intersection=] of |C| and |H|.
9465+
1. Set |C| to |H|.
94539466
1. Assert: |C| is an [=interface=], [=callback interface=] or [=namespace=].
94549467
1. Assert: The [{{Exposed}}] [=extended attribute=] is specified on |C|.
94559468
1. Return |C|'s [=own exposure set=].
@@ -9503,8 +9516,8 @@ Otherwise, it is the [=host interface=]'s [=exposure set=].
95039516
<dfn id="dfn-exposed" export>exposed</dfn> in a given [=Realm=] |realm| if the following steps
95049517
return true:
95059518

9506-
1. If |realm|.\[[GlobalObject]] does not implement an [=interface=]
9507-
that is in |construct|'s [=exposure set=], then return false.
9519+
1. If |construct|'s [=exposure set=] is not <code>*</code>, and |realm|.\[[GlobalObject]] does
9520+
not implement an [=interface=] that is in |construct|'s [=exposure set=], then return false.
95089521
1. If |realm|'s [=Realm/settings object=] is not a [=secure context=], and |construct| is
95099522
[=conditionally exposed=] on [{{SecureContext}}], then return false.
95109523
1. If |realm|'s [=Realm/settings object=]'s

0 commit comments

Comments
 (0)