@@ -73335,7 +73335,7 @@ END:VCARD</pre>
73335
73335
seconds, so that the user can possibly perceive the link between an interaction with the page and
73336
73336
the page calling the activation-gated API.</p>
73337
73337
73338
- <p>These two values imply two boolean user activation states for <var>W</var>:</p>
73338
+ <p>These two values imply two boolean <dfn> user activation states</dfn> for <var>W</var>:</p>
73339
73339
73340
73340
<dl>
73341
73341
<dt><dfn data-export="">Sticky activation</dfn></dt>
@@ -73481,6 +73481,74 @@ END:VCARD</pre>
73481
73481
</dl>
73482
73482
73483
73483
73484
+ <h4>The <code>UserActivation</code> interface</h4>
73485
+
73486
+ <p>The <span>user activation states</span> are exposed via the <code>UserActivation</code>
73487
+ interface. <code>UserActivation</code> objects can be created either as a live or snapshot object,
73488
+ it depends on how the object was referenced. Objects accessed via <code>navigator</code>'s <code
73489
+ data-x="dom-Navigator-userActivation">userActivation</code> attribute are live, in that changes
73490
+ will in the <span>user activation states</span> will be reflected in the attributes of the object.
73491
+ <code>UserActivation</code> objects retrieved via <code>MessageEvent</code>'s <code
73492
+ data-x="dom-MessageEvent-userActivation">userActivation</code> attribute will be snapshot objects,
73493
+ that is a snapshot of the source's state.</p>
73494
+
73495
+ <pre><code class="idl" data-x="">[Exposed=(Window,Worker,AudioWorklet)]
73496
+ interface <dfn>UserActivation</dfn> {
73497
+ readonly attribute boolean <span data-x="dom-UserActivation-hasBeenActive">hasBeenActive</span>;
73498
+ readonly attribute boolean <span data-x="dom-UserActivation-isActive">isActive</span>;
73499
+ };
73500
+
73501
+ partial interface <span id="NavigatorUserActivation-partial">Navigator</span> {
73502
+ [SameObject] readyonly attribute <code>UserActivation</code> <span data-x="dom-Navigator-userActivation">userActivation</span>;
73503
+ };</code></pre>
73504
+
73505
+ <dl class="domintro">
73506
+
73507
+ <dt><var>navigator</var> . <code subdfn
73508
+ data-x="dom-Navigator-userActivation">userActivation</code></dt>
73509
+
73510
+ <dd>
73511
+
73512
+ <p>Returns the a live object representing the current <span>user activation states</span>.</p>
73513
+
73514
+ </dd>
73515
+
73516
+ <dt><var>userActivation</var> . <code subdfn
73517
+ data-x="dom-UserActivation-hasBeenActive">hasBeenActive</code></dt>
73518
+
73519
+ <dd>
73520
+
73521
+ <p>Returns the state of the <span>sticky activation</span>.</p>
73522
+
73523
+ </dd>
73524
+
73525
+ <dt><var>userActivation</var> . <code subdfn
73526
+ data-x="dom-UserActivation-isActive">isActive</code></dt>
73527
+
73528
+ <dd>
73529
+
73530
+ <p>Returns the state of the <span>transient activation</span>.</p>
73531
+
73532
+ </dd>
73533
+
73534
+ </dl>
73535
+
73536
+ <div w-nodev>
73537
+
73538
+ <p>The <dfn><code data-x="dom-UserActivation-hasBeenActive">hasBeenActive</code></dfn> attribute
73539
+ must return the state of the <span>sticky activation</span>. If the object is live it must
73540
+ always reflect the current state. If the object is a snapshot it must reflect the state at which
73541
+ the time the object was created.</p>
73542
+
73543
+ <p>The <dfn><code data-x="dom-UserActivation-isActive">isActive</code></dfn> attribute must return
73544
+ the state of the <span>transient activation</span>. If the object is live it must always
73545
+ reflect the current state. If the object is a snapshot it must reflect the state at which the time
73546
+ the object was created.</p>
73547
+
73548
+ <p>The <dfn><code data-x="dom-Navigator-userActivation">userActivation</code></dfn> attribute must
73549
+ return a live representation of the <span>user activation states</span>.</p>
73550
+
73551
+ </div>
73484
73552
73485
73553
<h3 id="activation">Activation behavior of elements</h3>
73486
73554
@@ -96717,6 +96785,7 @@ interface <dfn>MessageEvent</dfn> : <span>Event</span> {
96717
96785
readonly attribute DOMString <span data-x="dom-MessageEvent-lastEventId">lastEventId</span>;
96718
96786
readonly attribute <span>MessageEventSource</span>? <span data-x="dom-MessageEvent-source">source</span>;
96719
96787
readonly attribute FrozenArray<<span>MessagePort</span>> <span data-x="dom-MessageEvent-ports">ports</span>;
96788
+ readonly attribute <span>UserActivation</span>? <span data-x="dom-MessageEvent-userActivation">userActivation</span>;
96720
96789
96721
96790
void <span data-x="dom-MessageEvent-initMessageEvent">initMessageEvent</span>(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional any data = null, optional USVString origin = "", optional DOMString lastEventId = "", optional <span>MessageEventSource</span>? source = null, optional sequence<<span>MessagePort</span>> ports = []);
96722
96791
};
@@ -96727,6 +96796,7 @@ dictionary <dfn>MessageEventInit</dfn> : <span>EventInit</span> {
96727
96796
DOMString lastEventId = "";
96728
96797
<span>MessageEventSource</span>? source = null;
96729
96798
sequence<<span>MessagePort</span>> ports = [];
96799
+ <span>UserActivation</span>? userActivation = null;
96730
96800
};
96731
96801
96732
96802
typedef (<span>WindowProxy</span> or <span>MessagePort</span> or <span>ServiceWorker</span>) <dfn>MessageEventSource</dfn>;</code></pre>
@@ -96779,6 +96849,15 @@ typedef (<span>WindowProxy</span> or <span>MessagePort</span> or <span>ServiceWo
96779
96849
96780
96850
</dd>
96781
96851
96852
+ <dt><var>event</var> . <code subdfn data-x="dom-MessageEvent-userActivation">userActivation</code></dt>
96853
+
96854
+ <dd>
96855
+
96856
+ <p>Returns a snapshot of the <code>UserActivation</code> state in the
96857
+ source at the time of <code data-x="dom-window-postMessage">postMessage()</code>.</p>
96858
+
96859
+ </dd>
96860
+
96782
96861
<!-- initMessageEvent is deprecated -->
96783
96862
96784
96863
</dl>
@@ -96811,6 +96890,10 @@ typedef (<span>WindowProxy</span> or <span>MessagePort</span> or <span>ServiceWo
96811
96890
value it was initialized to. It represents, in <span>cross-document messaging</span> and
96812
96891
<span>channel messaging</span>, the <code>MessagePort</code> array being sent.</p>
96813
96892
96893
+ <p>The <dfn><code data-x="dom-MessageEvent-userActivation">userActivation</code></dfn> attribute
96894
+ must return the value it was initialized to. It represents the <span>UserActivation</span> state
96895
+ at the source.</p>
96896
+
96814
96897
<!-- handwavy, file bugs if there are interop issues -->
96815
96898
<p>The <dfn><code data-x="dom-MessageEvent-initMessageEvent">initMessageEvent()</code></dfn>
96816
96899
method must initialize the event in a manner analogous to the similarly-named <code
@@ -98751,6 +98834,12 @@ function receiver(e) {
98751
98834
window, in same-origin cases. See discussion at
98752
98835
https://github.com/whatwg/html/issues/1542#issuecomment-233502636 -->
98753
98836
98837
+ <li><p>Let userActivationSnapshot be null</p></li>
98838
+
98839
+ <li><p>If <var>options</var>'s <code data-x="">includeUserActivation</code> member is true, set
98840
+ userActivationSnapshot to be <var>incumbent settings</var>'s <span>global object</span>'s (if
98841
+ available) <span>user activation states</span>.</p></li>
98842
+
98754
98843
<li><p>Let <var>targetOrigin</var> be <var>options</var>["<code
98755
98844
data-x="">targetOrigin</code>"].</p></li>
98756
98845
@@ -98824,8 +98913,10 @@ function receiver(e) {
98824
98913
attribute initialized to <var>origin</var>, the <code
98825
98914
data-x="dom-MessageEvent-source">source</code> attribute initialized to <var>source</var>, the
98826
98915
<code data-x="dom-MessageEvent-data">data</code> attribute initialized to
98827
- <var>messageClone</var>, and the <code data-x="dom-MessageEvent-ports">ports</code> attribute
98828
- initialized to <var>newPorts</var>.</p></li>
98916
+ <var>messageClone</var>, the <code data-x="dom-MessageEvent-ports">ports</code> attribute
98917
+ initialized to <var>newPorts</var>, and the <code
98918
+ data-x="dom-MessageEvent-userActivation">userActivation</code> attribute initialized to
98919
+ <var>userActivationSnapshot</var>.</p></li>
98829
98920
</ol>
98830
98921
</li>
98831
98922
</ol>
@@ -99140,6 +99231,7 @@ interface <dfn>MessagePort</dfn> : <span>EventTarget</span> {
99140
99231
99141
99232
dictionary <dfn>PostMessageOptions</dfn> {
99142
99233
sequence<<span data-x="idl-object">object</span>> transfer = [];
99234
+ boolean includeUserActivation = false;
99143
99235
};</code></pre>
99144
99236
99145
99237
<dl class="domintro">
@@ -99304,6 +99396,14 @@ dictionary <dfn>PostMessageOptions</dfn> {
99304
99396
<code>MessagePort</code>, then throw a <span>"<code>DataCloneError</code>"</span>
99305
99397
<code>DOMException</code>.</p></li>
99306
99398
99399
+ <li><p>Let userActivationSnapshot be null.</p></li>
99400
+
99401
+ <li><p>Let <var>incumbent settings</var> be the <span>incumbent settings object</span>.</p></li>
99402
+
99403
+ <li><p>If <var>options</var>'s <code data-x="">includeUserActivation</code> member is true, set
99404
+ userActivationSnapshot to be <var>incumbent settings</var>'s <span>global object</span>'s (if
99405
+ available) <span>user activation states</span>.</p></li>
99406
+
99307
99407
<li><p>Let <var>doomed</var> be false.</p></li>
99308
99408
99309
99409
<li><p>If <var>targetPort</var> is not null and <var>transfer</var> <span data-x="list
@@ -99358,9 +99458,10 @@ dictionary <dfn>PostMessageOptions</dfn> {
99358
99458
<li><p><span data-x="concept-event-fire">Fire an event</span> named <code
99359
99459
data-x="event-message">message</code> at <var>finalTargetPort</var>, using
99360
99460
<code>MessageEvent</code>, with the <code data-x="dom-MessageEvent-data">data</code> attribute
99361
- initialized to <var>messageClone</var> and the <code
99362
- data-x="dom-MessageEvent-ports">ports</code> attribute initialized to
99363
- <var>newPorts</var>.</p></li>
99461
+ initialized to <var>messageClone</var>, the <code data-x="dom-MessageEvent-ports">ports</code>
99462
+ attribute initialized to <var>newPorts</var>, and the <code
99463
+ data-x="dom-MessageEvent-userActivation">userActivation</code> attribute initialized to
99464
+ <var>userActivationSnapshot</var>.</p></li>
99364
99465
</ol>
99365
99466
</li>
99366
99467
</ol>
@@ -99430,6 +99531,11 @@ dictionary <dfn>PostMessageOptions</dfn> {
99430
99531
message queue</span> must be enabled, as if the <code data-x="dom-MessagePort-start">start()</code>
99431
99532
method had been called.</p>
99432
99533
99534
+ <p>If a <code>MessagePort</code> object's <code
99535
+ data-x="handler-MessagePort-onmessage">onmessage</code> IDL attribute is set, the port's <span>port
99536
+ message queue</span> must be enabled, as if the <code data-x="dom-MessagePort-start">start()</code>
99537
+ method had been called.</p>
99538
+
99433
99539
</div>
99434
99540
99435
99541
0 commit comments