From 3e33a5e57f4bd65f3bae12cfaaee205bfc22e8b3 Mon Sep 17 00:00:00 2001 From: Garrett Tanzer Date: Wed, 6 Sep 2023 18:43:40 +0000 Subject: [PATCH 1/6] spec deprecatedreplaceinurn --- spec.bs | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/spec.bs b/spec.bs index cf8b504..31ddb15 100644 --- a/spec.bs +++ b/spec.bs @@ -1222,6 +1222,64 @@ Each {{FencedFrameConfig}} has: 1. Initialize |value|'s [=fencedframeconfig/contentHeight=] to |serialized|.\[[ContentHeight]]. +To help with ease of adoption, +until 2026 we +will support 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}}. + +
+typedef (USVString or FencedFrameConfig) UrnOrConfig;
+
+partial interface Navigator {
+  undefined deprecatedReplaceInURN(
+    UrnOrConfig urnOrConfig, record<USVString, USVString> replacements);
+};
+
+ +
+ To substitute macros with an [=ordered map=] with + [=string=] [=map/keys=] and [=string=] [=map/values=] |macros| into a [=string=] |string|, run + these steps: + + 1. TODO: [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. +
+ +
+ The deprecatedReplaceInURN(|urnOrConfig|, |replacements|) + 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 |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, [=exception/throw=] a {{TypeError}}. + + 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|. + + + /fenced-frame/deprecated-config-apis.https.html + +
+

The {{Fence}} interface

Several APIs specific to fenced frames are defined on the {{Fence}} interface. From 7e7fe0a1fa14ff582311145868d3736478df50a4 Mon Sep 17 00:00:00 2001 From: Garrett Tanzer Date: Wed, 6 Sep 2023 18:46:04 +0000 Subject: [PATCH 2/6] fix compile error --- spec.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec.bs b/spec.bs index 31ddb15..90c7c33 100644 --- a/spec.bs +++ b/spec.bs @@ -1248,7 +1248,7 @@ partial interface Navigator {
- The deprecatedReplaceInURN(|urnOrConfig|, |replacements|) + The deprecatedReplaceInURN(|urnOrConfig|, |replacements|) method steps are: 1. Let |urn| be null. From 3e0848ec8f1ffa9299343a877f189ce2e6686841 Mon Sep 17 00:00:00 2001 From: Garrett Tanzer Date: Wed, 6 Sep 2023 18:56:09 +0000 Subject: [PATCH 3/6] update link and todo formatting --- spec.bs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/spec.bs b/spec.bs index 90c7c33..5fe7937 100644 --- a/spec.bs +++ b/spec.bs @@ -1223,10 +1223,10 @@ Each {{FencedFrameConfig}} has:
To help with ease of adoption, -until 2026 we -will support 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}}. +[until 2026](https://github.com/WICG/turtledove/issues/286#issuecomment-1682842636) we will support +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}}.
 typedef (USVString or FencedFrameConfig) UrnOrConfig;
@@ -1242,9 +1242,9 @@ partial interface Navigator {
   [=string=] [=map/keys=] and [=string=] [=map/values=] |macros| into a [=string=] |string|, run
   these steps:
 
-  1. TODO: [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.
+  1. TODO: [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.
 
 
 
From fe169d6820fe25f93bd09b608325a2768f9f66bb Mon Sep 17 00:00:00 2001 From: Garrett Tanzer Date: Wed, 13 Sep 2023 18:49:27 +0000 Subject: [PATCH 4/6] turn into promise --- spec.bs | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/spec.bs b/spec.bs index 5fe7937..ddadee3 100644 --- a/spec.bs +++ b/spec.bs @@ -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); };
@@ -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|. /fenced-frame/deprecated-config-apis.https.html From 23c74085405bfec3bad437a50541e11b51dfbc94 Mon Sep 17 00:00:00 2001 From: Garrett Tanzer Date: Fri, 22 Sep 2023 13:57:47 +0000 Subject: [PATCH 5/6] address comments --- spec.bs | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/spec.bs b/spec.bs index ddadee3..1bcc336 100644 --- a/spec.bs +++ b/spec.bs @@ -1222,7 +1222,7 @@ Each {{FencedFrameConfig}} has: 1. Initialize |value|'s [=fencedframeconfig/contentHeight=] to |serialized|.\[[ContentHeight]]. -To help with ease of adoption, +Note: To help with ease of adoption, [until 2026](https://github.com/WICG/turtledove/issues/286#issuecomment-1682842636) we will support 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 @@ -1244,7 +1244,7 @@ partial interface Navigator { 1. TODO: [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. + new string. There is no recursive substitution.
@@ -1257,35 +1257,37 @@ partial interface Navigator { 1. Otherwise, set |urn| to |urnOrConfig|'s [=fencedframeconfig/urn=]. - 1. Let |p| be [=a new promise=]. + 1. If |urn| is TODO invalid, [=exception/throw=] a {{TypeError}}. + + 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 |queue| be the result of [=starting a new parallel queue=]. + 1. Let |p| be [=a new promise=]. - 1. [=parallel queue/enqueue steps|Enqueue the following steps=] to |queue|: + 1. Let |global| be [=this=]'s [=relevant global object=]. - 1. If |urn| is TODO invalid, then [=queue a task=] to [=reject=] |p| with a "{{TypeError}}" - and do not run the remaining steps. + 1. Run the following steps [=in parallel=]: - 1. Let |mapping| be [=this=]'s [=relevant global object=]'s [=associated Document=]'s + 1. Let |mapping| be |global|'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. - - 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 |config| is failure, [=queue a task=] to [=resolve=] |p| with {{undefined}} and abort + these 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. Set |config|'s [=fenced frame config/mapped url=]'s [=mapped url/value=] to |substitutedUrl|. + 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. [=Queue a task=] to [=resolve=] |p| with {{undefined}}. 1. Return |p|. From 6600ce4b9db761a1d8fb137b428f1b2364367589 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Fri, 22 Sep 2023 10:37:20 -0400 Subject: [PATCH 6/6] Specify global and task source --- spec.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec.bs b/spec.bs index 1bcc336..24ff365 100644 --- a/spec.bs +++ b/spec.bs @@ -1271,15 +1271,14 @@ partial interface Navigator { 1. Run the following steps [=in parallel=]: - 1. Let |mapping| be |global|'s [=associated Document=]'s - [=node navigable=]'s [=navigable/traversable navigable=]'s - [=traversable navigable/fenced frame config mapping=]. + 1. Let |mapping| be |global|'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 abort - these steps. + 1. If |config| is failure, [=queue a global task=] on the [=DOM manipulation task source=] + given |global|, to [=resolve=] |p| with {{undefined}}, and abort these 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=]. @@ -1287,7 +1286,8 @@ partial interface Navigator { 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. [=Queue a global task=] on the [=DOM manipulation task source=] given |global|, to + [=resolve=] |p| with {{undefined}}. 1. Return |p|.