Skip to content

Commit

Permalink
Spec deprecatedURNtoURL (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
JensenPaul authored Jun 6, 2024
1 parent 4966a9e commit 09f6c66
Showing 1 changed file with 53 additions and 5 deletions.
58 changes: 53 additions & 5 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ A <dfn for=fencedframetype>destination event</dfn> is either a

Note: The pending event will be sent asynchronously.

1. [=Assert=] that |reporting map|[|destination|] is a [=map=] (i.e. that |destination|'s
1. [=Assert=] that |reporting map|[|destination|] is a [=map=] (i.e., that |destination|'s
metadata has been finalized).

1. [=Send a beacon=] with |reporting map|[|destination|] and |event|.
Expand Down Expand Up @@ -1437,12 +1437,20 @@ the API {{Window/navigator}}.{{Navigator/deprecatedReplaceInURN()}}, which allow
macros into the [=fenced frame config/mapped url=] corresponding to a given [=urn uuid=] or
{{FencedFrameConfig}}.

Note: To help with ease of adoption,
[until third party cookie deprecation](https://developers.google.com/privacy-sandbox/relevance/protected-audience-api/feature-status#fenced_frames)
we will support the API {{Window/navigator}}.{{Navigator/deprecatedURNtoURL()}}, which returns
the [=fenced frame config/mapped url=] corresponding to a given [=urn uuid=] or
{{FencedFrameConfig}}.

<pre class=idl>
typedef (USVString or FencedFrameConfig) UrnOrConfig;

partial interface Navigator {
Promise&lt;undefined&gt; deprecatedReplaceInURN(
UrnOrConfig urnOrConfig, record&lt;USVString, USVString&gt; replacements);
Promise&lt;USVString&gt; deprecatedURNtoURL(
UrnOrConfig urnOrConfig, optional boolean send_reports = false);
sequence&lt;USVString&gt; adAuctionComponents(unsigned short numAdComponents);
};
</pre>
Expand All @@ -1467,7 +1475,8 @@ partial interface Navigator {

1. Otherwise, set |urn| to |urnOrConfig|'s [=fencedframeconfig/urn=].

1. If |urn| is <span class=XXX>TODO invalid</span>, [=exception/throw=] a {{TypeError}}.
1. If |urn| is not a valid [=urn uuid=] (i.e., won't pass the ABNF in Section 3 of
[=urn uuid=]), [=exception/throw=] a {{TypeError}}.

1. [=map/For each=] |key| → _ of |replacements|:
1. If |key| does not [=string/start with=] <code>${</code> or <code>%%</code>,
Expand All @@ -1481,7 +1490,7 @@ partial interface Navigator {

1. Run the following steps [=in parallel=]:

1. Let |mapping| be |global|'s [=associated Document=]'s [=node navigable=]'s
1. Let |mapping| be |global|'s [=Window/navigable=]'s
[=navigable/traversable navigable=]'s [=traversable navigable/fenced frame config mapping=].

1. Let |config| be the result of [=fenced frame config mapping/finding a config=] in |mapping|
Expand All @@ -1507,7 +1516,47 @@ partial interface Navigator {
</div>

<div algorithm>
The <dfn method for=Navigator>deprecatedURNtoURL(|urnOrConfig|, |send_reports|)</dfn> method
steps are:

1. Let |urn| be null.

1. If |urnOrConfig| is a {{USVString}}, set |urn| to |urnOrConfig|.

1. Otherwise, set |urn| to |urnOrConfig|'s [=fencedframeconfig/urn=].

1. If |urn| is not a valid [=urn uuid=] (i.e., won't pass the ABNF in Section 3 of
[=urn uuid=]), [=exception/throw=] a {{TypeError}}.

1. Let |p| be [=a new promise=].

1. Let |global| be [=this=]'s [=relevant global object=].

1. Run the following steps [=in parallel=]:

1. Let |mapping| be |global|'s [=Window/navigable=]'s
[=navigable/traversable navigable=]'s [=traversable navigable/fenced frame config mapping=].

1. If |mapping|'s [=fenced frame config mapping/finalized config mapping=][|urn|], does not
[=map/exist=], then [=queue a global task=] on the [=DOM manipulation task source=]
given |global|, to [=resolve=] |p| with {{undefined}}, and abort these steps.

1. Let |config| be |mapping|'s [=fenced frame config mapping/finalized config mapping=][|urn|].

1. [=Queue a global task=] on the [=DOM manipulation task source=] given |global|, to
[=resolve=] |p| with |config|'s [=fenced frame config/mapped url=]'s [=mapped url/value=].

1. If |send_reports| is true, then run the steps in |config|'s
[=fenced frame config/on navigate callback=].

1. Return |p|.

<wpt>
/fenced-frame/deprecated-config-apis.https.html
</wpt>
</div>

<div algorithm>
The <dfn method for=Navigator>adAuctionComponents(|numAdComponents|)</dfn>

1. Let |instance| be [=this=]'s [=relevant global object=]'s [=Window/browsing context=]'s
Expand Down Expand Up @@ -1535,7 +1584,6 @@ partial interface Navigator {
1. Set |numAdComponents| to |numAdComponents| &minus; 1.

1. Return |adComponentsURNs|.

</div>

<h3 id=fence-interface>The {{Fence}} interface</h3>
Expand Down Expand Up @@ -1685,7 +1733,7 @@ Several APIs specific to fenced frames are defined on the {{Fence}} interface.
/fenced-frame/fence-report-event-cross-origin-urn-iframe-no-embedder-opt-in.https.html
/fenced-frame/fence-report-event-cross-origin-urn-iframe-no-subframe-opt-in.https.html
/fenced-frame/fence-report-event-cross-origin-urn-iframe.https.html
/fenced-frame/fence-report-event-cross-origin.https.html
/fenced-frame/fence-report-event-cross-origin.sub.https.html
/fenced-frame/fence-report-event-sub-fencedframe.https.html
</wpt>
</div>
Expand Down

0 comments on commit 09f6c66

Please sign in to comment.