Skip to content

Commit 5a9bd2a

Browse files
committed
CREDENTIAL: Define cloning.
Closes #287.
1 parent c156024 commit 5a9bd2a

File tree

2 files changed

+135
-12
lines changed

2 files changed

+135
-12
lines changed

specs/credentialmanagement/index.html

Lines changed: 85 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ <h2 class="no-num no-toc no-ref heading settled" id="contents"><span class="cont
243243
</span></a>
244244
<li><a href="#store-credential"><span class="secno">4.1.2</span> <span class="content">
245245
Store a <code>Credential</code>
246+
</span></a>
247+
<li><a href="#clone-credential"><span class="secno">4.1.3</span> <span class="content">
248+
Clone <var>credential</var>
246249
</span></a>
247250
</ul>
248251
<li><a href="#processing-locallystored"><span class="secno">4.2</span> <span class="content">
@@ -818,10 +821,9 @@ <h4 class="heading settled" data-level="3.1.1" id="interfaces-credential-types-c
818821

819822

820823
<p><code class="idl"><a data-link-type="idl" href="#credential">Credential</a></code> objects implement <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/html5/infrastructure.html#transferable">Transferable</a></code>, and MUST support the
821-
the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#structured-clone">structured clone</a> algorithm by defining a cloning mechanism.</p>
822-
823-
824-
<p class="issue" id="issue-43c3f08c"><a class="self-link" href="#issue-43c3f08c"></a> Define cloning algorithms. <a href="https://github.com/w3c/webappsec/issues/287">&lt;https://github.com/w3c/webappsec/issues/287></a></p>
824+
the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#structured-clone">structured clone</a> algorithm. Unless otherwise specified, the cloning
825+
mechanism for all objects which implement <code class="idl"><a data-link-type="idl" href="#credential">Credential</a></code> is defined in
826+
<a href="#clone-credential">§4.1.3 Clone credential</a>.</p>
825827

826828

827829
<pre class="idl">dictionary <dfn class="idl-code" data-dfn-type="dictionary" data-export="" id="dictdef-locallystoredcredentialdata">LocallyStoredCredentialData<a class="self-link" href="#dictdef-locallystoredcredentialdata"></a></dfn> : <a data-link-type="idl-name" href="#dictdef-credentialdata">CredentialData</a> {
@@ -1968,6 +1970,75 @@ <h4 class="heading settled" data-level="4.1.2" id="store-credential"><span class
19681970

19691971

19701972

1973+
</ol>
1974+
1975+
1976+
<h4 class="heading settled" data-level="4.1.3" id="clone-credential"><span class="secno">4.1.3. </span><span class="content">
1977+
Clone <var>credential</var>
1978+
</span><a class="self-link" href="#clone-credential"></a></h4>
1979+
1980+
1981+
<p>Given a <code class="idl"><a data-link-type="idl" href="#credential">Credential</a></code> (<var>input</var>), the following algorithm
1982+
defines the way in which a <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#structured-clone">structured clone</a> will be produced. This
1983+
algorithm plugs into the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm">internal structured cloning algorithm</a>
1984+
defined in <a data-link-type="biblio" href="#biblio-html">[HTML]</a>:</p>
1985+
1986+
1987+
<ol>
1988+
1989+
<li>
1990+
Let <var>output</var> be a <code class="idl"><a data-link-type="idl" href="#credential">Credential</a></code> object of the same type as
1991+
<var>input</var>’s <code>constructor</code>.
1992+
1993+
1994+
1995+
<li>
1996+
For each internal slot on <var>input</var>:
1997+
1998+
1999+
<ol>
2000+
2001+
<li>
2002+
Let <var>name</var> be the name of the slot.
2003+
2004+
2005+
2006+
<li>
2007+
Let <var>source value</var> be the slot’s value.
2008+
2009+
2010+
2011+
<li>
2012+
Let <var>cloned value</var> be the result of invoking the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm">internal
2013+
structured cloning algorithm</a> with <var>source value</var> as the
2014+
"<code>input</code>" argument, and <var>memory</var> as the
2015+
"<code>memory</code>" argument.
2016+
2017+
2018+
2019+
<li>
2020+
If an exception results from the previous step, abort the overall
2021+
<a data-link-type="dfn" href="http://www.w3.org/TR/html5/infrastructure.html#structured-clone">structured clone</a> algorithm, and pass that exception through
2022+
to the caller.
2023+
2024+
2025+
2026+
<li>
2027+
Add a new slot to <var>output</var> having name <var>name</var> and
2028+
value <var>cloned value</var>.
2029+
2030+
2031+
2032+
</ol>
2033+
2034+
2035+
2036+
2037+
<li>
2038+
Set <var>deep clone</var> to <code>own</code>.
2039+
2040+
2041+
19712042
</ol>
19722043

19732044

@@ -3005,7 +3076,10 @@ <h3 class="heading settled" data-level="7.2" id="privacy-chooser-leakage"><span
30053076

30063077

30073078
<p>Further, these images MUST be fetched with the <code>credentials</code> mode
3008-
set to "<code>omit</code>".</p>
3079+
set to "<code>omit</code>", the <code>skip-service-worker flag</code> set, the
3080+
<code>client</code> set to <code>null</code>, the <code>initiator</code> set
3081+
to the empty string, and the <code>destination</code> set to
3082+
<code>subresource</code>.</p>
30093083

30103084

30113085
<h3 class="heading settled" data-level="7.3" id="locally-stored-data"><span class="secno">7.3. </span><span class="content">Locally Stored Data</span><a class="self-link" href="#locally-stored-data"></a></h3>
@@ -3029,12 +3103,12 @@ <h3 class="heading settled" data-level="7.3" id="locally-stored-data"><span clas
30293103

30303104
<h2 class="heading settled" data-level="8" id="implementation-considerations"><span class="secno">8. </span><span class="content">Implementation Considerations</span><a class="self-link" href="#implementation-considerations"></a></h2>
30313105

3032-
3033-
<h3 class="heading settled" data-level="8.1" id="implementation-for-authors"><span class="secno">8.1. </span><span class="content">Website Authors</span><a class="self-link" href="#implementation-for-authors"></a></h3>
3034-
30353106

30363107
<p><em>This section is non-normative.</em></p>
30373108

3109+
3110+
<h3 class="heading settled" data-level="8.1" id="implementation-for-authors"><span class="secno">8.1. </span><span class="content">Website Authors</span><a class="self-link" href="#implementation-for-authors"></a></h3>
3111+
30383112

30393113
<p class="issue" id="issue-e1d9f1af"><a class="self-link" href="#issue-e1d9f1af"></a> Add some thoughts here about when and how the API
30403114
should be used, especially with regard to <code class="idl"><a data-link-type="idl" href="#dom-credentialrequestoptions-suppressui">suppressUI</a></code>. <a href="https://github.com/w3c/webappsec/issues/290">&lt;https://github.com/w3c/webappsec/issues/290></a></p>
@@ -3398,6 +3472,7 @@ <h3 class="no-num heading settled" id="index-defined-elsewhere"><span class="con
33983472
<li><a href="http://www.w3.org/TR/html5/browsers.html#allowed-to-show-a-popup">allowed to show a popup</a>
33993473
<li><a href="http://www.w3.org/TR/html5/forms.html#autofilling-form-controls:-the-autocomplete-attribute">autocomplete</a>
34003474
<li><a href="http://www.w3.org/TR/html5/webappapis.html#incumbent-settings-object">incumbent settings object</a>
3475+
<li><a href="http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm">internal structured cloning algorithm</a>
34013476
<li><a href="http://www.w3.org/TR/html5/browsers.html#nested-browsing-context">nested browsing context</a>
34023477
<li><a href="http://www.w3.org/TR/html5/webappapis.html#responsible-document">responsible document</a>
34033478
<li><a href="http://www.w3.org/TR/html5/infrastructure.html#structured-clone">structured clone</a>
@@ -3485,6 +3560,8 @@ <h3 class="no-num heading settled" id="informative"><span class="content">Inform
34853560
<dl>
34863561
<dt id="biblio-browserid"><a class="self-link" href="#biblio-browserid"></a>[BROWSERID]
34873562
<dd>Ben Adida; et al. <a href="https://github.com/mozilla/id-specs/blob/prod/browserid/index.md">BrowserID</a>. URL: <a href="https://github.com/mozilla/id-specs/blob/prod/browserid/index.md">https://github.com/mozilla/id-specs/blob/prod/browserid/index.md</a>
3563+
<dt id="biblio-html"><a class="self-link" href="#biblio-html"></a>[HTML]
3564+
<dd>Ian Hickson. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
34883565
<dt id="biblio-manifest"><a class="self-link" href="#biblio-manifest"></a>[MANIFEST]
34893566
<dd>Marcos Caceres; Anssi Kostiainen; Kenneth Rohde Christiansen; et al. <a href="http://w3c.github.io/manifest/">Manifest for web application</a>. WD. URL: <a href="http://w3c.github.io/manifest/">http://w3c.github.io/manifest/</a>
34903567
<dt id="biblio-sri"><a class="self-link" href="#biblio-sri"></a>[SRI]
@@ -3566,7 +3643,6 @@ <h2 class="no-num heading settled" id="idl-index"><span class="content">IDL Inde
35663643
</pre>
35673644
<h2 class="no-num heading settled" id="issues-index"><span class="content">Issues Index</span><a class="self-link" href="#issues-index"></a></h2>
35683645
<div style="counter-reset:issue">
3569-
<div class="issue"> Define cloning algorithms. <a href="https://github.com/w3c/webappsec/issues/287">&lt;https://github.com/w3c/webappsec/issues/287></a><a href="#issue-43c3f08c"></a></div>
35703646
<div class="issue"> Anne suggests that this might be better modeled
35713647
as an <code>ImageBitmap</code> or <code>blob:</code>. We also need to
35723648
figure out responsiveness. Perhaps <a data-link-type="biblio" href="#biblio-manifest">[MANIFEST]</a>'s format? <a href="https://github.com/w3c/webappsec/issues/247">&lt;https://github.com/w3c/webappsec/issues/247></a><a href="#issue-c874d302"></a></div>

specs/credentialmanagement/index.src.html

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ <h1>Credential Management Level 1</h1>
2727
urlPrefix: infrastructure.html
2828
text: resolve a url
2929
text: structured clone
30+
text: internal structured cloning algorithm
3031
urlPrefix: forms.html
3132
text: autocomplete
3233
urlPrefix: browsers.html
@@ -519,9 +520,9 @@ <h4 id="interfaces-credential-types-credential"><code>Credential</code></h4>
519520
</dl>
520521

521522
{{Credential}} objects implement {{Transferable}}, and MUST support the
522-
the <a>structured clone</a> algorithm by defining a cloning mechanism.
523-
524-
ISSUE(w3c/webappsec#287): Define cloning algorithms.
523+
the <a>structured clone</a> algorithm. Unless otherwise specified, the cloning
524+
mechanism for all objects which implement {{Credential}} is defined in
525+
[[#clone-credential]].
525526

526527
<pre class="idl">
527528
dictionary LocallyStoredCredentialData : CredentialData {
@@ -1241,6 +1242,52 @@ <h4 id="store-credential">
12411242
</li>
12421243
</ol>
12431244

1245+
<h4 id="clone-credential">
1246+
Clone <var>credential</var>
1247+
</h4>
1248+
1249+
Given a {{Credential}} (<var>input</var>), the following algorithm
1250+
defines the way in which a <a>structured clone</a> will be produced. This
1251+
algorithm plugs into the <a>internal structured cloning algorithm</a>
1252+
defined in [[HTML]]:
1253+
1254+
<ol>
1255+
<li>
1256+
Let <var>output</var> be a {{Credential}} object of the same type as
1257+
<var>input</var>'s <code>constructor</code>.
1258+
</li>
1259+
<li>
1260+
For each internal slot on <var>input</var>:
1261+
1262+
<ol>
1263+
<li>
1264+
Let <var>name</var> be the name of the slot.
1265+
</li>
1266+
<li>
1267+
Let <var>source value</var> be the slot's value.
1268+
</li>
1269+
<li>
1270+
Let <var>cloned value</var> be the result of invoking the <a>internal
1271+
structured cloning algorithm</a> with <var>source value</var> as the
1272+
"<code>input</code>" argument, and <var>memory</var> as the
1273+
"<code>memory</code>" argument.
1274+
</li>
1275+
<li>
1276+
If an exception results from the previous step, abort the overall
1277+
<a>structured clone</a> algorithm, and pass that exception through
1278+
to the caller.
1279+
</li>
1280+
<li>
1281+
Add a new slot to <var>output</var> having name <var>name</var> and
1282+
value <var>cloned value</var>.
1283+
</li>
1284+
</ol>
1285+
</li>
1286+
<li>
1287+
Set <var>deep clone</var> to <code>own</code>.
1288+
</li>
1289+
</ol>
1290+
12441291
<h3 id="processing-locallystored">
12451292
Processing <code>LocallyStoredCredential</code>s
12461293
</h3>

0 commit comments

Comments
 (0)