Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec deprecatedReplaceInURN #117

Merged
merged 6 commits into from
Sep 22, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,78 @@ Each {{FencedFrameConfig}} has:
1. Initialize |value|'s [=fencedframeconfig/contentHeight=] to |serialized|.\[[ContentHeight]].
</div>

To help with ease of adoption,
gtanzer marked this conversation as resolved.
Show resolved Hide resolved
[until 2026](https://github.com/WICG/turtledove/issues/286#issuecomment-1682842636) we will support
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes it sound like we're actually indeed removing the API in 2026. Are we? Or are we just "deprecating" it softly then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been deprecated since it was added, hence the name. It should actually be removed in several years.

the API {{Window/navigator}}.{{Navigator/deprecatedReplaceInURN()}}, which allows you to substitute
macros into 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);
};
</pre>

<div algorithm>
To <dfn export for=fencedframeutil>substitute macros</dfn> with an [=ordered map=] with
domfarolino marked this conversation as resolved.
Show resolved Hide resolved
[=string=] [=map/keys=] and [=string=] [=map/values=] |macros| into a [=string=] |string|, run
these steps:

1. <span class=XXX>TODO:</span> [Spec this](https://github.com/WICG/fenced-frame/issues/116).
Substitute the keys from |macros| with the corresponding values into |string|, and return the
new string. There should be no recursive substitution.
gtanzer marked this conversation as resolved.
Show resolved Hide resolved
</div>

<div algorithm>
The <dfn method for=Navigator>deprecatedReplaceInURN(|urnOrConfig|, |replacements|)</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. Let |p| be [=a new promise=].

1. Let |queue| be the result of [=starting a new parallel queue=].
gtanzer marked this conversation as resolved.
Show resolved Hide resolved

1. [=parallel queue/enqueue steps|Enqueue the following steps=] to |queue|:

1. If |urn| is TODO invalid, then [=queue a task=] to [=reject=] |p| with a "{{TypeError}}"
gtanzer marked this conversation as resolved.
Show resolved Hide resolved
gtanzer marked this conversation as resolved.
Show resolved Hide resolved
and do not run the remaining steps.

1. Let |mapping| be [=this=]'s [=relevant global object=]'s [=associated Document=]'s
[=node 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|
with |urn|.

1. If |config| is failure, [=queue a task=] to [=resolve=] |p| with `undefined` and do not run
the remaining steps.
gtanzer marked this conversation as resolved.
Show resolved Hide resolved

1. [=map/For each=] |key| → _ of |replacements|:
1. If |key| does not [=string/start with=] "${" or "%%", [=exception/throw=] a {{TypeError}}.
gtanzer marked this conversation as resolved.
Show resolved Hide resolved
1. If |key| does not [=string/end with=] "}" or "%%", [=exception/throw=] a {{TypeError}}.

1. Let |substitutedUrl| be the result of [=fencedframeutil/substituting macros=] with
|replacements| into |config|'s [=fenced frame config/mapped url=]'s [=mapped url/value=].

1. Set |config|'s [=fenced frame config/mapped url=]'s [=mapped url/value=] to |substitutedUrl|.

1. [=Queue a task=] to [=resolve=] |p| with `undefined`.

1. Return |p|.

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

<h3 id=fence-interface>The {{Fence}} interface</h3>

Several APIs specific to fenced frames are defined on the {{Fence}} interface.
Expand Down