-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathWD.html
1447 lines (1427 loc) · 105 KB
/
WD.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html><html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<title>Clear Site Data</title>
<meta content="WD" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2016/W3C-WD" rel="stylesheet" type="text/css">
<meta content="Bikeshed 1.0.0" name="generator">
<style>/* style-md-lists */
/* This is a weird hack for me not yet following the commonmark spec
regarding paragraph and lists. */
[data-md] > :first-child {
margin-top: 0;
}
[data-md] > :last-child {
margin-bottom: 0;
}</style>
<style>/* style-selflinks */
.heading, .issue, .note, .example, li, dt {
position: relative;
}
a.self-link {
position: absolute;
top: 0;
left: calc(-1 * (3.5rem - 26px));
width: calc(3.5rem - 26px);
height: 2em;
text-align: center;
border: none;
transition: opacity .2s;
opacity: .5;
}
a.self-link:hover {
opacity: 1;
}
.heading > a.self-link {
font-size: 83%;
}
li > a.self-link {
left: calc(-1 * (3.5rem - 26px) - 2em);
}
dfn > a.self-link {
top: auto;
left: auto;
opacity: 0;
width: 1.5em;
height: 1.5em;
background: gray;
color: white;
font-style: normal;
transition: opacity .2s, background-color .2s, color .2s;
}
dfn:hover > a.self-link {
opacity: 1;
}
dfn > a.self-link:hover {
color: black;
}
a.self-link::before { content: "¶"; }
.heading > a.self-link::before { content: "§"; }
dfn > a.self-link::before { content: "#"; }</style>
<style>/* style-counters */
body {
counter-reset: example figure issue;
}
.issue {
counter-increment: issue;
}
.issue:not(.no-marker)::before {
content: "Issue " counter(issue);
}
.example {
counter-increment: example;
}
.example:not(.no-marker)::before {
content: "Example " counter(example);
}
.invalid.example:not(.no-marker)::before,
.illegal.example:not(.no-marker)::before {
content: "Invalid Example" counter(example);
}
figcaption {
counter-increment: figure;
}
figcaption:not(.no-marker)::before {
content: "Figure " counter(figure) " ";
}</style>
<style>/* style-autolinks */
.css.css, .property.property, .descriptor.descriptor {
color: #005a9c;
font-size: inherit;
font-family: inherit;
}
.css::before, .property::before, .descriptor::before {
content: "‘";
}
.css::after, .property::after, .descriptor::after {
content: "’";
}
.property, .descriptor {
/* Don't wrap property and descriptor names */
white-space: nowrap;
}
.type { /* CSS value <type> */
font-style: italic;
}
pre .property::before, pre .property::after {
content: "";
}
[data-link-type="property"]::before,
[data-link-type="propdesc"]::before,
[data-link-type="descriptor"]::before,
[data-link-type="value"]::before,
[data-link-type="function"]::before,
[data-link-type="at-rule"]::before,
[data-link-type="selector"]::before,
[data-link-type="maybe"]::before {
content: "‘";
}
[data-link-type="property"]::after,
[data-link-type="propdesc"]::after,
[data-link-type="descriptor"]::after,
[data-link-type="value"]::after,
[data-link-type="function"]::after,
[data-link-type="at-rule"]::after,
[data-link-type="selector"]::after,
[data-link-type="maybe"]::after {
content: "’";
}
[data-link-type].production::before,
[data-link-type].production::after,
.prod [data-link-type]::before,
.prod [data-link-type]::after {
content: "";
}
[data-link-type=element],
[data-link-type=element-attr] {
font-family: Menlo, Consolas, "DejaVu Sans Mono", monospace;
font-size: .9em;
}
[data-link-type=element]::before { content: "<" }
[data-link-type=element]::after { content: ">" }
[data-link-type=biblio] {
white-space: pre;
}</style>
<style>/* style-dfn-panel */
.dfn-panel {
position: absolute;
z-index: 35;
height: auto;
width: -webkit-fit-content;
width: fit-content;
max-width: 300px;
max-height: 500px;
overflow: auto;
padding: 0.5em 0.75em;
font: small Helvetica Neue, sans-serif, Droid Sans Fallback;
background: #DDDDDD;
color: black;
border: outset 0.2em;
}
.dfn-panel:not(.on) { display: none; }
.dfn-panel * { margin: 0; padding: 0; text-indent: 0; }
.dfn-panel > b { display: block; }
.dfn-panel a { color: black; }
.dfn-panel a:not(:hover) { text-decoration: none !important; border-bottom: none !important; }
.dfn-panel > b + b { margin-top: 0.25em; }
.dfn-panel ul { padding: 0; }
.dfn-panel li { list-style: inside; }
.dfn-panel.activated {
display: inline-block;
position: fixed;
left: .5em;
bottom: 2em;
margin: 0 auto;
max-width: calc(100vw - 1.5em - .4em - .5em);
max-height: 30vh;
}
.dfn-paneled { cursor: pointer; }
</style>
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
.highlight .c { color: #708090 } /* Comment */
.highlight .k { color: #990055 } /* Keyword */
.highlight .l { color: #000000 } /* Literal */
.highlight .n { color: #0077aa } /* Name */
.highlight .o { color: #999999 } /* Operator */
.highlight .p { color: #999999 } /* Punctuation */
.highlight .cm { color: #708090 } /* Comment.Multiline */
.highlight .cp { color: #708090 } /* Comment.Preproc */
.highlight .c1 { color: #708090 } /* Comment.Single */
.highlight .cs { color: #708090 } /* Comment.Special */
.highlight .kc { color: #990055 } /* Keyword.Constant */
.highlight .kd { color: #990055 } /* Keyword.Declaration */
.highlight .kn { color: #990055 } /* Keyword.Namespace */
.highlight .kp { color: #990055 } /* Keyword.Pseudo */
.highlight .kr { color: #990055 } /* Keyword.Reserved */
.highlight .kt { color: #990055 } /* Keyword.Type */
.highlight .ld { color: #000000 } /* Literal.Date */
.highlight .m { color: #000000 } /* Literal.Number */
.highlight .s { color: #a67f59 } /* Literal.String */
.highlight .na { color: #0077aa } /* Name.Attribute */
.highlight .nc { color: #0077aa } /* Name.Class */
.highlight .no { color: #0077aa } /* Name.Constant */
.highlight .nd { color: #0077aa } /* Name.Decorator */
.highlight .ni { color: #0077aa } /* Name.Entity */
.highlight .ne { color: #0077aa } /* Name.Exception */
.highlight .nf { color: #0077aa } /* Name.Function */
.highlight .nl { color: #0077aa } /* Name.Label */
.highlight .nn { color: #0077aa } /* Name.Namespace */
.highlight .py { color: #0077aa } /* Name.Property */
.highlight .nt { color: #669900 } /* Name.Tag */
.highlight .nv { color: #222222 } /* Name.Variable */
.highlight .ow { color: #999999 } /* Operator.Word */
.highlight .mb { color: #000000 } /* Literal.Number.Bin */
.highlight .mf { color: #000000 } /* Literal.Number.Float */
.highlight .mh { color: #000000 } /* Literal.Number.Hex */
.highlight .mi { color: #000000 } /* Literal.Number.Integer */
.highlight .mo { color: #000000 } /* Literal.Number.Oct */
.highlight .sb { color: #a67f59 } /* Literal.String.Backtick */
.highlight .sc { color: #a67f59 } /* Literal.String.Char */
.highlight .sd { color: #a67f59 } /* Literal.String.Doc */
.highlight .s2 { color: #a67f59 } /* Literal.String.Double */
.highlight .se { color: #a67f59 } /* Literal.String.Escape */
.highlight .sh { color: #a67f59 } /* Literal.String.Heredoc */
.highlight .si { color: #a67f59 } /* Literal.String.Interpol */
.highlight .sx { color: #a67f59 } /* Literal.String.Other */
.highlight .sr { color: #a67f59 } /* Literal.String.Regex */
.highlight .s1 { color: #a67f59 } /* Literal.String.Single */
.highlight .ss { color: #a67f59 } /* Literal.String.Symbol */
.highlight .vc { color: #0077aa } /* Name.Variable.Class */
.highlight .vg { color: #0077aa } /* Name.Variable.Global */
.highlight .vi { color: #0077aa } /* Name.Variable.Instance */
.highlight .il { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<body class="h-entry">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1>Clear Site Data</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">W3C Working Draft, <time class="dt-updated" datetime="2016-07-20">20 July 2016</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
<dd><a class="u-url" href="http://www.w3.org/TR/2016/WD-clear-site-data-20160720/">http://www.w3.org/TR/2016/WD-clear-site-data-20160720/</a>
<dt>Latest published version:
<dd><a href="http://www.w3.org/TR/clear-site-data/">http://www.w3.org/TR/clear-site-data/</a>
<dt>Editor's Draft:
<dd><a href="https://w3c.github.io/webappsec-clear-site-data/">https://w3c.github.io/webappsec-clear-site-data/</a>
<dt>Previous Versions:
<dd><a href="http://www.w3.org/TR/2015/WD-clear-site-data-20150804/" rel="previous">http://www.w3.org/TR/2015/WD-clear-site-data-20150804/</a>
<dt>Version History:
<dd><a href="https://github.com/w3c/webappsec-clear-site-data/commits/master/index.src.html">https://github.com/w3c/webappsec-clear-site-data/commits/master/index.src.html</a>
<dt>Feedback:
<dd><span><a href="mailto:[email protected]?subject=%5Bclear-site-data%5D%20YOUR%20TOPIC%20HERE">[email protected]</a> with subject line “<kbd>[clear-site-data] <i data-lt="">… message topic …</i></kbd>” (<a href="http://lists.w3.org/Archives/Public/public-webappsec/" rel="discussion">archives</a>)</span>
<dt class="editor">Editor:
<dd class="editor p-author h-card vcard" data-editor-id="56384"><a class="p-name fn u-email email" href="mailto:[email protected]">Mike West</a> (<span class="p-org org">Google Inc.</span>)
<dt>Participate:
<dd><span><a href="https://github.com/w3c/webappsec-clear-site-data/issues/new">File an issue</a> (<a href="https://github.com/w3c/webappsec-clear-site-data/issues">open issues</a>)</span>
</dl>
</div>
<div data-fill-with="warning"></div>
<p class="copyright" data-fill-with="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2016 <a href="http://www.w3.org/"><abbr title="World Wide Web Consortium">W3C</abbr></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><abbr title="Massachusetts Institute of Technology">MIT</abbr></a>, <a href="http://www.ercim.eu/"><abbr title="European Research Consortium for Informatics and Mathematics">ERCIM</abbr></a>, <a href="http://www.keio.ac.jp/">Keio</a>, <a href="http://ev.buaa.edu.cn/">Beihang</a>). W3C <a href="http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer">liability</a>, <a href="http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks">trademark</a> and <a href="http://www.w3.org/Consortium/Legal/copyright-documents">document use</a> rules apply. </p>
<hr title="Separator for header">
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<p>This document defines an imperative mechanism which allows web developers to
instruct a user agent to clear a site’s locally stored data related to a
host.</p>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="status"><span class="content">Status of this document</span></h2>
<div data-fill-with="status">
<p> <em>This section describes the status of this document at the time of
its publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical report
can be found in the <a href="http://www.w3.org/TR/">W3C technical reports
index at http://www.w3.org/TR/.</a></em> </p>
<p> This document was published by the <a href="http://www.w3.org/2011/webappsec/">Web Application Security Working Group</a> as a Working Draft. This document is intended to become a W3C Recommendation. </p>
<p> The (<a href="http://lists.w3.org/Archives/Public/public-webappsec/">archived</a>) public mailing list <a href="mailto:[email protected]?Subject=%5Bclear-site-data%5D%20PUT%20SUBJECT%20HERE">[email protected]</a> (see <a href="http://www.w3.org/Mail/Request">instructions</a>)
is preferred for discussion of this specification.
When sending e-mail,
please put the text “clear-site-data” in the subject,
preferably like this:
“[clear-site-data] <em>…summary of comment…</em>” </p>
<p> Publication as a Working Draft does not imply endorsement by the W3C
Membership. This is a draft document and may be updated, replaced or
obsoleted by other documents at any time. It is inappropriate to cite this
document as other than work in progress. </p>
<p> This document was produced by the <a href="http://www.w3.org/2011/webappsec/">Web Application Security Working Group</a>. </p>
<p> This document was produced by a group operating under
the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5 February 2004 W3C Patent Policy</a>.
W3C maintains a <a href="http://www.w3.org/2004/01/pp-impl/49309/status" rel="disclosure">public list of any patent disclosures</a> made in connection with the deliverables of the group;
that page also includes instructions for disclosing a patent.
An individual who has actual knowledge of a patent which the individual believes contains <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#def-essential">Essential Claim(s)</a> must disclose the information in accordance with <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/#sec-Disclosure">section 6 of the W3C Patent Policy</a>. </p>
<p> This document is governed by the <a href="http://www.w3.org/2015/Process-20150901/" id="w3c_process_revision">1 September 2015 W3C Process Document</a>. </p>
<p></p>
</div>
<div data-fill-with="at-risk"></div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li>
<a href="#intro"><span class="secno">1</span> <span class="content">Introduction</span></a>
<ol class="toc">
<li>
<a href="#examples"><span class="secno">1.1</span> <span class="content">Examples</span></a>
<ol class="toc">
<li><a href="#example-signout"><span class="secno">1.1.1</span> <span class="content">Signing Out</span></a>
<li><a href="#example-targeted"><span class="secno">1.1.2</span> <span class="content">Targeted Clearing</span></a>
<li><a href="#example-keepcookies"><span class="secno">1.1.3</span> <span class="content">Keep Critical Cookies</span></a>
<li><a href="#example-killswitch"><span class="secno">1.1.4</span> <span class="content">Kill Switch</span></a>
</ol>
<li><a href="#goals"><span class="secno">1.2</span> <span class="content">Goals</span></a>
</ol>
<li>
<a href="#clearing"><span class="secno">2</span> <span class="content">Clearing Site Data</span></a>
<ol class="toc">
<li>
<a href="#header"><span class="secno">2.1</span> <span class="content"> The <code>Clear-Site-Data</code> HTTP Response Header Field </span></a>
<ol class="toc">
<li><a href="#types-member"><span class="secno">2.1.1</span> <span class="content"> The <code>types</code> member </span></a>
</ol>
<li><a href="#dom-api"><span class="secno">2.2</span> <span class="content">JavaScript API</span></a>
<li><a href="#fetch-integration"><span class="secno">2.3</span> <span class="content">Fetch Integration</span></a>
</ol>
<li>
<a href="#algorithms"><span class="secno">3</span> <span class="content">Algorithms</span></a>
<ol class="toc">
<li>
<a href="#parsing"><span class="secno">3.1</span> <span class="content">Parsing</span></a>
<ol class="toc">
<li><a href="#get-types"><span class="secno">3.1.1</span> <span class="content"> Which data types ought to be removed for <var>response</var>? </span></a>
</ol>
<li><a href="#clear-response"><span class="secno">3.2</span> <span class="content"> Clear data for <var>response</var> </span></a>
<li><a href="#clear-api"><span class="secno">3.3</span> <span class="content"> Clear data for <var>options</var> </span></a>
<li>
<a href="#clear-internal"><span class="secno">3.4</span> <span class="content"> Clear <var>types</var> for <var>origin</var> </span></a>
<ol class="toc">
<li><a href="#neuter-contexts"><span class="secno">3.4.1</span> <span class="content"> Neuter browsing contexts matching <var>origin</var> </span></a>
<li><a href="#reload-contexts"><span class="secno">3.4.2</span> <span class="content"> Reload browsing contexts matching <var>origin</var> </span></a>
<li><a href="#clear-cache"><span class="secno">3.4.3</span> <span class="content"> Clear cache for <var>origin</var> </span></a>
<li><a href="#clear-cookies"><span class="secno">3.4.4</span> <span class="content"> Clear cookies for <var>origin</var> </span></a>
<li><a href="#clear-dom"><span class="secno">3.4.5</span> <span class="content"> Clear DOM-accessible storage for <var>origin</var> </span></a>
</ol>
</ol>
<li>
<a href="#security"><span class="secno">4</span> <span class="content">Security Considerations</span></a>
<ol class="toc">
<li><a href="#incomplete"><span class="secno">4.1</span> <span class="content">Incomplete Clearing</span></a>
</ol>
<li>
<a href="#privacy"><span class="secno">5</span> <span class="content">Privacy Considerations</span></a>
<ol class="toc">
<li><a href="#user-vs-author"><span class="secno">5.1</span> <span class="content">Web developers control the timing.</span></a>
<li><a href="#remnants"><span class="secno">5.2</span> <span class="content">Remnants of data on disk.</span></a>
</ol>
<li>
<a href="#iana-considerations"><span class="secno">6</span> <span class="content">IANA Considerations</span></a>
<ol class="toc">
<li><a href="#iana-clear-site-data"><span class="secno">6.1</span> <span class="content"> Clear-Site-Data </span></a>
</ol>
<li><a href="#acknowledgements"><span class="secno">7</span> <span class="content">Acknowledgements</span></a>
<li>
<a href="#conformance"><span class="secno"></span> <span class="content">Conformance</span></a>
<ol class="toc">
<li><a href="#conventions"><span class="secno"></span> <span class="content">Document conventions</span></a>
<li><a href="#conformant-algorithms"><span class="secno"></span> <span class="content">Conformant Algorithms</span></a>
</ol>
<li>
<a href="#index"><span class="secno"></span> <span class="content">Index</span></a>
<ol class="toc">
<li><a href="#index-defined-here"><span class="secno"></span> <span class="content">Terms defined by this specification</span></a>
<li><a href="#index-defined-elsewhere"><span class="secno"></span> <span class="content">Terms defined by reference</span></a>
</ol>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
<li><a href="#informative"><span class="secno"></span> <span class="content">Informative References</span></a>
</ol>
<li><a href="#idl-index"><span class="secno"></span> <span class="content">IDL Index</span></a>
<li><a href="#issues-index"><span class="secno"></span> <span class="content">Issues Index</span></a>
</ol>
</nav>
<main>
<section>
<h2 class="heading settled" data-level="1" id="intro"><span class="secno">1. </span><span class="content">Introduction</span><a class="self-link" href="#intro"></a></h2>
<p><em>This section is not normative.</em></p>
<p>Web applications store data locally on a user’s computer in order to provide
functionality while the user is offline, and to increase performance when the
user is online. These local caches have significant advantages for both users
and developers, but present risks as well.</p>
<p>A user’s data is both sensitive and valuable; web developers ought to take
reasonable steps to protect it. One such step would be to encrypt data before
storing it. Another would be to remove data from the user’s machine when it is
no longer necessary (for example, when the user signs out of the application,
or deletes their account).</p>
<p>Site authors can remove data from a number of storage mechanisms via
JavaScript, but others are difficult to deal with reliably. Consider cookies,
for instance, which can be partially cleared via JavaScript access to <code>document.cookie</code>. <code>HttpOnly</code> cookies, however, can only
be removed via a number of <code>Set-Cookie</code> headers in an HTTP
response. This, of course, requires exhaustive knowledge of all the cookies
set for a host, which can be complicated to ascertain. Cache is still harder;
no imperative interface to a browser’s network cache exists, period.</p>
<p>This document defines a new mechanism to deal with removing data from these
and other types of local storage, giving web developers the ability to clear
out a user’s local cache of data via the <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-1">Clear-Site-Data</a> HTTP response
header.</p>
<h3 class="heading settled" data-level="1.1" id="examples"><span class="secno">1.1. </span><span class="content">Examples</span><a class="self-link" href="#examples"></a></h3>
<h4 class="heading settled" data-level="1.1.1" id="example-signout"><span class="secno">1.1.1. </span><span class="content">Signing Out</span><a class="self-link" href="#example-signout"></a></h4>
<div class="example" id="example-ea58a939">
<a class="self-link" href="#example-ea58a939"></a> A user signs out of Super Secret Social Network via a CSRF-protected POST to <code>https://supersecretsocialnetwork.example.com/logout</code>, and the
site author wishes to ensure that locally stored data is removed as a
result.
<p>They can do so by sending the following HTTP header in the response:</p>
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-2">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-1">types</a>": [ "<a data-link-type="dfn" href="#cache" id="ref-for-cache-1">cache</a>", "<a data-link-type="dfn" href="#cookies" id="ref-for-cookies-1">cookies</a>", "<a data-link-type="dfn" href="#storage" id="ref-for-storage-1">storage</a>", "<a data-link-type="dfn" href="#executioncontexts" id="ref-for-executioncontexts-1">executionContexts</a>" ] }
</pre>
</div>
<h4 class="heading settled" data-level="1.1.2" id="example-targeted"><span class="secno">1.1.2. </span><span class="content">Targeted Clearing</span><a class="self-link" href="#example-targeted"></a></h4>
<div class="example" id="example-1e48ac5a">
<a class="self-link" href="#example-1e48ac5a"></a> A user signs out of Megacorp Inc.'s site via a CSRF-protected POST to <code>https://megacorp.example.com/logout</code>. Megacorp has a large
number of services available as subdomains, so many that it’s not entirely
clear which of them would be safe to clear as a response to a logout action.
One option would be to simply clear everything, and deal with the fallout.
Megacorp’s CEO, however, once lost hours and hours of progress in "Irate
Ibexes" due to inadvertent site-data clearing, and so refuses to allow such
a sweeping impact to the site’s users.
<p>The developers know, however, that the "Minus" application is certainly safe
to clear out. They can target this specific subdomain by including a request
to that subdomain as part of the logout landing page (ideally as a
CORS-enabled, CSRF-protected POST):</p>
<pre>fetch("https://minus.megacorp.example.com/clear-site-data",
{
method: "POST",
mode: "cors",
headers: new Headers({
"CSRF": "[<em>insert sekrit token here</em>]"
})
});
</pre>
<p>That endpoint would return proper CORS headers in response to that request’s
preflight, and would return the following header for the actual request:</p>
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-3">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-2">types</a>": [ "<a data-link-type="dfn" href="#cache" id="ref-for-cache-2">cache</a>", "<a data-link-type="dfn" href="#cookies" id="ref-for-cookies-2">cookies</a>", "<a data-link-type="dfn" href="#storage" id="ref-for-storage-2">storage</a>", "<a data-link-type="dfn" href="#executioncontexts" id="ref-for-executioncontexts-2">executionContexts</a>" ] }
</pre>
</div>
<h4 class="heading settled" data-level="1.1.3" id="example-keepcookies"><span class="secno">1.1.3. </span><span class="content">Keep Critical Cookies</span><a class="self-link" href="#example-keepcookies"></a></h4>
<div class="example" id="example-9bc7528b">
<a class="self-link" href="#example-9bc7528b"></a> A user opts-out of interest-based advertising via a CSRF-protected POST to <code>https://ads-are-awesome.example.com/optout</code>. The site author
wishes to remove DOM-accessible data which might contain tracking
information, but needs to ensure that the opt-out cookie which the user has
just received isn’t wiped along with it.
<p>They can do so by sending the following HTTP header in the response, which
includes all the types except for "<a data-link-type="dfn" href="#cookies" id="ref-for-cookies-3">cookies</a>":</p>
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-4">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-3">types</a>": [ "<a data-link-type="dfn" href="#cache" id="ref-for-cache-3">cache</a>", "<a data-link-type="dfn" href="#storage" id="ref-for-storage-3">storage</a>", "<a data-link-type="dfn" href="#executioncontexts" id="ref-for-executioncontexts-3">executionContexts</a>" ] }
</pre>
</div>
<h4 class="heading settled" data-level="1.1.4" id="example-killswitch"><span class="secno">1.1.4. </span><span class="content">Kill Switch</span><a class="self-link" href="#example-killswitch"></a></h4>
<div class="example" id="example-efc41c41">
<a class="self-link" href="#example-efc41c41"></a> Super Secret Social Network’s developers learn that the site was vulnerable
to cross-site scripting attacks which allowed malicious parties to inject
arbitrary code into its origin. They fixed the site, and added a strong
Content Security Policy <a data-link-type="biblio" href="#biblio-csp2">[CSP2]</a> to mitigate the risk going forward, but
they can’t be entirely sure that clients are really back to a trustworthy
state. Perhaps the attackers found a clever persistence mechanism?
<p>They can reduce the risk of a persistent client-side XSS by sending the
following HTTP header in a response to wipe out local sources of data:</p>
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-5">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-4">types</a>": [ "<a data-link-type="dfn" href="#cache" id="ref-for-cache-4">cache</a>", "<a data-link-type="dfn" href="#cookies" id="ref-for-cookies-4">cookies</a>", "<a data-link-type="dfn" href="#storage" id="ref-for-storage-4">storage</a>", "<a data-link-type="dfn" href="#executioncontexts" id="ref-for-executioncontexts-4">executionContexts</a>" ] }
</pre>
<p class="note" role="note">Note: Installing a Service Worker guarantees that a request will go out to
a server every ~24 hours. That update ping would be a wonderful time to send
a header like this one in case of catastrophe. <a data-link-type="biblio" href="#biblio-service-workers">[SERVICE-WORKERS]</a></p>
</div>
<h3 class="heading settled" data-level="1.2" id="goals"><span class="secno">1.2. </span><span class="content">Goals</span><a class="self-link" href="#goals"></a></h3>
<p>Generally, the goal is to allow web developers more control over the data
stored locally by a user agent for their origins. In particular, developers
should be able to reliably ensure the following:</p>
<ol>
<li data-md="">
<p>Data stored in an origin’s client-side storage mechanisms like <a data-link-type="biblio" href="#biblio-indexeddb">[INDEXEDDB]</a>,
WebSQL, Filesystem, <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/#dom-localstorage">localStorage</a></code>, and <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/#dom-sessionstorage">sessionStorage</a></code> is cleared.</p>
<li data-md="">
<p>Cookies for an origin’s host are removed <a data-link-type="biblio" href="#biblio-rfc6265">[RFC6265]</a>.</p>
<li data-md="">
<p>Web Workers (dedicated and shared) running for an origin are terminated.</p>
<li data-md="">
<p>Service Workers registered for an origin are terminated and deregistered.</p>
<li data-md="">
<p>Resources from an origin are removed from the user agent’s local cache.</p>
<li data-md="">
<p>All of the above can be propagated to the HTTP version of an HTTPS origin.</p>
<li data-md="">
<p>None of the above can be bypassed by a maliciously active document that
retains interesting data in memory, and rewrites it if it’s cleared.</p>
</ol>
</section>
<section>
<h2 class="heading settled" data-level="2" id="clearing"><span class="secno">2. </span><span class="content">Clearing Site Data</span><a class="self-link" href="#clearing"></a></h2>
<p>Developers may instruct a user agent to clear various types of relevant data
in two ways: an HTTP response header, and a JavaScript API:</p>
<h3 class="heading settled" data-level="2.1" id="header"><span class="secno">2.1. </span><span class="content"> The <code>Clear-Site-Data</code> HTTP Response Header Field </span><a class="self-link" href="#header"></a></h3>
<p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="clear-site-data"><code>Clear-Site-Data</code></dfn> HTTP response header field
sends a signal to the user agent that it ought to remove all data
of a certain set of types. The header is represented by the following ABNF <a data-link-type="biblio" href="#biblio-rfc5234">[RFC5234]</a>:</p>
<pre class="abnf">Report-To = <a data-link-type="grammar" href="https://greenbytes.de/tech/webdav/draft-reschke-http-jfv-02.html#rfc.section.2">json-field-value</a>
; See Section 2 of [[HTTP-JFV]], and Section 2 of [[RFC7159]]
</pre>
<p>The header’s value is interpreted as an array of JSON objects, as described in
Section 4 of <a data-link-type="biblio" href="#biblio-http-jfv">[HTTP-JFV]</a>.</p>
<p>Each object in the array represents a clearing action that the user agent MUST
undertake, and will be parsed as defined in <a href="#parsing">§3.1 Parsing</a>.</p>
<p>The following subsections defined the initial set of known members in each
JSON object the header’s value defines. Future versions of this document may
define additional such members, and user agents MUST ignore unknown members
when parsing the header.</p>
<h4 class="heading settled" data-level="2.1.1" id="types-member"><span class="secno">2.1.1. </span><span class="content"> The <code>types</code> member </span><a class="self-link" href="#types-member"></a></h4>
<p>The <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="types"><code>types</code></dfn> member is an array of keywords designating the kinds
of data that the server wishes the user agent to remove. The member’s value
MUST be an array, and that array MUST contain only strings; any other types
will result in a parse error.</p>
<p>The following are the initial set of known types which may be specified in
the member’s array value. Future versions of this document may define
additional types, and user agents MUST ignore unknown types when parsing the
header:</p>
<dl>
<dt data-md="">
<p>"<dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="cache"><code>cache</code></dfn>"</p>
<dd data-md="">
<p>The "<code>cache</code>" type indicates that the server wishes to remove locally
cached data associated with the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> of a particular <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-response-url">url</a></code>. This includes the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7234#section-2">network
cache</a>, of course, but will also remove data from various other caches
which a user agent implements (prerendered pages, script caches, shader
caches, etc.).</p>
<p>Implementation details are in <a href="#clear-cache">§3.4.3 Clear cache for origin</a>.</p>
<div class="example" id="example-0a3225db">
<a class="self-link" href="#example-0a3225db"></a> When delivered with a response from <code>https://example.com/clear</code>,
the following header will cause caches associated with the origin <code>https://example.com</code>: to be cleared:
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-6">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-5">types</a>": [ "<a data-link-type="dfn" href="#cache" id="ref-for-cache-5">cache</a>" ] }
</pre>
</div>
<dt data-md="">
<p>"<dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="cookies"><code>cookies</code></dfn>"</p>
<dd data-md="">
<p>The "<code>cookies</code>" type indicates that the server wishes to remove cookies
associated with the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> of a particular <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-response-url">url</a></code>. Along with cookies, HTTP authentication credentials <a data-link-type="biblio" href="#biblio-rfc7235">[RFC7235]</a>, and origin-bound tokens such as those defined by Channel
ID <a data-link-type="biblio" href="#biblio-channelid">[CHANNELID]</a> and Token Binding <a data-link-type="biblio" href="#biblio-tokbind">[TOKBIND]</a> are also cleared.</p>
<p>Implementation details are in <a href="#clear-cookies">§3.4.4 Clear cookies for origin</a>.</p>
<div class="example" id="example-9bd67aa6">
<a class="self-link" href="#example-9bd67aa6"></a> When delivered with a response from <code>https://example.com/clear</code>,
the following header will cause cookies associated with the origin <code>https://example.com</code> to be cleared:
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-7">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-6">types</a>": "<a data-link-type="dfn" href="#cookies" id="ref-for-cookies-5">cookies</a>" ] }
</pre>
</div>
<dt data-md="">
<p>"<dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="storage"><code>storage</code></dfn>"</p>
<dd data-md="">
<p>The "<code>storage</code>" type indicates that the server wishes to remove
locally stored data associated with the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> of a
particular <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-response-url">url</a></code>. This includes storage
mechansims such as (<code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/#dom-localstorage">localStorage</a></code>, <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/#dom-sessionstorage">sessionStorage</a></code>, <a data-link-type="biblio" href="#biblio-indexeddb">[INDEXEDDB]</a>, <a data-link-type="biblio" href="#biblio-webdatabase">[WEBDATABASE]</a>, etc), as well as tangentially related mechainsm such as <a data-link-type="dfn" href="http://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registrations</a>.</p>
<p>Implementation details are in <a href="#clear-dom">§3.4.5 Clear DOM-accessible storage for origin</a>.</p>
<div class="example" id="example-f08a8eb9">
<a class="self-link" href="#example-f08a8eb9"></a> When delivered with a response from <code>https://example.com/clear</code>,
the following header will cause DOM-accessible storage for the origin <code>https://example.com</code> to be cleared:
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-8">Clear-Site-Data</a>: { "<a data-link-type="dfn" href="#types" id="ref-for-types-7">types</a>": "<a data-link-type="dfn" href="#storage" id="ref-for-storage-5">storage</a>" ] }
</pre>
</div>
<dt data-md="">
<p>"<dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport="" id="executioncontexts"><code>executionContexts</code></dfn>"</p>
<dd data-md="">
<p>The "<code>executionContexts</code>" type indicates that the server wishes to neuter
and reload execution contexts currently rendering the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> of a
particular <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-response-url">url</a></code>.</p>
<p>Implementation details are in <a href="#neuter-contexts">§3.4.1 Neuter browsing contexts matching origin</a>.</p>
<div class="example" id="example-5e0c67a9">
<a class="self-link" href="#example-5e0c67a9"></a> When delivered with a response from <code>https://example.com/clear</code>,
the following header will cause execution contexts displaying the origin <code>https://example.com</code> to be neutered and reloaded:
<pre><a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-9">Clear-Site-Data</a>: <a data-link-type="dfn" href="#executioncontexts" id="ref-for-executioncontexts-5">executionContexts</a>
</pre>
</div>
</dl>
<h3 class="heading settled" data-level="2.2" id="dom-api"><span class="secno">2.2. </span><span class="content">JavaScript API</span><a class="self-link" href="#dom-api"></a></h3>
<p class="issue" id="issue-3153cbda"><a class="self-link" href="#issue-3153cbda"></a> This might live more cleanly in <a data-link-type="biblio" href="#biblio-storage">[STORAGE]</a>.</p>
<div class="example" id="example-ab4fc395">
<a class="self-link" href="#example-ab4fc395"></a> Megacorp, Inc. wants to remove data in response to a user’s activity on
their site. They can execute the following JavaScript to clear all the
relevant data for a user:
<pre>navigator.storage.<a class="idl-code" data-link-type="method" href="#dom-storagemanager-clear" id="ref-for-dom-storagemanager-clear-1">clear()</a>;
</pre>
<p>If they only wished to clear the otherwise inaccessible cache for the
current origin:</p>
<pre>navigator.storage.<a class="idl-code" data-link-type="method" href="https://html.spec.whatwg.org/multipage/interaction.html#dom-datatransferitemlist-clear">clear</a>({
<a class="idl-code" data-link-type="dict-member" href="#dom-storageclearoptions-types" id="ref-for-dom-storageclearoptions-types-1">types</a>: [ "cache" ],
});
</pre>
</div>
<pre class="idl highlight def"><span class="kt">enum</span> <dfn class="nv dfn-paneled idl-code" data-dfn-type="enum" data-export="" id="enumdef-storagecleartype">StorageClearType</dfn> {
<dfn class="s idl-code" data-dfn-for="StorageClearType" data-dfn-type="enum-value" data-export="" data-lt=""cache"|cache" id="dom-storagecleartype-cache">"cache"<a class="self-link" href="#dom-storagecleartype-cache"></a></dfn>,
<dfn class="s idl-code" data-dfn-for="StorageClearType" data-dfn-type="enum-value" data-export="" data-lt=""cookies"|cookies" id="dom-storagecleartype-cookies">"cookies"<a class="self-link" href="#dom-storagecleartype-cookies"></a></dfn>,
<dfn class="s idl-code" data-dfn-for="StorageClearType" data-dfn-type="enum-value" data-export="" data-lt=""storage"|storage" id="dom-storagecleartype-storage">"storage"<a class="self-link" href="#dom-storagecleartype-storage"></a></dfn>,
<dfn class="s idl-code" data-dfn-for="StorageClearType" data-dfn-type="enum-value" data-export="" data-lt=""executionContexts"|executionContexts" id="dom-storagecleartype-executioncontexts">"executionContexts"<a class="self-link" href="#dom-storagecleartype-executioncontexts"></a></dfn>
};
<span class="kt">dictionary</span> <dfn class="nv dfn-paneled idl-code" data-dfn-type="dictionary" data-export="" id="dictdef-storageclearoptions">StorageClearOptions</dfn> {
<span class="kt">sequence</span><<a class="n" data-link-type="idl-name" href="#enumdef-storagecleartype" id="ref-for-enumdef-storagecleartype-1">StorageClearType</a>> <dfn class="nv dfn-paneled idl-code" data-dfn-for="StorageClearOptions" data-dfn-type="dict-member" data-export="" data-type="sequence<StorageClearType> " id="dom-storageclearoptions-types">types</dfn>;
};
<span class="kt">partial</span> <span class="kt">interface</span> <a class="nv idl-code" data-link-type="interface" href="https://storage.spec.whatwg.org/#storagemanager">StorageManager</a> {
<span class="kt">Promise</span><<span class="kt">void</span>> <a class="nv idl-code" data-link-type="method" href="#dom-storagemanager-clear" id="ref-for-dom-storagemanager-clear-2">clear</a>(<a class="n" data-link-type="idl-name" href="#dictdef-storageclearoptions" id="ref-for-dictdef-storageclearoptions-1">StorageClearOptions</a> <a class="nv idl-code" data-link-type="argument" href="#dom-storagemanager-clear-options-options" id="ref-for-dom-storagemanager-clear-options-options-1">options</a>);
};
</pre>
<dl>
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="StorageManager" data-dfn-type="method" data-export="" id="dom-storagemanager-clear">clear(options)</dfn>
<dd>
Clears data based on the values in the <var>options</var> argument.
Returns a Promise that resolves when clearing is complete. If no <code class="idl"><a data-link-type="idl" href="#dom-storageclearoptions-types" id="ref-for-dom-storageclearoptions-types-2">types</a></code> are specified, all data types will be
cleared.
<table class="argumentdef data">
<caption>Arguments for the <a class="idl-code" data-link-type="method" href="#dom-storagemanager-clear" id="ref-for-dom-storagemanager-clear-3">StorageManager.clear(options)</a> method.</caption>
<thead>
<tr>
<th>Parameter
<th>Type
<th>Nullable
<th>Optional
<th>Description
<tbody>
<tr>
<td><dfn class="dfn-paneled idl-code" data-dfn-for="StorageManager/clear(options)" data-dfn-type="argument" data-export="" id="dom-storagemanager-clear-options-options">options</dfn>
<td> StorageClearOptions
<td> <span class="no">✘</span>
<td> <span class="no">✘</span>
<td>The data to clear.
</table>
</dl>
<h3 class="heading settled" data-level="2.3" id="fetch-integration"><span class="secno">2.3. </span><span class="content">Fetch Integration</span><a class="self-link" href="#fetch-integration"></a></h3>
<p class="issue" id="issue-3ded38d3"><a class="self-link" href="#issue-3ded38d3"></a> Monkey patching! Talk with Anne.</p>
<p>If the <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-10"><code>Clear-Site-Data</code></a> header is present in an HTTP <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a>, then data MUST be cleared before rendering the response to
the user. That is, before step #9 in the current <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#main-fetch">main fetch</a> algorithm,
execute the following step:</p>
<ol start="9">
<li data-md="">
<p>If <var>response</var>’s <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-header-list">header list</a> contains a header named <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-11"><code>Clear-Site-Data</code></a>, then execute <a href="#clear-response">§3.2 Clear data for response</a> on <var>response</var>.</p>
</ol>
<p class="note" role="note">Note: This happens <em>after</em> <code>Set-Cookie</code> headers are
processed. If we clear cookies, we clear all of them. This is intentional, as
removing only certain cookies might leave an application in an indeterminate
and vulnerable state. Removing specific cookies is best done via expiration
using the <code>Set-Cookie</code> header.</p>
<section>
<section>
<h2 class="heading settled" data-level="3" id="algorithms"><span class="secno">3. </span><span class="content">Algorithms</span><a class="self-link" href="#algorithms"></a></h2>
<h3 class="heading settled" data-level="3.1" id="parsing"><span class="secno">3.1. </span><span class="content">Parsing</span><a class="self-link" href="#parsing"></a></h3>
<h4 class="heading settled" data-level="3.1.1" id="get-types"><span class="secno">3.1.1. </span><span class="content"> Which data types ought to be removed for <var>response</var>? </span><a class="self-link" href="#get-types"></a></h4>
<ol>
<li data-md="">
<p>If <var>response</var> does not contain a <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-12"><code>Clear-Site-Data</code></a> header, return
an empty list.</p>
<li data-md="">
<p>Let <var>types</var> be an empty list.</p>
<li data-md="">
<p>Let <var>list</var> be the result of executing the algorithm defined in Section 4
of <a data-link-type="biblio" href="#biblio-http-jfv">[HTTP-JFV]</a> on the value of <var>response</var>’s <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-13"><code>Clear-Site-Data</code></a> header. If that algorithm results in an error, return an empty list.</p>
<li data-md="">
<p>For each <var>item</var> in <var>list</var>:</p>
<ol>
<li data-md="">
<p>If <var>item</var> does not have a <a data-link-type="dfn" href="#types" id="ref-for-types-8"><code>types</code></a> member, skip to the next <var>item</var>.</p>
<li data-md="">
<p>For each <var>type</var> in <var>item</var>’s <a data-link-type="dfn" href="#types" id="ref-for-types-9"><code>types</code></a> member’s value:</p>
<ol>
<li data-md="">
<p>If <var>type</var> is <a data-link-type="dfn" href="#cache" id="ref-for-cache-6"><code>cache</code></a>, <a data-link-type="dfn" href="#cookies" id="ref-for-cookies-6"><code>cookies</code></a>, <a data-link-type="dfn" href="#storage" id="ref-for-storage-6"><code>storage</code></a>,
or <a data-link-type="dfn" href="#executioncontexts" id="ref-for-executioncontexts-6"><code>executionContexts</code></a>, append <var>type</var> to <var>types</var>.</p>
<p>Otherwise, skip to the next <var>type</var>.</p>
</ol>
</ol>
<li data-md="">
<p>Return <var>types</var>.</p>
</ol>
<h3 class="heading settled" data-level="3.2" id="clear-response"><span class="secno">3.2. </span><span class="content"> Clear data for <var>response</var> </span><a class="self-link" href="#clear-response"></a></h3>
<p>Given a <a data-link-type="dfn" href="https://fetch.spec.whatwg.org/#concept-response">response</a> (<var>response</var>), this algorithm parses the <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-14"><code>Clear-Site-Data</code></a> header to determine what needs to be
cleared, which origins are affected, and then executes those requests.</p>
<ol>
<li data-md="">
<p>If <var>response</var>’s <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/url/#concept-url">URL</a></code> is <a data-link-type="dfn" href="https://w3c.github.io/webappsec/specs/mixedcontent/#a-priori-insecure-url"><i lang="la">a priori</i> insecure</a>, skip the remaining steps of this algorithm.</p>
<p class="issue" id="issue-6ab3e863"><a class="self-link" href="#issue-6ab3e863"></a> Some have suggested that this might not be a restriction we want
(see <a href="https://lists.w3.org/Archives/Public/public-webappsec/2015Jun/0032.html">Martin
Thomson’s public-webappsec post on the topic</a>, for example).</p>
<li data-md="">
<p>Let <var>types</var> be the result of <a href="#get-types">§3.1.1 Which data types ought to be removed for response?</a> executed on <var>response</var>.</p>
<li data-md="">
<p>Execute <a href="#clear-internal">§3.4 Clear types for origin</a> on <var>types</var>, <var>response</var>’s <code class="idl"><a data-link-type="idl" href="https://fetch.spec.whatwg.org/#concept-response-url">url</a></code>'s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a>.</p>
</ol>
<p class="note" role="note">Note: Especially given the cross-context implications, user agents are
are encouraged to give web developers some mechanism by which the clearing
operation can be debugged. This might take the form of a console message or
timeline entry indicating success.</p>
<h3 class="heading settled" data-level="3.3" id="clear-api"><span class="secno">3.3. </span><span class="content"> Clear data for <var>options</var> </span><a class="self-link" href="#clear-api"></a></h3>
<p>Given a <code class="idl"><a data-link-type="idl" href="#dictdef-storageclearoptions" id="ref-for-dictdef-storageclearoptions-2">StorageClearOptions</a></code> (<var>options</var>), this algorithm
determines what needs to be cleared, returns a Promise, and executes the
request asynchronously.</p>
<ol>
<li data-md="">
<p>If the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/webappapis.html#incumbent-settings-object">incumbent settings object</a> is not a <a data-link-type="dfn" href="https://w3c.github.io/webappsec/specs/powerfulfeatures/#secure-context">secure context</a>,
return a <code>Promise</code> rejected with <code>NotSupportedError</code>.</p>
<li data-md="">
<p>Let <var>promise</var> be a newly created <code>Promise</code> object.</p>
<li data-md="">
<p>Return <var>promise</var>, and execute the remaining steps asynchronously.</p>
<li data-md="">
<p>Let <var>types</var> be an empty list.</p>
<li data-md="">
<p>If <var>options</var>’ <code class="idl"><a data-link-type="idl" href="#dom-storageclearoptions-types" id="ref-for-dom-storageclearoptions-types-3">types</a></code> is an empty sequence:</p>
<ol>
<li data-md="">
<p>Append <code>cache</code>, <code>cookies</code>, <code>storage</code>, and <code>executionContexts</code> to <var>types</var>.</p>
</ol>
<li data-md="">
<p>Otherwise, for each <code class="idl"><a data-link-type="idl" href="#enumdef-storagecleartype" id="ref-for-enumdef-storagecleartype-2">StorageClearType</a></code> <var>type</var> in <var>options</var>’ <code class="idl"><a data-link-type="idl" href="#dom-storageclearoptions-types" id="ref-for-dom-storageclearoptions-types-4">types</a></code> property:</p>
<ol>
<li data-md="">
<p>Append <var>type</var> to <var>types</var>.</p>
</ol>
<li data-md="">
<p>Execute <a href="#clear-internal">§3.4 Clear types for origin</a> on <var>types</var> and the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/webappapis.html#incumbent-settings-object">incumbent
settings object</a>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a>.</p>
<li data-md="">
<p>Resolve <var>promise</var> with <code>undefined</code>.</p>
</ol>
<h3 class="heading settled" data-level="3.4" id="clear-internal"><span class="secno">3.4. </span><span class="content"> Clear <var>types</var> for <var>origin</var> </span><a class="self-link" href="#clear-internal"></a></h3>
<ol>
<li data-md="">
<p>If <var>types</var> contains "<code>executionContexts</code>", execute <a href="#neuter-contexts">§3.4.1 Neuter browsing contexts matching origin</a> on <var>origin</var>.</p>
<li data-md="">
<p>If <var>types</var> contains "<code>cookies</code>", execute <a href="#clear-cookies">§3.4.4 Clear cookies for origin</a> on <var>origin</var>.</p>
<li data-md="">
<p>If <var>types</var> contains "<code>storage</code>", execute <a href="#clear-dom">§3.4.5 Clear DOM-accessible storage for origin</a> on <var>origin</var>.</p>
<li data-md="">
<p>If <var>types</var> contains "<code>cache</code>", execute <a href="#clear-cache">§3.4.3 Clear cache for origin</a> on <var>origin</var>.</p>
<li data-md="">
<p>If <var>types</var> contains "<code>executionContexts</code>", execute <a href="#reload-contexts">§3.4.2 Reload browsing contexts matching origin</a> on <var>origin</var>.</p>
</ol>
<h4 class="heading settled" data-level="3.4.1" id="neuter-contexts"><span class="secno">3.4.1. </span><span class="content"> Neuter browsing contexts matching <var>origin</var> </span><a class="self-link" href="#neuter-contexts"></a></h4>
<p>Given an <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> (<var>origin</var>) this algorithm walks through the
set of <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#browsing-context">browsing contexts</a> which the user agent knows about, and
sandboxes each in order to prevent them from recreating cleared data (from
in-memory JavaScript variables, for instance). Once data is cleared, the
affected browsing contexts will be hard-reloaded, as defined in <a href="#reload-contexts">§3.4.2 Reload browsing contexts matching origin</a>:</p>
<ol>
<li data-md="">
<p>For each <var>context</var> in the user agent’s set of <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#browsing-context">browsing
contexts</a>:</p>
<ol>
<li data-md="">
<p>Let <var>document</var> be <var>context</var>’s <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#active-document">active
document</a>.</p>
<li data-md="">
<p>While <var>document</var> is <a data-link-type="dfn" href="http://www.w3.org/TR/html5/embedded-content-0.html#an-iframe-srcdoc-document">an <code>iframe srcdoc</code> document</a>, let <var>document</var> be the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#active-document">active document</a> of <var>document</var>’s <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#browsing-context-container">browsing context container</a>.</p>
<li data-md="">
<p>If <var>context</var>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> is <var>origin</var>:</p>
<ol>
<li data-md="">
<p><a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#sandboxing:parse-a-sandboxing-directive">Parse a sandboxing directive</a> using the empty string as
the input, and <var>document</var>’s <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#active-sandboxing-flag-set">active
sandboxing flag set</a> as the output.</p>
</ol>
</ol>
</ol>
<h4 class="heading settled" data-level="3.4.2" id="reload-contexts"><span class="secno">3.4.2. </span><span class="content"> Reload browsing contexts matching <var>origin</var> </span><a class="self-link" href="#reload-contexts"></a></h4>
<p>Given an <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> (<var>origin</var>), this algorithm walks through the
set of <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#browsing-context">browsing contexts</a> which the user agent knows about and reloads
each of them:</p>
<ol>
<li data-md="">
<p>For each <var>context</var> in the user agent’s set of <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#browsing-context">browsing
contexts</a>:</p>
<ol>
<li data-md="">
<p>Let <var>document</var> be <var>context</var>’s <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#active-document">active
document</a>.</p>
<li data-md="">
<p>While <var>document</var> is <a data-link-type="dfn" href="http://www.w3.org/TR/html5/embedded-content-0.html#an-iframe-srcdoc-document">an <code>iframe srcdoc</code> document</a>, let <var>document</var> be the <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#active-document">active document</a> of <var>document</var>’s <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#browsing-context-container">browsing context container</a>.</p>
<li data-md="">
<p>If <var>context</var>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> is <var>origin</var>:</p>
<ol>
<li data-md="">
<p>Navigate <var>context</var> to <var>document</var>’s <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/url/#concept-url">URL</a></code> with <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#replacement-enabled">replacement enabled</a> and <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#exceptions-enabled">exceptions enabled</a>. The <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#source-browsing-context">source browsing context</a> is <var>context</var>. This is a <a data-link-type="dfn" href="http://www.w3.org/TR/html5/browsers.html#reload-triggered-navigation">reload-triggered navigation</a>.</p>
</ol>
</ol>
</ol>
<h4 class="heading settled" data-level="3.4.3" id="clear-cache"><span class="secno">3.4.3. </span><span class="content"> Clear cache for <var>origin</var> </span><a class="self-link" href="#clear-cache"></a></h4>
<p>Given an <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> (<var>origin</var>), this algorithm removes data from
the user agent’s local caches that matches the origin.</p>
<ol>
<li data-md="">
<p>Let <var>host</var> be <var>origin</var>’s <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/url/#concept-url-host">host</a></code>, <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.1.2">canonicalized</a> as per Section 5.1.2 of <a data-link-type="biblio" href="#biblio-rfc6265">[RFC6265]</a>.</p>
<li data-md="">
<p>Let <var>cache list</var> be the set of entries from the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7234#section-2">network
cache</a> whose <code>target URI</code> <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/url/#concept-url-host">host</a></code> is identical to <var>host</var> when <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.1.2">canonicalized</a> as per Section 5.1.2 of <a data-link-type="biblio" href="#biblio-rfc6265">[RFC6265]</a>.</p>
<li data-md="">
<p>For each <var>entry</var> in <var>cache list</var>:</p>
<ol>
<li data-md="">
<p>Remove <var>entry</var> from the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7234#section-2">network cache</a>.</p>
</ol>
<li data-md="">
<p>If a user agent implements caches beyond a pure <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc7234#section-2">network cache</a>, it
MUST remove all entries from those caches which match <var>origin</var>.</p>
<p class="issue" id="issue-d40aa458"><a class="self-link" href="#issue-d40aa458"></a> We’re dealing with the network cache here, as defined in <a data-link-type="biblio" href="#biblio-rfc7234">[RFC7234]</a>, but that’s not nearly everything a user agent caches. How
hand-wavey with the vendor-specific section can we be? For instance,
Chrome clears out prerendered pages, script caches, WebGL shader caches,
WebRTC bits and pieces, address bar suggestion caches, various networking
bits that aren’t representations (HSTS/HPKP, SCDH, etc.). Perhaps <a data-link-type="biblio" href="#biblio-storage">[STORAGE]</a> will make this clearer?</p>
</ol>
<h4 class="heading settled" data-level="3.4.4" id="clear-cookies"><span class="secno">3.4.4. </span><span class="content"> Clear cookies for <var>origin</var> </span><a class="self-link" href="#clear-cookies"></a></h4>
<p>Given an <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> (<var>origin</var>), this algorithm removes cookies
from the user agent’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.3">cookie store</a> whose <code>domain</code> attribute <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.1.3">domain-matches</a> <var>origin</var>’s <a data-link-type="dfn" href="https://publicsuffix.org/list/#">registered domain</a>.</p>
<p class="note" role="note">Note: We remove all the cookies for an entire <a data-link-type="dfn" href="https://publicsuffix.org/list/#">registered domain</a>, as
cookies ignore the same-origin policy, and there’s a distinct risk that we’d
leave applications in an ill-defined state if we only cleared cookies for a
particular subdomain. Consider <code>accounts.google.com</code> vs <code>mail.google.com</code>,
for instance, both of which have cookies that signal a user’s signed-in
status.</p>
<p class="note" role="note">Note: This algorithm assumes that the user agent has implemented a <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.3">cookie
store</a> (as discussed in Section 5.3 of <a data-link-type="biblio" href="#biblio-rfc6265">[RFC6265]</a>), which offers the
ability to retrieve a list of cookies by host, and to remove individual
cookies.</p>
<ol>
<li data-md="">
<p>Let <var>host</var> be <var>origin</var>’s <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/url/#concept-url-host">host</a></code>, <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.1.2">canonicalized</a> as per Section 5.1.2 of <a data-link-type="biblio" href="#biblio-rfc6265">[RFC6265]</a>.</p>
<li data-md="">
<p>Let <var>registered</var> be the <a data-link-type="dfn" href="https://publicsuffix.org/list/#">registered domain</a> of <var>host</var>.</p>
<li data-md="">
<p>Let <var>cookie list</var> be the set of cookies from the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.3">cookie
store</a> whose <code>domain</code> attribute is a <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.1.3">domain-match</a> with <var>registered</var>.</p>
<li data-md="">
<p>For each <var>cookie</var> in <var>cookie list</var>:</p>
<ol>
<li data-md="">
<p>Remove <var>cookie</var> from the <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6265#section-5.3">cookie store</a>.</p>
</ol>
<li data-md="">
<p>Clear related origin-bound Channel IDs <a data-link-type="biblio" href="#biblio-channelid">[CHANNELID]</a> and
tokens <a data-link-type="biblio" href="#biblio-tokbind">[TOKBIND]</a>.</p>
<li data-md="">
<p>Clear related HTTP authentication credentials <a data-link-type="biblio" href="#biblio-rfc7235">[RFC7235]</a>.</p>
</ol>
<p class="issue" id="issue-a4a76269"><a class="self-link" href="#issue-a4a76269"></a> The process of clearing both bound
tokens/IDs and HTTP authentication is super hand-wavey. <a href="https://github.com/w3c/webappsec-clear-site-data/issues/2"><https://github.com/w3c/webappsec-clear-site-data/issues/2></a></p>
<h4 class="heading settled" data-level="3.4.5" id="clear-dom"><span class="secno">3.4.5. </span><span class="content"> Clear DOM-accessible storage for <var>origin</var> </span><a class="self-link" href="#clear-dom"></a></h4>
<ol>
<li data-md="">
<p>For each <var>area</var> in the user agent’s set of <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/#the-localstorage-attribute">local storage
areas</a> <a data-link-type="biblio" href="#biblio-html">[HTML]</a>:</p>
<ol>
<li data-md="">
<p>If <var>area</var>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> is <var>origin</var>:</p>
<ol>
<li data-md="">
<p>Execute <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-clear">clear()</a></code> on the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/#storage-2">Storage</a></code> object associated
with <var>area</var>.</p>
</ol>
</ol>
<li data-md="">
<p>For each <var>area</var> in the user agent’s set of <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/#the-sessionstorage-attribute">session storage
areas</a> <a data-link-type="biblio" href="#biblio-html">[HTML]</a>:</p>
<ol>
<li data-md="">
<p>If <var>area</var>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> is <var>origin</var>:</p>
<ol>
<li data-md="">
<p>Execute <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-clear">clear()</a></code> on the <code class="idl"><a data-link-type="idl" href="https://html.spec.whatwg.org/multipage/#storage-2">Storage</a></code> object associated
with <var>area</var>.</p>
</ol>
</ol>
<li data-md="">
<p>For each <var>database</var> in the user agent’s set of Indexed
Databases <a data-link-type="biblio" href="#biblio-indexeddb">[INDEXEDDB]</a>:</p>
<ol>
<li data-md="">
<p>If <var>database</var>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> is <var>origin</var>:</p>
<ol>
<li data-md="">
<p>Set <var>database</var>’s <a data-link-type="dfn" href="https://w3c.github.io/IndexedDB/#dfn-delete-pending">delete pending</a> flag to <code>true</code>.</p>
<li data-md="">
<p>For each <var>connection</var> in the set of all <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/IndexedDB/#idl-def-IDBDatabase">IDBDatabase</a></code> objects connected to <var>database</var>:</p>
<ol>
<li data-md="">
<p>Execute the <a data-link-type="dfn" href="https://w3c.github.io/IndexedDB/#dfn-steps-for-closing-a-database-connection">database closing steps</a> on <var>connection</var>, setting the <i>forced flag</i>.</p>
</ol>
<li data-md="">
<p>Execute the <a data-link-type="dfn" href="https://w3c.github.io/IndexedDB/#dfn-steps-for-deleting-a-database">database deletion steps</a> on <var>database</var>, passing in <var>database</var>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> and name.</p>
</ol>
</ol>
<li data-md="">
<p>For each <var>registration</var> in the user agent’s set of <a data-link-type="dfn" href="http://www.w3.org/TR/service-workers/#register-algorithm">registered</a> <a data-link-type="dfn" href="http://www.w3.org/TR/service-workers/#dfn-service-worker-registration">service worker registrations</a>:</p>
<ol>
<li data-md="">
<p>If <var>registration</var>’s <a data-link-type="dfn" href="http://www.w3.org/TR/service-workers/#dfn-scope-url">scope URL</a>’s <a data-link-type="dfn" href="https://tools.ietf.org/html/rfc6454#section-3.2">origin</a> is <var>origin</var>:</p>
<ol>
<li data-md="">
<p>Execute <code class="idl"><a data-link-type="idl" href="http://www.w3.org/TR/service-workers/#navigator-service-worker-unregister">unregister()</a></code> on <var>registration</var>.</p>
</ol>
</ol>
<li data-md="">
<p>For any other script-accessible storage mechanism, the user agent MUST
delete any data associated with this origin. This includes (but is not
limited to) the following:</p>
<ol>
<li data-md="">
<p>An origin’s WebSQL databases <a data-link-type="biblio" href="#biblio-webdatabase">[WEBDATABASE]</a>.</p>
<li data-md="">
<p>An origin’s filesystems <a data-link-type="biblio" href="#biblio-file-system-api">[file-system-api]</a></p>
<li data-md="">
<p>ChannelID</p>
<li data-md="">
<p>Plugin data (e.g. <a href="https://wiki.mozilla.org/NPAPI:ClearSiteData">NPP_ClearSiteData</a>)</p>
<li data-md="">
<p>Appcache.</p>
<li data-md="">
<p class="issue" id="issue-b346d876"><a class="self-link" href="#issue-b346d876"></a> Moar?</p>
</ol>
</ol>
</section>
<section>
<h2 class="heading settled" data-level="4" id="security"><span class="secno">4. </span><span class="content">Security Considerations</span><a class="self-link" href="#security"></a></h2>
<h3 class="heading settled" data-level="4.1" id="incomplete"><span class="secno">4.1. </span><span class="content">Incomplete Clearing</span><a class="self-link" href="#incomplete"></a></h3>
<p>It is possible that an application could be put into an indeterminate state
by clearing only one type of storage. We mitigate that to some extent by
clearing all storage options as a block, and by requiring that the header be
delivered over a secure connection.</p>
<h2 class="heading settled" data-level="5" id="privacy"><span class="secno">5. </span><span class="content">Privacy Considerations</span><a class="self-link" href="#privacy"></a></h2>
<h3 class="heading settled" data-level="5.1" id="user-vs-author"><span class="secno">5.1. </span><span class="content">Web developers control the timing.</span><a class="self-link" href="#user-vs-author"></a></h3>
<p>If triggered at appropriate times, <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-15"><code>Clear-Site-Data</code></a> can
increase a user’s privacy and security by clearing sensitive data from their
user agent. However, note that the web developer (and <em>not</em> the user)
is in control of when the clearing event is triggered. Even assuming a
non-malicious site author, users can’t rely on data being cleared at any
particular point, nor are users in control of what data types are cleared.</p>
<p>If a user wishes to ensure that site data is indeed cleared at some specific
point, they ought to rely on the data-clearing functionality offered by their
user agent.</p>
<p>At a bare minimum, user agents OUGHT TO (in the <a data-link-type="biblio" href="#biblio-rfc6919">[RFC6919]</a> sense of the
words) offer the same functionality to users that they offer to web
developers. Ideally, they will offer significantly more than we can offer at
a platform level (clearing browsing history, for example).</p>
<h3 class="heading settled" data-level="5.2" id="remnants"><span class="secno">5.2. </span><span class="content">Remnants of data on disk.</span><a class="self-link" href="#remnants"></a></h3>
<p>While <a data-link-type="dfn" href="#clear-site-data" id="ref-for-clear-site-data-16"><code>Clear-Site-Data</code></a> triggers a clearing event in a
user’s agent, it is difficult to make promises about the state of a user’s
disk after a clearing event takes place. In particular, note that it is up
to the user agent to ensure that all traces of a site’s date is actually
removed from disk, which can be a herculean task (consider virtual memory,
as a good example of a larger issue).</p>
<p>In short, most user agents implement data clearing as "best effort", but
can’t promise an exhaustive wipe.</p>
<p>If a user wishes to ensure that site data does not remain on disk, the best
way to do so is to use a browsing mode that promises not to intentionally
write data to disk (Chrome’s "Incognito", Internet Explorer’s "InPrivate",
etc). These modes will do a better job of keeping data off disk, but are
still subject to a number of limitations at the edges.</p>
</section>
<section>
<h2 class="heading settled" data-level="6" id="iana-considerations"><span class="secno">6. </span><span class="content">IANA Considerations</span><a class="self-link" href="#iana-considerations"></a></h2>
<p>The permanent message header field registry should be updated
with the following registration: <a data-link-type="biblio" href="#biblio-rfc3864">[RFC3864]</a></p>
<h3 class="heading settled" data-level="6.1" id="iana-clear-site-data"><span class="secno">6.1. </span><span class="content"> Clear-Site-Data </span><a class="self-link" href="#iana-clear-site-data"></a></h3>
<dl>
<dt>Header field name
<dd>Clear-Site-Data
<dt>Applicable protocol
<dd>http
<dt>Status
<dd>standard
<dt>Author/Change controller
<dd>W3C
<dt>Specification document
<dd>This specification (See <a href="#header">§2.1 The Clear-Site-Data HTTP Response Header Field</a>)
</dl>
<section>
<h2 class="heading settled" data-level="7" id="acknowledgements"><span class="secno">7. </span><span class="content">Acknowledgements</span><a class="self-link" href="#acknowledgements"></a></h2>
<p>Michal Zalewski proposed a variant of this concept, and Mark Knichel helped
refine the details.</p>
</section>
</section>