Skip to content

Commit

Permalink
Start consumption at source, not target.
Browse files Browse the repository at this point in the history
  • Loading branch information
mustaqahmed committed Jan 12, 2022
1 parent 526c93a commit 00ddca4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
12 changes: 8 additions & 4 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,20 @@ will be followed by two additional steps as follows:

8. If <var>delegate</var> is not null, then:

1. If <var ignore=''>targetOrigin</var> is a single U+002A ASTERISK character (*), then throw a
1. If <var ignore="">targetOrigin</var> is a single U+002A ASTERISK character (*), then throw a
a "NotAllowedError" DOMException.

2. If <var>targetWindow</var> has [transient
2. Let <var>source</var> be the {{WindowProxy}} object corresponding to <var
ignore="">incumbentSettings</var>'s [=global object=] (a {{Window}}
object).

3. If <var>source</var> has [transient
activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation),
then [consume user
activation](https://html.spec.whatwg.org/multipage/interaction.html#consume-user-activation)
in <var>targetWindow</var>.
in <var>source</var>.

3. Otherwise, set <var>delegate</var> to null.
4. Otherwise, set <var>delegate</var> to null.


# Tracking delegated capability # {#tracking-delegation}
Expand Down
39 changes: 28 additions & 11 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link href="https://www.w3.org/StyleSheets/TR/2016/cg-draft" rel="stylesheet">
<meta content="Bikeshed version 5c7bc9381, updated Wed May 12 18:18:08 2021 -0700" name="generator">
<link href="https://wicg.github.io/capability-delegation/spec.html" rel="canonical">
<meta content="07fa929fd39e840394f8be1d849078d944c18aaf" name="document-revision">
<meta content="526c93a18b3457277226761487459a976486b2ab" name="document-revision">
<style>/* style-autolinks */

.css.css, .property.property, .descriptor.descriptor {
Expand Down Expand Up @@ -563,7 +563,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">Capability Delegation</h1>
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Draft Community Group Report, <time class="dt-updated" datetime="2022-01-10">10 January 2022</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="profile-and-date"><span class="content">Draft Community Group Report, <time class="dt-updated" datetime="2022-01-12">12 January 2022</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down Expand Up @@ -751,18 +751,20 @@ <h3 class="heading settled" data-level="3.1" id="monkey-patch-to-html-initiating
<p>If <var>targetOrigin</var> is a single U+002A ASTERISK character (*), then throw a
a "NotAllowedError" DOMException.</p>
<li data-md>
<p>If <var>targetWindow</var> has <a href="https://html.spec.whatwg.org/multipage/interaction.html#transient-activation">transient
<p>Let <var>source</var> be the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#windowproxy" id="ref-for-windowproxy">WindowProxy</a></code> object corresponding to <var>incumbentSettings</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#global-object" id="ref-for-global-object">global object</a> (a <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code> object).</p>
<li data-md>
<p>If <var>source</var> has <a href="https://html.spec.whatwg.org/multipage/interaction.html#transient-activation">transient
activation</a>,
then <a href="https://html.spec.whatwg.org/multipage/interaction.html#consume-user-activation">consume user
activation</a> in <var>targetWindow</var>.</p>
activation</a> in <var>source</var>.</p>
<li data-md>
<p>Otherwise, set <var>delegate</var> to null.</p>
</ol>
</ol>
<h2 class="heading settled" data-level="4" id="tracking-delegation"><span class="secno">4. </span><span class="content">Tracking delegated capability</span><a class="self-link" href="#tracking-delegation"></a></h2>
<p>Capabilities delegated to a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context" id="ref-for-browsing-context①⓪">browsing context</a> will be tracked using a map
named <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code>.<a data-link-type="dfn" href="#delegated_capability_timestamps" id="ref-for-delegated_capability_timestamps">DELEGATED_CAPABILITY_TIMESTAMPS</a>. Each time a capability is
delegated to a <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code>, an entry will be added in <a data-link-type="dfn" href="#delegated_capability_timestamps" id="ref-for-delegated_capability_timestamps①">DELEGATED_CAPABILITY_TIMESTAMPS</a> with a key equal to the <a href="https://www.w3.org/TR/permissions-policy/#ascii-serialization">feature-identifier</a> representing the
named <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code>.<a data-link-type="dfn" href="#delegated_capability_timestamps" id="ref-for-delegated_capability_timestamps">DELEGATED_CAPABILITY_TIMESTAMPS</a>. Each time a capability is
delegated to a <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code>, an entry will be added in <a data-link-type="dfn" href="#delegated_capability_timestamps" id="ref-for-delegated_capability_timestamps①">DELEGATED_CAPABILITY_TIMESTAMPS</a> with a key equal to the <a href="https://www.w3.org/TR/permissions-policy/#ascii-serialization">feature-identifier</a> representing the
capability, and a value equal to current <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/hr-time-2/#dom-domhighrestimestamp" id="ref-for-dom-domhighrestimestamp">DOMHighResTimeStamp</a></code>. If the map
already has an entry for the same key, the existing value will be updated to
current <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/hr-time-2/#dom-domhighrestimestamp" id="ref-for-dom-domhighrestimestamp①">DOMHighResTimeStamp</a></code>.</p>
Expand All @@ -772,7 +774,7 @@ <h3 class="heading settled" data-level="4.1" id="monkey-patch-to-html-tracking-d
a new paragraph will be inserted, as follow:</p>
<blockquote>
<p>For the purpose of tracking capabilities delegated to a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context" id="ref-for-browsing-context①①">browsing context</a>,
each <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code> has a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ordered-map" id="ref-for-ordered-map">map</a> called <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="delegated_capability_timestamps">DELEGATED_CAPABILITY_TIMESTAMPS</dfn> from <a href="https://www.w3.org/TR/permissions-policy/#ascii-serialization">feature-identifier</a> to <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/hr-time-2/#dom-domhighrestimestamp" id="ref-for-dom-domhighrestimestamp②">DOMHighResTimeStamp</a></code>. The map is initialized with an empty map.</p>
each <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code> has a <a data-link-type="dfn" href="https://infra.spec.whatwg.org/#ordered-map" id="ref-for-ordered-map">map</a> called <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="delegated_capability_timestamps">DELEGATED_CAPABILITY_TIMESTAMPS</dfn> from <a href="https://www.w3.org/TR/permissions-policy/#ascii-serialization">feature-identifier</a> to <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/hr-time-2/#dom-domhighrestimestamp" id="ref-for-dom-domhighrestimestamp②">DOMHighResTimeStamp</a></code>. The map is initialized with an empty map.</p>
</blockquote>
<p>In the algorithm for <a href="https://html.spec.whatwg.org/multipage/web-messaging.html#window-post-message-steps">window post
message</a>,
Expand Down Expand Up @@ -824,7 +826,7 @@ <h3 class="heading settled" data-level="4.1" id="monkey-patch-to-html-tracking-d
</ol>
</ol>
<h2 class="heading settled" data-level="5" id="defining-delegated-behavior"><span class="secno">5. </span><span class="content">Defining delegated capability behavior</span><a class="self-link" href="#defining-delegated-behavior"></a></h2>
<p>Any capability that defines a delegated behavior uses the corresponding entry in <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code>.<a data-link-type="dfn" href="#delegated_capability_timestamps" id="ref-for-delegated_capability_timestamps③">DELEGATED_CAPABILITY_TIMESTAMPS</a> in a manner appropriate for the
<p>Any capability that defines a delegated behavior uses the corresponding entry in <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/window-object.html#window" id="ref-for-window">Window</a></code>.<a data-link-type="dfn" href="#delegated_capability_timestamps" id="ref-for-delegated_capability_timestamps③">DELEGATED_CAPABILITY_TIMESTAMPS</a> in a manner appropriate for the
capability. Below is the spec change needed for one particular capability.</p>
<h3 class="heading settled" data-level="5.1" id="monkey-patch-to-payment-req"><span class="secno">5.1. </span><span class="content">Monkey-patch to Payment Request spec</span><a class="self-link" href="#monkey-patch-to-payment-req"></a></h3>
<p>In the algorithm for <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/payment-request/#dom-paymentrequest-show" id="ref-for-dom-paymentrequest-show②">show()</a></code>, the following steps will be
Expand Down Expand Up @@ -924,9 +926,10 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<aside class="dfn-panel" data-for="term-for-window">
<a href="https://html.spec.whatwg.org/multipage/window-object.html#window">https://html.spec.whatwg.org/multipage/window-object.html#window</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-window">4. Tracking delegated capability</a> <a href="#ref-for-window①">(2)</a>
<li><a href="#ref-for-window②">4.1. Monkey-patch to HTML spec</a>
<li><a href="#ref-for-window③">5. Defining delegated capability behavior</a>
<li><a href="#ref-for-window">3.1. Monkey-patch to HTML spec</a>
<li><a href="#ref-for-window①">4. Tracking delegated capability</a> <a href="#ref-for-window②">(2)</a>
<li><a href="#ref-for-window③">4.1. Monkey-patch to HTML spec</a>
<li><a href="#ref-for-window④">5. Defining delegated capability behavior</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-windowpostmessageoptions">
Expand All @@ -936,6 +939,12 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<li><a href="#ref-for-windowpostmessageoptions①">3.1. Monkey-patch to HTML spec</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-windowproxy">
<a href="https://html.spec.whatwg.org/multipage/window-object.html#windowproxy">https://html.spec.whatwg.org/multipage/window-object.html#windowproxy</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-windowproxy">3.1. Monkey-patch to HTML spec</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-dom-iframe-allow">
<a href="https://html.spec.whatwg.org/multipage/iframe-embed-object.html#dom-iframe-allow">https://html.spec.whatwg.org/multipage/iframe-embed-object.html#dom-iframe-allow</a><b>Referenced in:</b>
<ul>
Expand All @@ -954,6 +963,12 @@ <h3 class="no-num no-ref heading settled" id="index-defined-here"><span class="c
<li><a href="#ref-for-browsing-context①①">4.1. Monkey-patch to HTML spec</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-global-object">
<a href="https://html.spec.whatwg.org/multipage/webappapis.html#global-object">https://html.spec.whatwg.org/multipage/webappapis.html#global-object</a><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-global-object">3.1. Monkey-patch to HTML spec</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="term-for-dom-open">
<a href="https://html.spec.whatwg.org/multipage/window-object.html#dom-open">https://html.spec.whatwg.org/multipage/window-object.html#dom-open</a><b>Referenced in:</b>
<ul>
Expand Down Expand Up @@ -990,8 +1005,10 @@ <h3 class="no-num no-ref heading settled" id="index-defined-elsewhere"><span cla
<ul>
<li><span class="dfn-paneled" id="term-for-window">Window</span>
<li><span class="dfn-paneled" id="term-for-windowpostmessageoptions">WindowPostMessageOptions</span>
<li><span class="dfn-paneled" id="term-for-windowproxy">WindowProxy</span>
<li><span class="dfn-paneled" id="term-for-dom-iframe-allow">allow</span>
<li><span class="dfn-paneled" id="term-for-browsing-context">browsing context</span>
<li><span class="dfn-paneled" id="term-for-global-object">global object</span>
<li><span class="dfn-paneled" id="term-for-dom-open">open(url, target, features)</span>
</ul>
<li>
Expand Down

0 comments on commit 00ddca4

Please sign in to comment.