Skip to content

Commit

Permalink
turn into promise
Browse files Browse the repository at this point in the history
  • Loading branch information
Garrett Tanzer committed Sep 13, 2023
1 parent 3e0848e commit fe169d6
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ macros into the [=fenced frame config/mapped url=] corresponding to a given [=ur
typedef (USVString or FencedFrameConfig) UrnOrConfig;

partial interface Navigator {
undefined deprecatedReplaceInURN(
Promise<undefined> deprecatedReplaceInURN(
UrnOrConfig urnOrConfig, record<USVString, USVString> replacements);
};
</pre>
Expand All @@ -1257,23 +1257,37 @@ partial interface Navigator {

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

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 |p| be [=a new promise=].

1. Let |config| be the result of [=fenced frame config mapping/finding a config=] in |mapping|
with |urn|.
1. Let |queue| be the result of [=starting a new parallel queue=].

1. If |config| is failure, [=exception/throw=] a {{TypeError}}.
1. [=parallel queue/enqueue steps|Enqueue the following steps=] to |queue|:

1. [=map/For each=] |key| → _ of |replacements|:
1. If |key| does not [=string/start with=] "${" or "%%", [=exception/throw=] a {{TypeError}}.
1. If |key| does not [=string/end with=] "}" or "%%", [=exception/throw=] a {{TypeError}}.
1. If |urn| is TODO invalid, then [=queue a task=] to [=reject=] |p| with a "{{TypeError}}"
and do not run the remaining steps.

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. 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. Set |config|'s [=fenced frame config/mapped url=]'s [=mapped url/value=] to |substitutedUrl|.
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.

1. [=map/For each=] |key| → _ of |replacements|:
1. If |key| does not [=string/start with=] "${" or "%%", [=exception/throw=] a {{TypeError}}.
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
Expand Down

0 comments on commit fe169d6

Please sign in to comment.