index.html
216 KB
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en" dir="ltr"><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Programmable HTTP Caching and Serving</title>
<meta name="revision" content="$Id: Overview.html,v 1.5 2011/03/29 14:19:54 mike Exp $">
<!--[if IE]>
<style type='text/css'>
.ignore {
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
filter: alpha(opacity=50);
}
</style>
<![endif]-->
<style type="text/css">
h5 {
display: none
}
table {
border-collapse: collapse;
border-style: hidden hidden none;
}
table thead {
border-bottom: medium solid;
}
table td, table th {
border-bottom: thin solid;
border-left: medium solid;
border-right: medium solid;
padding: 0.2em;
vertical-align: top;
}
.diff-add {
background-color: #eeeeee
}
</style>
<style type="text/css">
/*****************************************************************
* ReSpec CSS
* Robin Berjon (robin at berjon dot com)
* v0.05 - 2009-07-31
*****************************************************************/
/* --- INLINES --- */
em.rfc2119 {
text-transform: lowercase;
font-variant: small-caps;
font-style: normal;
color: #900;
}
h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym,
h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr {
border: none;
}
dfn {
font-weight: bold;
}
a.internalDFN {
color: inherit;
border-bottom: medium solid #99c;
text-decoration: none;
}
a.externalDFN {
color: inherit;
border-bottom: medium dotted #ccc;
text-decoration: none;
}
a.bibref {
text-decoration: none;
}
code {
color: #ff4500;
}
/* --- WEB IDL --- */
pre.idl {
border-top: 1px solid #90b8de;
border-bottom: 1px solid #90b8de;
padding: 1em;
line-height: 120%;
}
pre.idl::before {
content: "WebIDL";
display: block;
width: 150px;
background: #90b8de;
color: #fff;
font-family: initial;
padding: 3px;
font-weight: bold;
margin: -1em 0 1em -1em;
}
.idlType {
color: #ff4500;
font-weight: bold;
text-decoration: none;
}
/*.idlModule*/
/*.idlModuleID*/
/*.idlInterface*/
.idlInterfaceID {
font-weight: bold;
color: #005a9c;
}
.idlSuperclass {
font-style: italic;
color: #005a9c;
}
/*.idlAttribute*/
.idlAttrType, .idlFieldType {
color: #005a9c;
}
.idlAttrName, .idlFieldName {
color: #ff4500;
}
.idlAttrName a, .idlFieldName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlMethod*/
.idlMethType {
color: #005a9c;
}
.idlMethName {
color: #ff4500;
}
.idlMethName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlParam*/
.idlParamType {
color: #005a9c;
}
.idlParamName {
font-style: italic;
}
.extAttr {
color: #666;
}
/*.idlConst*/
.idlConstType {
color: #005a9c;
}
.idlConstName {
color: #ff4500;
}
.idlConstName a {
color: #ff4500;
border-bottom: 1px dotted #ff4500;
text-decoration: none;
}
/*.idlException*/
.idlExceptionID {
font-weight: bold;
color: #c00;
}
.idlTypedefID, .idlTypedefType {
color: #005a9c;
}
.idlRaises, .idlRaises a.idlType, .idlRaises a.idlType code, .excName a, .excName a code {
color: #c00;
font-weight: normal;
}
.excName a {
font-family: monospace;
}
.idlRaises a.idlType, .excName a.idlType {
border-bottom: 1px dotted #c00;
}
.excGetSetTrue, .excGetSetFalse, .prmNullTrue, .prmNullFalse, .prmOptTrue, .prmOptFalse {
width: 45px;
text-align: center;
}
.excGetSetTrue, .prmNullTrue, .prmOptTrue { color: #0c0; }
.excGetSetFalse, .prmNullFalse, .prmOptFalse { color: #c00; }
.idlImplements a {
font-weight: bold;
}
dl.attributes, dl.methods, dl.constants, dl.fields {
margin-left: 2em;
}
.attributes dt, .methods dt, .constants dt, .fields dt {
font-weight: normal;
}
.attributes dt code, .methods dt code, .constants dt code, .fields dt code {
font-weight: bold;
color: #000;
font-family: monospace;
}
.attributes dt code, .fields dt code {
background: #ffffd2;
}
.attributes dt .idlAttrType code, .fields dt .idlFieldType code {
color: #005a9c;
background: transparent;
font-family: inherit;
font-weight: normal;
font-style: italic;
}
.methods dt code {
background: #d9e6f8;
}
.constants dt code {
background: #ddffd2;
}
.attributes dd, .methods dd, .constants dd, .fields dd {
margin-bottom: 1em;
}
table.parameters, table.exceptions {
border-spacing: 0;
border-collapse: collapse;
margin: 0.5em 0;
width: 100%;
}
table.parameters { border-bottom: 1px solid #90b8de; }
table.exceptions { border-bottom: 1px solid #deb890; }
.parameters th, .exceptions th {
color: #fff;
padding: 3px 5px;
text-align: left;
font-family: initial;
font-weight: normal;
text-shadow: #666 1px 1px 0;
}
.parameters th { background: #90b8de; }
.exceptions th { background: #deb890; }
.parameters td, .exceptions td {
padding: 3px 10px;
border-top: 1px solid #ddd;
vertical-align: top;
}
.parameters tr:first-child td, .exceptions tr:first-child td {
border-top: none;
}
.parameters td.prmName, .exceptions td.excName, .exceptions td.excCodeName {
width: 100px;
}
.parameters td.prmType {
width: 120px;
}
table.exceptions table {
border-spacing: 0;
border-collapse: collapse;
width: 100%;
}
/* --- TOC --- */
.toc a {
text-decoration: none;
}
a .secno {
color: #000;
}
/* --- TABLE --- */
table.simple {
border-spacing: 0;
border-collapse: collapse;
border-bottom: 3px solid #005a9c;
}
.simple th {
background: #005a9c;
color: #fff;
padding: 3px 5px;
text-align: left;
}
.simple th[scope="row"] {
background: inherit;
color: inherit;
border-top: 1px solid #ddd;
}
.simple td {
padding: 3px 10px;
border-top: 1px solid #ddd;
}
.simple tr:nth-child(even) {
background: #f0f6ff;
}
/* --- DL --- */
.section dd > p:first-child {
margin-top: 0;
}
.section dd > p:last-child {
margin-bottom: 0;
}
.section dd {
margin-bottom: 1em;
}
.section dl.attrs dd, .section dl.eldef dd {
margin-bottom: 0;
}
/* --- EXAMPLES --- */
pre.example {
border-top: 1px solid #ff4500;
border-bottom: 1px solid #ff4500;
padding: 1em;
margin-top: 1em;
}
pre.example::before {
content: "Example";
display: block;
width: 150px;
background: #ff4500;
color: #fff;
font-family: initial;
padding: 3px;
font-weight: bold;
margin: -1em 0 1em -1em;
}
/* --- EDITORIAL NOTES --- */
.issue {
padding: 1em;
margin: 1em 0em 0em;
border: 1px solid #f00;
background: #ffc;
}
.issue::before {
content: "Issue";
display: block;
width: 150px;
margin: -1.5em 0 0.5em 0;
font-weight: bold;
border: 1px solid #f00;
background: #fff;
padding: 3px 1em;
}
.note {
margin: 1em 0em 0em;
padding: 1em;
border: 2px solid #cff6d9;
background: #e2fff0;
}
.note::before {
content: "Note";
display: block;
width: 150px;
margin: -1.5em 0 0.5em 0;
font-weight: bold;
border: 1px solid #cff6d9;
background: #fff;
padding: 3px 1em;
}
/* --- Best Practices --- */
div.practice {
border: solid #bebebe 1px;
margin: 2em 1em 1em 2em;
}
span.practicelab {
margin: 1.5em 0.5em 1em 1em;
font-weight: bold;
font-style: italic;
}
span.practicelab { background: #dfffff; }
span.practicelab {
position: relative;
padding: 0 0.5em;
top: -1.5em;
}
p.practicedesc {
margin: 1.5em 0.5em 1em 1em;
}
@media screen {
p.practicedesc {
position: relative;
top: -2em;
padding: 0;
margin: 1.5em 0.5em -1em 1em;
}
/* --- SYNTAX HIGHLIGHTING --- */
pre.sh_sourceCode {
background-color: white;
color: black;
font-style: normal;
font-weight: normal;
}
pre.sh_sourceCode .sh_keyword { color: #005a9c; font-weight: bold; } /* language keywords */
pre.sh_sourceCode .sh_type { color: #666; } /* basic types */
pre.sh_sourceCode .sh_usertype { color: teal; } /* user defined types */
pre.sh_sourceCode .sh_string { color: red; font-family: monospace; } /* strings and chars */
pre.sh_sourceCode .sh_regexp { color: orange; font-family: monospace; } /* regular expressions */
pre.sh_sourceCode .sh_specialchar { color: #ffc0cb; font-family: monospace; } /* e.g., \n, \t, \\ */
pre.sh_sourceCode .sh_comment { color: #A52A2A; font-style: italic; } /* comments */
pre.sh_sourceCode .sh_number { color: purple; } /* literal numbers */
pre.sh_sourceCode .sh_preproc { color: #00008B; font-weight: bold; } /* e.g., #include, import */
pre.sh_sourceCode .sh_symbol { color: blue; } /* e.g., *, + */
pre.sh_sourceCode .sh_function { color: black; font-weight: bold; } /* function calls and declarations */
pre.sh_sourceCode .sh_cbracket { color: red; } /* block brackets (e.g., {, }) */
pre.sh_sourceCode .sh_todo { font-weight: bold; background-color: #00FFFF; } /* TODO and FIXME */
/* Predefined variables and functions (for instance glsl) */
pre.sh_sourceCode .sh_predef_var { color: #00008B; }
pre.sh_sourceCode .sh_predef_func { color: #00008B; font-weight: bold; }
/* for OOP */
pre.sh_sourceCode .sh_classname { color: teal; }
/* line numbers (not yet implemented) */
pre.sh_sourceCode .sh_linenum { display: none; }
/* Internet related */
pre.sh_sourceCode .sh_url { color: blue; text-decoration: underline; font-family: monospace; }
/* for ChangeLog and Log files */
pre.sh_sourceCode .sh_date { color: blue; font-weight: bold; }
pre.sh_sourceCode .sh_time, pre.sh_sourceCode .sh_file { color: #00008B; font-weight: bold; }
pre.sh_sourceCode .sh_ip, pre.sh_sourceCode .sh_name { color: #006400; }
/* for Prolog, Perl... */
pre.sh_sourceCode .sh_variable { color: #006400; }
/* for LaTeX */
pre.sh_sourceCode .sh_italics { color: #006400; font-style: italic; }
pre.sh_sourceCode .sh_bold { color: #006400; font-weight: bold; }
pre.sh_sourceCode .sh_underline { color: #006400; text-decoration: underline; }
pre.sh_sourceCode .sh_fixed { color: green; font-family: monospace; }
pre.sh_sourceCode .sh_argument { color: #006400; }
pre.sh_sourceCode .sh_optionalargument { color: purple; }
pre.sh_sourceCode .sh_math { color: orange; }
pre.sh_sourceCode .sh_bibtex { color: blue; }
/* for diffs */
pre.sh_sourceCode .sh_oldfile { color: orange; }
pre.sh_sourceCode .sh_newfile { color: #006400; }
pre.sh_sourceCode .sh_difflines { color: blue; }
/* for css */
pre.sh_sourceCode .sh_selector { color: purple; }
pre.sh_sourceCode .sh_property { color: blue; }
pre.sh_sourceCode .sh_value { color: #006400; font-style: italic; }
/* other */
pre.sh_sourceCode .sh_section { color: black; font-weight: bold; }
pre.sh_sourceCode .sh_paren { color: red; }
pre.sh_sourceCode .sh_attribute { color: #006400; }
</style><link href="DataCache.css" rel="stylesheet" type="text/css" charset="utf-8"><link href="http://www.w3.org/StyleSheets/TR/W3C-WG-NOTE" rel="stylesheet" type="text/css" charset="utf-8"></head>
<body style="display: inherit; "><div class="head"><p><a href="http://www.w3.org/"><img width="72" height="48" src="http://www.w3.org/Icons/w3c_home" alt="W3C"></a></p><h1 class="title" id="title">Programmable HTTP Caching and Serving</h1><h2 id="w3c-working-group-note-29-march-2011">W3C Working Group Note 29 March 2011</h2><dl><dt>This version:</dt><dd><a href="http://www.w3.org/TR/2011/NOTE-DataCache-20110329/">http://www.w3.org/TR/2011/NOTE-DataCache-20110329/</a></dd><dt>Latest published version:</dt><dd><a href="http://www.w3.org/TR/DataCache/">http://www.w3.org/TR/DataCache/</a></dd>
<dt>Previous version:</dt><dd><a href="http://www.w3.org/TR/2010/WD-DataCache-20100114/">http://www.w3.org/TR/2010/WD-DataCache-20100114/</a></dd><dt>Editor:</dt><dd><a href="mailto:nikunj@o-micron.com">Nikunj Mehta</a>, Invited Expert</dd>
</dl><p class="copyright"><a href="http://www.w3.org/Consortium/Legal/ipr-notice#Copyright">Copyright</a> © 2011 <a href="http://www.w3.org/"><acronym title="World Wide Web Consortium">W3C</acronym></a><sup>®</sup> (<a href="http://www.csail.mit.edu/"><acronym title="Massachusetts Institute of Technology">MIT</acronym></a>, <a href="http://www.ercim.eu/"><acronym title="European Research Consortium for Informatics and Mathematics">ERCIM</acronym></a>, <a href="http://www.keio.ac.jp/">Keio</a>), All Rights Reserved. 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></div>
<div id="abstract" class="introductory section"><h2>Abstract</h2>
<p>
This document defines APIs for off-line serving of requests to HTTP resources using
static and dynamic responses. It extends the function of application caches defined in
HTML5.
</p>
</div><div id="sotd" class="introductory section"><h2>Status of This Document</h2><p style="background: black; color: white; font: 900 2em serif; padding: 0.5em 1em; border: dotted yellow 0.5em; text-align: center">Beware.
This specification is no longer in active maintenance and the
Web Applications Working Group does not intend to maintain it further.
</p><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</a> at http://www.w3.org/TR/.</em></p><p>This document was published by the <a href="http://www.w3.org/2008/webapps/">Web Applications Working Group</a> as a Working Group Note. If you wish to make comments regarding this document, please send them to <a href="mailto:public-webapps@w3.org">public-webapps@w3.org</a> (<a href="mailto:public-webapps-request@w3.org?subject=subscribe">subscribe</a>, <a href="http://lists.w3.org/Archives/Public/public-webapps/">archives</a>). All feedback is welcome.</p><p>Publication as a Working Group Note 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 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/42538/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></div><div id="toc" class="section"><h2 class="introductory">Table of Contents</h2><ul class="toc"><li class="tocline"><a href="#introduction" class="tocxref"><span class="secno">1. </span>Introduction</a></li><li class="tocline"><a href="#conformance" class="tocxref"><span class="secno">2. </span>Conformance</a><ul class="toc"><li class="tocline"><a href="#dependencies" class="tocxref"><span class="secno">2.1 </span>Dependencies</a></li></ul></li><li class="tocline"><a href="#terminology" class="tocxref"><span class="secno">3. </span>Terminology</a></li><li class="tocline"><a href="#cache" class="tocxref"><span class="secno">4. </span>Programmable HTTP Caching and Serving</a><ul class="toc"><li class="tocline"><a href="#datacache-intro" class="tocxref"><span class="secno">4.1 </span>Introduction</a><ul class="toc"><li class="tocline"><a href="#examples" class="tocxref"><span class="secno">4.1.1 </span>Examples</a></li><li class="tocline"><a href="#cache-events" class="tocxref"><span class="secno">4.1.2 </span>Event summary</a></li></ul></li><li class="tocline"><a href="#http-cache" class="tocxref"><span class="secno">4.2 </span>Programmable HTTP Caching</a><ul class="toc"><li class="tocline"><a href="#starting-a-transaction" class="tocxref"><span class="secno">4.2.1 </span>Starting a transaction</a></li><li class="tocline"><a href="#adding-capture-transaction" class="tocxref"><span class="secno">4.2.2 </span>Capturing resources</a></li><li class="tocline"><a href="#release-resource" class="tocxref"><span class="secno">4.2.3 </span>Releasing resources</a></li><li class="tocline"><a href="#complete-transaction" class="tocxref"><span class="secno">4.2.4 </span>Commiting a transaction</a></li><li class="tocline"><a href="#abort-transaction" class="tocxref"><span class="secno">4.2.5 </span>Aborting a transaction</a></li><li class="tocline"><a href="#datacache-api" class="tocxref"><span class="secno">4.2.6 </span>The API Entry Point</a></li><li class="tocline"><a href="#request-events" class="tocxref"><span class="secno">4.2.7 </span>Asynchronous requests</a></li><li class="tocline"><a href="#extending-the-applicationcache-interface" class="tocxref"><span class="secno">4.2.8 </span>Extending the <code>ApplicationCache</code> interface</a></li><li class="tocline"><a href="#events-and-error" class="tocxref"><span class="secno">4.2.9 </span>The <code>CacheEvent</code> Interface</a></li></ul></li><li class="tocline"><a href="#local-server" class="tocxref"><span class="secno">4.3 </span>Programmable HTTP Serving</a><ul class="toc"><li class="tocline"><a href="#request-interface" class="tocxref"><span class="secno">4.3.1 </span>Local Server Interfaces</a></li><li class="tocline"><a href="#networking-model-changes" class="tocxref"><span class="secno">4.3.2 </span>Changes to the networking model</a></li></ul></li></ul></li><li class="tocline"><a href="#security" class="tocxref"><span class="secno">5. </span>Security Considerations</a></li><li class="tocline"><a href="#acknowledgements" class="tocxref"><span class="secno">A. </span>Acknowledgements</a></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">B. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">B.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">B.2 </span>Informative references</a></li></ul></li></ul></div>
<div id="introduction" class="section informative">
<!--OddPage--><h2><span class="secno">1. </span>Introduction</h2><p><em>This section is non-normative.</em></p>
<p>
The existing cache manifest [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>] statically identifies cached
resources to be stored in an application cache. The API introduced
in this document extends the application cache by allowing
applications to programmatically add other resources to the cache
which can then be served by the user agent when that resource is
requested. This API also extends the application cache to enable
applications to programmatically generate responses to requests for
resources that have been added to the application cache. As a result,
the application cache can now be used to satisfy unsafe HTTP methods
such as <code>PUT</code> and <code>POST</code>.
</p>
<p>
Using this application cache extension, applications can obtain locally
cached data or data produced locally by JavaScript servers and perform
requests on resources that can be served whether or not the user agent
is connected to a remote server. Applications can then save and replay
locally satisfied requests to the server when it is reconnected, thus
enabling responsive and robust Web applications in the presence of low
connectivity conditions.
</p>
<p>
This specification does not require a new programming model for Web
applications as application caches can be configured to be transparently
pressed into action by the user agent, depending on system conditions.
Such applications can seamlessly switch between on-line and off-line
operation without needing explicit user action. This also means that
existing applications can be used unchanged in many cases
once the application cache is configured. Applications only need to be
altered to use APIs specified in this document if they require more
complex synchronization.
</p>
</div>
<div id="conformance" class="section"><!--OddPage--><h2><span class="secno">2. </span>Conformance</h2><p>As well as sections marked as non-normative, all authoring guidelines, diagrams, examples, and notes in this specification are non-normative. Everything else in this specification is normative.</p>
<p>The key words <em class="rfc2119" title="must">must</em>, <em class="rfc2119" title="must not">must not</em>, <em class="rfc2119" title="required">required</em>, <em class="rfc2119" title="should">should</em>, <em class="rfc2119" title="should not">should not</em>, <em class="rfc2119" title="recommended">recommended</em>, <em class="rfc2119" title="may">may</em>, and <em class="rfc2119" title="optional">optional</em> in this specification are to be interpreted as described in [<cite><a class="bibref" rel="biblioentry" href="#bib-RFC2119">RFC2119</a></cite>].</p>
<p>
This specification defines one class of products:
</p>
<dl>
<dt><dfn id="dfn-conforming-user-agent">conforming user agent</dfn></dt>
<dd>
<p>
A user agent must behave as described in this specification
in order to be considered conformant.
</p>
<p>
User agents may implement algorithms given in this
specification in any way desired, so long as the end result is
indistinguishable from the result that would be obtained by the
specification's algorithms.
</p>
<p>
A <a href="#dfn-conforming-user-agent" class="internalDFN">conforming user agent</a> must also be a
<em>conforming implementation</em> of the IDL fragments
of this specification, as described in the
Web IDL specification. [<cite><a class="bibref" rel="biblioentry" href="#bib-WEBIDL">WEBIDL</a></cite>]
</p>
<p class="note">
This specification uses both the terms "conforming user agent(s)"
and "user agent(s)" to refer to this product class.
</p>
</dd>
</dl>
<div id="dependencies" class="section">
<h3><span class="secno">2.1 </span>Dependencies</h3>
<p>This specification relies on several underlying specifications.</p>
<dl>
<dt>HTML5</dt>
<dd>The terms and algorithms
<dfn title="event handler" id="dfn-event-handler">event handlers</dfn>,
<dfn id="dfn-event-handler-event-type">event handler event type</dfn>, <dfn id="dfn-origin">origin</dfn>,
<dfn id="dfn-same-origin">same origin</dfn>, <dfn id="dfn-fetching-resources">fetching resources</dfn>,
<dfn id="dfn-browsing-context">browsing context</dfn>, <dfn id="dfn-active-document">active document</dfn>,
<dfn id="dfn-child-browsing-context">child browsing context</dfn>, <dfn id="dfn-application-cache">application cache</dfn>,
<dfn id="dfn-application-cache-group">application cache group</dfn>, <dfn id="dfn-relevant-application-cache">relevant application cache</dfn>,
<dfn id="dfn-master-entries">master entries</dfn>, <dfn id="dfn-application-cache-selection-algorithm">application cache selection algorithm</dfn>,
<dfn id="dfn-cache-host">cache host</dfn>, <dfn id="dfn-manifest">manifest</dfn>, <dfn id="dfn-explicit-entries">explicit entries</dfn>,
<dfn id="dfn-http-get-equivalent">HTTP GET equivalent</dfn>, <dfn id="dfn-task">task</dfn>, <dfn id="dfn-task-source">task source</dfn>,
and <dfn id="dfn-queue-a-task">queue a task</dfn>, <dfn id="dfn-storage-mutex">storage mutex</dfn>, the
<dfn id="dfn-manifest-1"><code>manifest</code></dfn> attribute, and the
<dfn id="dfn-function"><code>Function</code></dfn> and <dfn id="dfn-applicationcache"><code>ApplicationCache</code></dfn>
interfaces are referenced in this specification and defined by the HTML 5
specification [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>].
</dd>
<dt>HTTP</dt>
<dd>
<p>
A <a href="#dfn-conforming-user-agent" class="internalDFN"> conforming user agent</a> must support some version of the
HTTP protocol [<cite><a class="bibref" rel="biblioentry" href="#bib-HTTP11">HTTP11</a></cite>].
</p>
<p>
In order to protect against attacks, the use of the following
headers is prohibited using interfaces defined in this specification.
</p>
<ul>
<li><code>Accept</code></li>
<li><code>Accept-Charset</code></li>
<li><code>Accept-Encoding</code></li>
<li><code>Accept-Language</code></li>
<li><code>Authorization</code></li>
<li><code>Cache-Control</code></li>
<li><code>Connection</code></li>
<li><code>Content-Transfer-Encoding</code></li>
<li><code>Cookie</code></li>
<li><code>Date</code></li>
<li><code>Expect</code></li>
<li><code>Host</code></li>
<li><code>Keep-Alive</code></li>
<li><code>Origin</code></li>
<li><code>Range</code></li>
<li><code>Referer</code></li>
<li><code>Set-Cookie</code></li>
<li><code>TE</code></li>
<li><code>Trailer</code></li>
<li><code>Transfer-Encoding</code></li>
<li><code>Upgrade</code></li>
<li><code>User-Agent</code></li>
<li><code>Via</code></li>
</ul>
</dd>
<dt>HTTP State Management</dt>
<dd>
<p>
A <a href="#dfn-conforming-user-agent" class="internalDFN">conforming user agent</a> must support storage and
exchange of cookies as specified by HTTP State Management
[<cite><a class="bibref" rel="biblioentry" href="#bib-COOKIES">COOKIES</a></cite>].
</p>
</dd>
<dt>File API</dt>
<dd>The term
<dfn title="Blob" id="dfn-blob"><code>Blob</code></dfn> is referenced by this
specification and defined by the File API specification [<cite><a class="bibref" rel="biblioentry" href="#bib-FILE-API">FILE-API</a></cite>].
</dd><dt>DOM</dt>
<dd>
<p>
A <a href="#dfn-conforming-user-agent" class="internalDFN">conforming user agent</a> must define the exception codes
<dfn id="dfn-invalid_state_err"><code>INVALID_STATE_ERR</code></dfn> and
<dfn id="dfn-not_found_err"><code>NOT_FOUND_ERR</code></dfn>, and
<dfn id="dfn-event"><code>Event</code></dfn> and <dfn id="dfn-domexception"><code>DOMException</code></dfn>
interface defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-DOM-LEVEL-3-CORE">DOM-LEVEL-3-CORE</a></cite>]
and referenced in this specification.
</p>
</dd>
</dl>
</div>
</div>
<div id="terminology" class="section">
<!--OddPage--><h2><span class="secno">3. </span>Terminology</h2>
<p>
A <dfn id="dfn-managed">managed</dfn> resource is one whose URI is dynamically captured
in an <a class="externalDFN">application cache</a>.
</p>
<p>
A resource is <dfn id="dfn-captured">captured</dfn> when it is dynamically added
to an <a class="externalDFN">application cache</a>.
</p>
<p>
A resource is <dfn id="dfn-released">released</dfn> when it is dynamically removed
from an <a class="externalDFN">application cache</a>.
</p>
<p>
A <dfn id="dfn-static">static</dfn> representation is one that is generated directly
by the user agent from an <a class="externalDFN">application cache</a>.
</p>
<p>
A <dfn id="dfn-dynamic">dynamic</dfn> representation is one that is generated
programmatically by using application-supplied logic
in an embedded local server.
</p>
<p>
<dfn title="off-line" id="dfn-off-line">Transparent off-line data access and manipulation</dfn>
means to locally generate a <a href="#dfn-static" class="internalDFN">static</a> or a <a href="#dfn-dynamic" class="internalDFN">dynamic</a>
response for HTTP requests to <a href="#event-captured" class="internalDFN">captured</a> resources.
</p>
</div>
<div id="cache" class="section">
<!--OddPage--><h2><span class="secno">4. </span>Programmable HTTP Caching and Serving</h2>
<p>
Programmable HTTP processing enables applications to identify
<a href="#dfn-managed" class="internalDFN">managed</a> resources to a user agent and to produce <a href="#dfn-static" class="internalDFN">static</a>
and <a href="#dfn-dynamic" class="internalDFN">dynamic</a> representations for responding to requests on
these resources.
</p>
<div id="datacache-intro" class="section informative">
<h3><span class="secno">4.1 </span>Introduction</h3><p><em>This section is non-normative.</em></p>
<p>
A user agent processes network requests to <a>managed resources</a>
in one of three ways:
</p>
<ol>
<li>
<dfn id="dfn-serve-policy">serve policy</dfn> - respond with the <a href="#dfn-static" class="internalDFN">static</a> representation
of the requested resource (for any safe HTTP methods) from
the <a class="externalDFN">application cache</a>.
</li>
<li>
<dfn id="dfn-intercept-policy">intercept policy</dfn> -
immediately invoke an <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a> to obtain a
<a href="#dfn-dynamic" class="internalDFN">dynamic</a> representation (for any HTTP methods).
</li>
<li>
<dfn id="dfn-review-policy">review policy</dfn> -
relay the request to the server to obtain a <a href="#dfn-dynamic" class="internalDFN">dynamic</a>
representation and notify an <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>
when that representation is available (only for unsafe HTTP methods).
</li>
</ol>
<p>
The <a href="#dfn-serve-policy" class="internalDFN">serve policy</a> applies only to resources that do not
require interception, whereas the <a href="#dfn-intercept-policy" class="internalDFN">intercept policy</a> can only
be used for resources that require interception. Both policies
improve availability and responsiveness. However, both may affect
data freshness. The <a href="#dfn-review-policy" class="internalDFN">review policy</a>
can only be used when the user agent is able to communicate with
the server. This policy improves data freshness at the cost of
reduced responsiveness. User agents may choose freely from among
these options, e.g., using information about the system condition,
network state or battery power level, or a user preference.
</p>
<div class="section" id="examples">
<h4><span class="secno">4.1.1 </span>Examples</h4>
<p>
An application can use an <a class="externalDFN">application cache</a> to
programmatically <a title="captured" href="#event-captured" class="internalDFN">capture</a> the representation of a
resource, i.e., cache an <a href="#dfn-off-line" class="internalDFN">off-line</a> representation in the
<a class="externalDFN">application cache</a>.
</p>
<div class="example"><div class="exampleHeader">Example</div>
<p>
An application <a>captures</a> a resource as part of an atomic
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>. Once the resource is <a href="#event-captured" class="internalDFN">captured</a>
successfully, the application places the <a href="#event-captured" class="internalDFN">captured</a>
representation in to service. This can be performed through a
single API call.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var uri = ...
var cache = window.applicationCache;
// cache and immediately take advantage of the new stuff in the cache
cache.immediate(uri);</code></pre></div></div>
<p>
The user agent is able to then serve this <a href="#dfn-static" class="internalDFN">static</a> representation
when an application issues a <code>GET</code> request for
that resource either through page navigation or an XMLHttpRequest
[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLHTTPREQUEST">XMLHTTPREQUEST</a></cite>].
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var req = new XMLHttpRequest();
req.open('GET', uri);
...
req.send();</code></pre></div></div>
</div>
<p>
A <a href="#dfn-dynamic" class="internalDFN">dynamic</a> representation is produced by using an
<a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a> in conjunction with the
<a class="externalDFN">application cache</a>. An <a href="#dfn-interceptor" class="internalDFN">interceptor</a>
processes an HTTP request locally in an <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>
without changing the network APIs used by applications. Thus
even if a host is unreachable, applications can successfully
make HTTP requests to a <a href="#dfn-managed" class="internalDFN">managed</a> resource.
</p>
<div class="example"><div class="exampleHeader">Example</div>
<p>
In this example, a local request handler can produce a <a href="#dfn-dynamic" class="internalDFN">dynamic</a>
response to an application request when the network is not accessible.
The response can be prepared using the
<a class="externalDFN">application cache</a>, for example. The benefit
of this technique is that applications don't need to alter their
applications to accommodate <a href="#dfn-off-line" class="internalDFN">off-line</a> use cases.
Instead, user agents can transparently introduce an application-specific
<a href="#dfn-off-line" class="internalDFN">off-line</a> handler to deal with situations when the network is not
available.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var uri = ...
var cache = window.applicationCache;
var local = function(request, response) {
response.setStatus(200, 'OK');
response.setResponseText('Hello World');
};
window.navigator.registerOfflineHandler(uri, local);
var req = cache.offline(uri, '', null, ['GET']);</code></pre></div></div>
<p>
Later when that application issues a <code>GET</code> request for
the <a href="#dfn-managed" class="internalDFN">managed</a> resource either through page navigation or an XMLHttpRequest
[<cite><a class="bibref" rel="biblioentry" href="#bib-XMLHTTPREQUEST">XMLHTTPREQUEST</a></cite>], and the user agent is <a href="#dfn-off-line" class="internalDFN">off-line</a>, it invokes the
<code>local</code> <a href="#dfn-off-line" class="internalDFN">off-line</a> handler which produces a <a href="#dfn-dynamic" class="internalDFN">dynamic</a>
response.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var req = new XMLHttpRequest();
req.open('GET', uri);
...
req.send();</code></pre></div></div>
</div>
<p>
Applications can also locally intercept requests that modify data,
e.g., unsafe HTTP requests such as <code>PUT</code> in an <a href="#dfn-off-line" class="internalDFN">off-line</a>
handler. Requests to resources that are <a href="#dfn-managed" class="internalDFN">managed</a> in an
<a class="externalDFN">application cache</a> can be either:
</p>
<ul>
<li>intercepted and served by an <a href="#dfn-interceptor" class="internalDFN">interceptor</a>, when the
user agent is <a href="#dfn-off-line" class="internalDFN">off-line</a> or</li>
<li>the server, when the user agent is online with a <a href="#dfn-reviewer" class="internalDFN">reviewer</a>
analyzing the result of the online request.</li>
</ul>
<p>
A user agent can switch
between these two behaviors automatically based on system conditions.
</p>
<div class="example"><div class="exampleHeader">Example</div>
<p>
For example, an application worker script that wishes to allow <a href="#dfn-off-line" class="internalDFN">off-line</a>
updates to <var>uri</var> <a title="captured" href="#event-captured" class="internalDFN">captures</a> that resource
in an <a class="externalDFN">application cache</a>.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var uri = ...
var cache = self.applicationCache;
cache.immediate(uri, ['PUT']);
</code></pre></div></div>
<p>
Another application in the same origin could then register an <a href="#dfn-off-line" class="internalDFN">off-line</a>
handler for the same <var>uri</var> to serve <a href="#dfn-off-line" class="internalDFN">off-line</a> requests to
that resource.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var cache = window.applicationCache;
var intercept = function(request, response) {
if (...) {
// validation fails
response.setStatus(400, 'Bad Request');
response.setResponseText('Request not understood');
return;
}
var type = request.headers['Content-Type'] || 'text/plain';
var req = cache.offline(request.targetURL, request.bodyText, type);
req.onsuccess = function() {
response.setResponseText(request.bodyText);
response.setResponseHeader('Content-Type', type);
response.setStatus(200, 'OK');
}
};
var review = function(request, response) {
var req = cache.offline(request.targetURL, response.bodyText, response.headers['Content-Type']);
};
window.navigator.registerOfflineHandler(uri, intercept, review);</code></pre></div></div>
<p>
When the application makes a <code>PUT</code> request to
<var>uri</var> and the user agent is <a href="#dfn-off-line" class="internalDFN">off-line</a>,
the user agent asks the <var>intercept</var> function to
process the request and respond to it. If the user agent is online
when the request arrives, then it sends the request to
a host and asks the <var>review</var> function to process the
response received from it.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var req = new XMLHttpRequest();
req.open('PUT', uri);
...
req.send(...);</code></pre></div></div>
<p>
If this application makes a <code>GET</code> request to
<var>uri</var>, then its cached <a href="#dfn-static" class="internalDFN">static</a> representation is
returned as the response regardless of whether the user agent is off-line.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var req = new XMLHttpRequest();
req.open('GET', uri);
...
req.send();</code></pre></div></div>
</div>
</div>
<div id="cache-events" class="section informative">
<h4><span class="secno">4.1.2 </span>Event summary</h4><p><em>This section is non-normative.</em></p>
<p>
An application updates the <a href="#dfn-managed" class="internalDFN">managed</a> resources of an
<a class="externalDFN">application cache</a>. During this update, the
user agent will add or remove the representations of <a href="#dfn-managed" class="internalDFN">managed</a>
resources to and from the <a class="externalDFN">application cache</a>.
</p>
<p>
As this is going on, a number of events get fired to keep the script
updated as to the state of the <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>, so that the
user can be notified appropriately. The events are as follows:
</p>
<table>
<thead><tr><th>Event name</th><th>Occasion</th><th>Next events</th></tr></thead>
<tbody>
<tr>
<td><dfn id="event-captured"><code>captured</code></dfn></td>
<td>
The user agent has finished <a title="fetch">fetching</a>
and storing the representation of a <a href="#dfn-managed" class="internalDFN">managed</a> resource.
</td>
<td>
<a href="#event-captured"><code>captured</code></a>,
<a href="#event-released"><code>released</code></a>,
<a href="#event-ready"><code>ready</code></a>
</td>
</tr>
<tr>
<td><dfn id="event-released"><code>released</code></dfn></td>
<td>The user agent has released a <a href="#dfn-managed" class="internalDFN">managed</a> resource
and can no longer serve <a href="#dfn-off-line" class="internalDFN">off-line</a> requests to it.</td>
<td>
<a href="#event-captured"><code>captured</code></a>,
<a href="#event-released"><code>released</code></a>,
<a href="#event-ready"><code>ready</code></a>
</td>
</tr>
<tr>
<td><dfn id="event-ready"><code>ready</code></dfn></td>
<td>The user agent has finished capturing and releasing the
requested resources and does not have any pending
requests in this <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.</td>
<td>Last event in sequence.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="http-cache" class="section">
<h3><span class="secno">4.2 </span>Programmable HTTP Caching</h3>
<p>
This specification adds two new kinds of entries for
<a class="externalDFN">application cache</a> to the various kinds
defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>]:
</p>
<dl>
<dt><dfn id="dfn-static-entry">static entry</dfn></dt>
<dd>
A <a href="#dfn-managed" class="internalDFN">managed</a> resource whose representation is cached for
<a href="#dfn-off-line" class="internalDFN">off-line</a> serving. A request to a <a href="#dfn-static-entry" class="internalDFN">static entry</a>
can only be used with the <a href="#dfn-serve-policy" class="internalDFN">serve policy</a>.
</dd>
<dt><dfn id="dfn-dynamic-entry">dynamic entry</dfn></dt>
<dd>
A <a href="#dfn-managed" class="internalDFN">managed</a> resource whose representation is produced locally
by an application upon request. Each <a href="#dfn-dynamic-entry" class="internalDFN">dynamic entry</a>
identifies one or more <dfn id="dfn-dynamic-methods">dynamic methods</dfn>
for which a response can be obtained locally using an
<a href="#dfn-interceptor" class="internalDFN">interceptor</a>.
</dd>
</dl>
<div class="note">
Only a document with a manifest can use <a href="#dfn-managed" class="internalDFN">managed</a> resources.
</div>
<p>
Each <a class="externalDFN">application cache</a> has a
<dfn id="dfn-dynamic-completeness-flag">dynamic completeness flag</dfn>, which is either
<var>incomplete</var> or <var>complete</var>.
Each <a class="externalDFN">application cache</a> whose
<a href="#dfn-dynamic-completeness-flag" class="internalDFN">dynamic completeness flag</a>
is <var>complete</var> has a <dfn id="dfn-version">version</dfn>.
No two <a class="externalDFN">application cache</a>s in an
<a class="externalDFN">application cache group</a>
may have the same <a href="#dfn-version" class="internalDFN">version</a>. A <a class="externalDFN">newer</a>
<a class="externalDFN">application cache</a> has a larger <a href="#dfn-version" class="internalDFN">version</a>.
</p>
<p>
Each <a class="externalDFN">application cache group</a> has a
<dfn id="dfn-dynamic-update-status">dynamic update status</dfn>, which is one of the following:
<var>idle</var> or <var>updating</var>.
</p>
<p>
Application scripts identify the resources <a href="#dfn-managed" class="internalDFN">managed</a> by an
<a class="externalDFN">application cache</a> during a <dfn id="dfn-cache-transaction">cache transaction</dfn>,
when applications may either <a title="captured" href="#event-captured" class="internalDFN">capture</a> or
<a title="released" href="#event-released" class="internalDFN">release</a> its resources.
</p>
<p>
Each <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> has an
<a class="externalDFN">application cache group</a>
and an <a class="externalDFN">application cache</a>.
</p>
<p>
A <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> can be marked as
<dfn id="dfn-off-line-transaction">off-line transaction</dfn>.
</p>
<p>
Each <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> has a <dfn id="dfn-commit-status">commit status</dfn>,
which can be either of <var>pending</var>, <var>committed</var>, or
<var>aborted</var>.
</p>
<p>
When a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> is started, the user agent must run
the steps to <a href="#dfn-create-a-cache-transaction" class="internalDFN">create a cache transaction</a>. When a resource is
added to a transaction's list of <a href="#event-captured" class="internalDFN">captured</a> resources,
the user agent must run the steps to <a href="#dfn-add-a-resource-to-be-captured" class="internalDFN">add a resource to be captured</a>.
When a resource is added to a transaction's list of released
resources, the user agent must run the steps to
<a href="#dfn-add-a-resource-to-be-released" class="internalDFN">add a resource to be released</a>. When the transaction is finished,
the user agent must run either the steps to <a href="#dfn-commit-a-cache-transaction" class="internalDFN">commit a cache transaction</a>
or the steps to <a href="#dfn-abort-a-cache-transaction" class="internalDFN">abort a cache transaction</a>.
</p>
<div class="section" id="starting-a-transaction">
<h4><span class="secno">4.2.1 </span>Starting a transaction</h4>
<p>
When the user agent is required to <dfn id="dfn-create-a-cache-transaction">create a cache transaction</dfn>
given an <a class="externalDFN">application cache group</a> and an
off-line flag, the user agent must run the following steps:
</p>
<ol>
<li>
Let <var>cache group</var> be the
<a class="externalDFN">application cache group</a> passed to these steps.
</li>
<li>
If <var>cache group</var> is marked <a>obsolete</a>, then
set an error and abort these steps.
</li>
<li>
Pick the appropriate steps:
<dl class="switch">
<dt>If the off-line flag passed to these steps is set.</dt>
<dd>
<ol>
<li>
Create a new <a class="externalDFN">application cache</a>,
called <var>cache</var>, in <var>cache group</var>.
</li>
<li>
Set the <a href="#dfn-dynamic-completeness-flag" class="internalDFN">dynamic completeness flag</a> of <var>cache</var> to
<var>incomplete</var>.
</li>
<li>
Create a new <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> called <var>transaction</var> and
set <var>cache</var> to be its
<a class="externalDFN">application cache</a>.
</li>
<li>
Mark <var>transaction</var> as <a href="#dfn-off-line-transaction" class="internalDFN">off-line transaction</a>.
</li>
<li>
Return <var>transaction</var>.
</li>
</ol>
</dd>
<dt>If the off-line flag passed to these steps is not set.</dt>
<dd>
<ol>
<li>
Atomically, so as to avoid race conditions, perform the following sub-steps
<ol>
<li>
If the <a href="#dfn-dynamic-update-status" class="internalDFN">dynamic update status</a> of
<var>cache group</var> is <var>updating</var>,
then set an error and abort these steps, as a
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> is already open on this
<a class="externalDFN">application cache group</a>.
</li>
<li>
Set the <a href="#dfn-dynamic-update-status" class="internalDFN">dynamic update status</a> of <var>cache group</var>
to <var>updating</var>.
</li>
</ol>
</li>
<li>
Create a new <a class="externalDFN">application cache</a>,
called <var>cache</var>, in <var>cache group</var>
which holds all the same resources as the
<a class="externalDFN">relevant application cache</a> of
<var>cache group</var>.
</li>
<li>
Set the <a href="#dfn-dynamic-completeness-flag" class="internalDFN">dynamic completeness flag</a> of <var>cache</var> to
<var>incomplete</var>.
</li>
<li>
Create a new <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> called <var>transaction</var> and
set <var>cache</var> to be its <a class="externalDFN">application cache</a>.
</li>
<li>
Mark <var>transaction</var> as not <a title="off-line transaction" href="#dfn-off-line-transaction" class="internalDFN">off-line</a>.
</li>
</ol>
</dd>
</dl></li>
<li>
Set <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> to
<var>pending</var>.
</li>
<li>
Return <var>transaction</var>.
</li>
</ol>
</div>
<div class="section" id="adding-capture-transaction">
<h4><span class="secno">4.2.2 </span>Capturing resources</h4>
<p>
When the user agent is required to <dfn id="dfn-add-a-resource-to-be-captured">add a resource to be
<a href="#event-captured" class="internalDFN">captured</a></dfn>, given the URI of the resource to
<a title="captured" href="#event-captured" class="internalDFN">capture</a>, a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
optionally a list of <a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a>, optionally content to
serve as the <a href="#dfn-static" class="internalDFN">static</a> representation of that resource, and
optionally content type for that representation, the user agent
must perform the following steps:
</p>
<ol>
<li>
Let <var>transaction</var> be the <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>
passed to these steps.
</li>
<li>
If <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> is not
<var>pending</var>, then set an error and abort these steps.
</li>
<li>
Pick the appropriate sub-steps:
<dl class="switch">
<dt>If the <a class="externalDFN">cache host</a> passed to
these steps is a <code>Document</code> object</dt>
<dd>
Let <var>origin</var> be the <a href="#dfn-origin" class="internalDFN">origin</a> of the
<a class="externalDFN">cache host</a> passed to these steps.
</dd>
<dt>If the <a class="externalDFN">cache host</a> passed to
these steps is a <code>WorkerGlobalScope</code> object</dt>
<dd>
Let <var>origin</var> be the <a href="#dfn-origin" class="internalDFN">origin</a> of the scripts in the
worker for the <a class="externalDFN">cache host</a> passed to
these steps.
</dd>
</dl>
</li>
<li>
Resolve the URI passed to these steps relative to <var>base URI</var>.
</li>
<li>
If the resulting absolute URI has a different <code><scheme></code>
component than the base URI (compared in an ASCII case-insensitive
manner), then set an error and abort these steps.
</li>
<li>
If the resulting absolute URI does not have the
<a class="externalDFN">same origin</a> as <var>base URI</var>,
then set an error and abort these steps.
</li>
<li>
Drop the <code><fragment></code> component of the resulting
absolute URI, if it has one.
</li>
<li>
Let <var>cache</var> be <var>transaction</var>'s
<a class="externalDFN">application cache</a>.
</li>
<li>
If the resulting absolute URI identifies an
<a class="externalDFN">explicit entry</a> or
<a class="externalDFN">master entry</a> or the
<a class="externalDFN"> manifest</a> of <var>cache</var>, then
set an error and abort these steps.
</li>
<li>
If the resulting absolute URI identifies a <a href="#dfn-managed" class="internalDFN">managed</a> resource that
is already in <var>cache</var>, then remove that <a href="#dfn-managed" class="internalDFN">managed</a>
resource from <var>cache</var>.
</li>
<li>
Pick the appropriate sub-steps: <dl class="switch">
<dt>
If <var>transaction</var> is not marked as
<a title="off-line transaction" href="#dfn-off-line-transaction" class="internalDFN">off-line</a>
</dt>
<dd>
<ol>
<li>
If the list of dynamic methods passed to these steps
includes the method <code>GET</code>, then skip the
remaining sub-steps and store in <var>cache</var> a
<a href="#dfn-managed" class="internalDFN">managed</a> resource comprising the resulting absolute
URI and the list of
<a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> passed to these steps.
</li>
<li>
<a title="fetch">Fetch</a> the representation of the resource identified by the
absolute URI. Use the <var>transaction</var>'s
<a class="externalDFN">application cache</a> as an
HTTP cache, and honor HTTP caching semantics (such as expiration,
ETags, and so forth) with respect to that cache. User agents may also
have other caches in place that are also honored.
<p class="note">
If the resource in question is already being <a title="fetch">fetched</a>
for other reasons, then the existing download process can
sometimes be used for the purposes of this step.
</p>
</li>
<li>
If the previous step fails (e.g. the server returns a 4xx
or 5xx response or equivalent, or there is a DNS error, or
the connection times out, or the user cancels the download),
or if the server returned a redirect, then run the
<a href="#dfn-capture-failure-steps" class="internalDFN">capture failure steps</a> with the status code of the
previous step and terminate these steps.
<p class="note">
Redirects are fatal because they are either indicative of
a network problem (e.g. a captive portal); or would allow
resources to be added to the cache under URIs that differ
from any URI that the networking model will allow access
to, leaving orphan entries; or would allow resources to
be stored under URIs different than their true URIs. All
of these situations are bad.
</p>
</li>
<li>
Otherwise, the <a class="externalDFN">fetching</a> succeeded.
Store in <var>cache</var> a
<a href="#dfn-managed" class="internalDFN">managed</a> resource comprising the resulting absolute URI,
its <a title="fetch">fetched</a> representation, and the list of
<a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> passed to these steps.
</li>
</ol>
</dd>
<dt>
If <var>transaction</var> is marked as
<a title="off-line transaction" href="#dfn-off-line-transaction" class="internalDFN">off-line</a>.
</dt>
<dd>
<ol>
<li>
If the list of dynamic methods passed to these steps
includes the method <code>GET</code>, then skip the
remaining sub-steps and store in <var>cache</var> a
<a href="#dfn-managed" class="internalDFN">managed</a> resource comprising the resulting absolute
URI and the list of
<a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> passed to these steps.
</li>
<li>
Let <var>representation</var> be the content passed
to these steps.
</li>
<li>
Let <var>type</var> be the content type passed to these steps.
</li>
<li>
If <var>type</var> is empty or null, set it to <code>text/plain</code>.
</li>
<li>
Store in <var>cache</var> a <a href="#dfn-managed" class="internalDFN">managed</a> resource comprising
the resulting absolute URI, <var>representation</var>, and the list of
<a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> passed to these
steps.
</li>
</ol>
</dd>
</dl></li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event at
<var>transaction</var> for the URI passed to these steps with the
name <a href="#event-captured"><code>captured</code></a>, which
does not bubble, is not cancelable, and which uses the
<a href="#idl-def-CacheEvent" class="idlType"><code>CacheEvent</code></a> interface.
</li>
</ol>
<p>
The <dfn id="dfn-capture-failure-steps">capture failure steps</dfn> are performed with a status
code as follows:
</p>
<ol>
<li>Discard <var>cache</var>.</li>
<li>
Set <var>cache group</var>'s <a href="#dfn-dynamic-update-status" class="internalDFN">dynamic update status</a>
to <var>idle</var>.
</li>
<li>Pick the appropriate sub-steps:
<dl class="switch">
<dt>If the status code was not <code>404</code> or <code>410</code>
<a class="externalDFN">or equivalent</a>, then</dt>
<dd>
Skip this resource and <a>release</a> it from
<var>application cache</var>.
</dd>
<dt>Otherwise</dt>
<dd>
Set the error code to the status code passed to these steps.
</dd>
</dl>
</li>
<li>
Mark <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a>
as <var>aborted</var>.
</li>
</ol>
<p>
Attempts to <a>fetch</a> resources as part of the steps to
<a href="#dfn-add-a-resource-to-be-captured" class="internalDFN">add a resource to be captured</a>
may be done with cache-defeating semantics, to avoid problems with
stale or inconsistent intermediary caches.
</p>
</div>
<div class="section" id="release-resource">
<h4><span class="secno">4.2.3 </span>Releasing resources</h4>
<p>
When the user agent is required to
<dfn id="dfn-add-a-resource-to-be-released">add a resource to be <a href="#event-released" class="internalDFN">released</a></dfn>, given the URI of
the resource to <a title="released" href="#event-released" class="internalDFN">release</a>, and a
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
the user agent must perform the following steps:
</p>
<ol>
<li>
Let <var>transaction</var> be the <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>
passed to these steps.
</li>
<li>
If <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> is not
<var>pending</var>, then set an error and abort these steps.
</li>
<li>
Pick the appropriate sub-steps:
<dl class="switch">
<dt>If the <a class="externalDFN">cache host</a> passed to
these steps is a <code>Document</code> object</dt>
<dd>
Let <var>origin</var> be the <a href="#dfn-origin" class="internalDFN">origin</a> of the
<a class="externalDFN">cache host</a> passed to these steps.
</dd>
<dt>If the <a class="externalDFN">cache host</a> passed to
these steps is a <code>WorkerGlobalScope</code> object</dt>
<dd>
Let <var>origin</var> be the <a href="#dfn-origin" class="internalDFN">origin</a> of the scripts
in the worker for the <a class="externalDFN">cache host</a>
passed to these steps.
</dd>
</dl>
</li>
<li>
Resolve the URI passed to these steps relative to <var>base URI</var>.
</li>
<li>
If the resulting absolute URI has a different <code><scheme></code>
component than the base URI (compared in an ASCII case-insensitive
manner), then set an error and abort these steps.
</li>
<li>
If the resulting absolute URI does not have the same <a href="#dfn-origin" class="internalDFN">origin</a>
as <var>base URI</var>, then set an error and abort these steps.
</li>
<li>
Drop the <code><fragment></code> component of the resulting
absolute URI, if it has one.
</li>
<li>
Let <var>cache</var> be <var>transaction</var>'s
<a class="externalDFN">application cache</a>.
</li>
<li>
If the resulting absolute URI does not identify a <a href="#dfn-managed" class="internalDFN">managed</a>
resource that is already in <var>cache</var>, then set an error
and abort these steps.
</li>
<li>
Remove the <a href="#dfn-managed" class="internalDFN">managed</a>
resource for the resulting absolute URI from <var>cache</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event at
<var>transaction</var> for the URI passed to these steps with the
name <a href="#event-released"><code>released</code></a>, which
does not bubble, is not cancelable, and which uses the
<a href="#idl-def-CacheEvent" class="idlType"><code>CacheEvent</code></a> interface.
</li>
</ol>
</div>
<div class="section" id="complete-transaction">
<h4><span class="secno">4.2.4 </span>Commiting a transaction</h4>
<p>
When the user agent is required to
<dfn id="dfn-commit-a-cache-transaction">commit a cache transaction</dfn>, given a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
it means that the user agent must run the following steps:
</p>
<ol>
<li>
Let <var>transaction</var> be the
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> passed to these steps.
</li>
<li>
If <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> is not
<var>pending</var>, then set an error and abort these steps.
</li>
<li>
Let <var>cache</var> be <var>transaction</var>'s
<a class="externalDFN">application cache</a>.
</li>
<li>
Let <var>cache group</var> be the
<a class="externalDFN">application cache group</a> containing
<var>cache</var>.
</li>
<li>
Atomically, so as to avoid race conditions, perform the following
sub-steps:
<ol>
<li>
Let <var>cache group version</var> be the <a href="#dfn-version" class="internalDFN">version</a> of the
<a class="externalDFN">relevant application cache</a> of
<var>cache group</var>.
</li>
<li>
Set <var>cache</var>'s <a href="#dfn-version" class="internalDFN">version</a>
to be higher than <var>cache group version</var>.
</li>
<li>
Set the <var>cache</var>'s <a href="#dfn-dynamic-completeness-flag" class="internalDFN">dynamic completeness flag</a> to
<var>complete</var>.
</li>
<li>Obtain the <a href="#dfn-storage-mutex" class="internalDFN">storage mutex</a>.</li>
<li>
If the host sets cookies in response to such a request,
the user agent should update its cookie store accordingly.
</li>
<li>Release the <a href="#dfn-storage-mutex" class="internalDFN">storage mutex</a>.</li>
</ol>
</li>
<li>
Pick the appropriate sub-steps:
<dl class="switch">
<dt>
If <var>transaction</var> is marked as
<a title="off-line transaction" class="dfnref internalDFN" href="#dfn-off-line-transaction">off-line</a>, then
</dt>
<dd>
<ol>
<li>
Make <var>cache</var> the
<a class="externalDFN">effective application cache</a> for
<var>cache group</var> to the
<a class="externalDFN">cache host</a>
passed to these steps.
</li>
</ol>
</dd>
<dt>
If <var>transaction</var> is not marked as
<a title="off-line transaction" class="dfnref internalDFN" href="#dfn-off-line-transaction">off-line</a>, then
</dt>
<dd>
<ol>
<li>
Set the <a href="#dfn-dynamic-update-status" class="internalDFN">dynamic update status</a> of <var>cache group</var>
to <var>idle</var>.
</li>
</ol>
</dd>
</dl>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event at <var>transaction</var>
with the name <a href="#event-ready"><code>ready</code></a>,
which does not bubble, is not cancelable, and which uses the
<a href="#dfn-event" class="internalDFN"><code>Event</code></a> interface.
</li>
<li>
Set <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> as <var>committed</var>.
</li>
</ol>
</div>
<div class="section" id="abort-transaction">
<h4><span class="secno">4.2.5 </span>Aborting a transaction</h4>
<p>
When the user agent is required to <dfn id="dfn-abort-a-cache-transaction">abort a cache transaction</dfn>,
given a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
it means that the user agent must run the following steps:
</p>
<ol>
<li>
Let <var>transaction</var> be the <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>
passed to these steps.
</li>
<li>
If <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> is not
<var>pending</var>, then set an error and abort these steps.
</li>
<li>
Discard <var>transaction</var>'s <a class="externalDFN">application cache</a>.
</li>
<li>
Set <var>transaction</var>'s <a href="#dfn-commit-status" class="internalDFN">commit status</a> as
<var>aborted</var>.
</li>
</ol>
</div>
<div class="section" id="datacache-api">
<h4><span class="secno">4.2.6 </span>The API Entry Point</h4>
<div class="example"><div class="exampleHeader">Example</div>
<p>
Here's how a shared worker opens an
<a class="externalDFN">application cache group</a>.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var cache = self.applicationCache;</code></pre></div></div>
<p>
Here's how a window opens an
<a class="externalDFN">application cache group</a>.
</p>
<div class="block"><div class="blockTitleDiv"><span class="blockTitle">ECMAScript</span></div><div class="blockContent"><pre class="code"><code class="es-code">var cache = window.applicationCache;</code></pre></div></div>
</div>
<pre class="idl"><span class="idlInterface" id="idl-def-CacheUtil">[<span class="extAttr">Supplemental</span>]
interface <span class="idlInterfaceID">CacheUtil</span> {
<span class="idlAttribute"> attribute <span class="idlAttrType"><a href="#idl-def-ApplicationCache2Request" class="idlType"><code>ApplicationCache2Request</code></a></span> <span class="idlAttrName"><a href="#widl-CacheUtil-applicationCache">applicationCache</a></span>;</span>
};</span>
</pre><div class="section"><h5 id="attributes">Attributes</h5><dl class="attributes"><dt id="widl-CacheUtil-applicationCache"><code>applicationCache</code> of type <span class="idlAttrType"><a href="#idl-def-ApplicationCache2Request" class="idlType"><code>ApplicationCache2Request</code></a></span></dt><dd>
<p>
(In a window.) Returns the <a href="#idl-def-ApplicationCache2Request" class="idlType"><code>ApplicationCache2Request</code></a>
object that applies to the <a class="externalDFN">active document</a>
of that <a class="externalDFN"><code>Window</code></a>.
</p>
<p>
(In a shared worker.) Returns the <a href="#idl-def-ApplicationCache2Request" class="idlType"><code>ApplicationCache2Request</code></a>
object that applies to the current shared worker.
</p>
<div><em>No exceptions.</em></div></dd></dl></div>
<pre class="idl"><span class="idlImplements"><a>Window</a> implements <a href="#idl-def-CacheUtil" class="idlType"><code>CacheUtil</code></a>;</span></pre><div class="idlImplementsDesc"><p>All instances of the <code><a>Window</a></code> type are defined to also implement the <a href="#idl-def-CacheUtil" class="idlType"><code>CacheUtil</code></a> interface.</p></div>
<pre class="idl"><span class="idlImplements"><a>WorkerGlobalScope</a> implements <a href="#idl-def-CacheUtil" class="idlType"><code>CacheUtil</code></a>;</span></pre><div class="idlImplementsDesc"><p>All instances of the <code><a>WorkerGlobalScope</a></code> type are defined to also implement the <a href="#idl-def-CacheUtil" class="idlType"><code>CacheUtil</code></a> interface.</p></div>
<!--dl class="idl" title="[Supplemental] interface CacheUtilSync">
<dt>attribute ApplicationCache2Re applicationCache</dt>
<dd>
(In a shared worker.) Returns the <a><code>ApplicationCache2Sync</code></a>
object that applies to the current shared worker.
</dd>
</dl-->
</div>
<div id="request-events" class="section">
<h4><span class="secno">4.2.7 </span>Asynchronous requests</h4>
<p>
Events are fired during asynchronous access as <a href="#dfn-managed" class="internalDFN">managed</a>
resources are accessed and manipulated. As requests are made for
<a href="#dfn-managed" class="internalDFN">managed</a> resources, the user agent processes them and saves
or retrieves data from the network or storage, and when the
required data is available, it alerts the application through the
firing of events. The events are as follows:
</p>
<table style="margin-bottom: 0.5em;">
<thead><tr><th>Event name</th><th>Dispatched when...</th></tr></thead>
<tbody>
<tr>
<td><dfn id="event-success"><code>success</code></dfn></td>
<td>The <a class="externalDFN">application cache</a> request has
been completed and its results are available.</td>
</tr>
<tr>
<td><dfn id="event-error"><code>error</code></dfn></td>
<td>There was an error performing the
<a class="externalDFN">application cache</a> request.</td>
</tr>
</tbody>
</table>
<pre class="idl"><span class="idlInterface" id="idl-def-AppCacheRequest">interface <span class="idlInterfaceID">AppCacheRequest</span> {
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-AppCacheRequest-abort">abort</a></span> ();</span>
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-AppCacheRequest-INITIAL">INITIAL</a></span> = <span class="idlConstValue">0</span>;</span>
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-AppCacheRequest-LOADING">LOADING</a></span> = <span class="idlConstValue">1</span>;</span>
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-AppCacheRequest-DONE">DONE</a></span> = <span class="idlConstValue">2</span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned short</a></span> <span class="idlAttrName"><a href="#widl-AppCacheRequest-readyState">readyState</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>any</a></span> <span class="idlAttrName"><a href="#widl-AppCacheRequest-error">error</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>any</a></span> <span class="idlAttrName"><a href="#widl-AppCacheRequest-result">result</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><a>Function</a></span> <span class="idlAttrName"><a href="#widl-AppCacheRequest-onsuccess">onsuccess</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><a>Function</a></span> <span class="idlAttrName"><a href="#widl-AppCacheRequest-onerror">onerror</a></span>;</span>
};</span>
</pre><div class="section"><h5 id="attributes-1">Attributes</h5><dl class="attributes"><dt id="widl-AppCacheRequest-error"><code>error</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>The error that occurred during the execution of this request<div><em>No exceptions.</em></div></dd><dt id="widl-AppCacheRequest-onerror"><code>onerror</code> of type <span class="idlAttrType"><a>Function</a></span></dt><dd>The <a class="externalDFN">event handler</a> for the
<a href="#event-error"><code>error</code></a> event<div><em>No exceptions.</em></div></dd><dt id="widl-AppCacheRequest-onsuccess"><code>onsuccess</code> of type <span class="idlAttrType"><a>Function</a></span></dt><dd>The <a class="externalDFN">event handler</a> for the
<a href="#event-success"><code>success</code></a> event<div><em>No exceptions.</em></div></dd><dt id="widl-AppCacheRequest-readyState"><code>readyState</code> of type <span class="idlAttrType"><a>unsigned short</a></span>, readonly</dt><dd>The completion state of this request<div><em>No exceptions.</em></div></dd><dt id="widl-AppCacheRequest-result"><code>result</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>The result of a successful completion of the request<div><em>No exceptions.</em></div></dd></dl></div><div class="section"><h5 id="methods">Methods</h5><dl class="methods"><dt id="widl-AppCacheRequest-abort"><code>abort</code></dt><dd>Discontinue the in-flight request and return the
<a href="#widl-AppCacheRequest-readyState"><code>readyState</code></a> to
<a href="#widl-AppCacheRequest-INITIAL"><code>INITIAL</code></a>. No
<a href="#widl-AppCacheRequest-result"><code>result</code></a> or
<a href="#widl-AppCacheRequest-error"><code>error</code></a> is
set.<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div><div class="section"><h5 id="constants">Constants</h5><dl class="constants"><dt id="widl-AppCacheRequest-DONE"><code>DONE</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>This state indicates that a result to a previous request is
available in the
<a href="#widl-AppCacheRequest-result"><code>result</code></a> or
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
attribute.</dd><dt id="widl-AppCacheRequest-INITIAL"><code>INITIAL</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>This state indicates that a request has not been started.</dd><dt id="widl-AppCacheRequest-LOADING"><code>LOADING</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>This state indicates that a request has been started but its
result is not yet available.</dd></dl></div>
</div>
<div class="section" id="extending-the-applicationcache-interface">
<h4><span class="secno">4.2.8 </span>Extending the <code>ApplicationCache</code> interface</h4>
<p>
Additional metadata is available about an
<a class="externalDFN">application cache</a> through the
<a href="#idl-def-ApplicationCache2" class="idlType"><code>ApplicationCache2</code></a>.
</p>
<pre class="idl"><span class="idlInterface" id="idl-def-ApplicationCache2">interface <span class="idlInterfaceID">ApplicationCache2</span> : <span class="idlSuperclass"><a>ApplicationCache</a></span> {
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned long</a></span> <span class="idlAttrName"><a href="#widl-ApplicationCache-version">version</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned long long</a></span> <span class="idlAttrName"><a href="#widl-ApplicationCache-size">size</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>long long</a></span> <span class="idlAttrName"><a href="#widl-ApplicationCache-lastRefresh">lastRefresh</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned long</a></span> <span class="idlAttrName"><a href="#widl-ApplicationCache-pendingUpdates">pendingUpdates</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-ApplicationCache-outbox">outbox</a></span>;</span>
};</span>
</pre><div class="section"><h5 id="attributes-2">Attributes</h5><dl class="attributes"><dt id="widl-ApplicationCache-lastRefresh"><code>lastRefresh</code> of type <span class="idlAttrType"><a>long long</a></span>, readonly</dt><dd>The number of milliseconds since the midnight of January 1, 1970
that elapsed till the time this
<a class="externalDFN">application cache</a> was last refreshed<div><em>No exceptions.</em></div></dd><dt id="widl-ApplicationCache-outbox"><code>outbox</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>The URL for processing items in the outbox of the application
using this <a class="externalDFN">application cache</a><div><em>No exceptions.</em></div></dd><dt id="widl-ApplicationCache-pendingUpdates"><code>pendingUpdates</code> of type <span class="idlAttrType"><a>unsigned long</a></span>, readonly</dt><dd>A count of the approximate number of updates that are pending for
the application<div><em>No exceptions.</em></div></dd><dt id="widl-ApplicationCache-size"><code>size</code> of type <span class="idlAttrType"><a>unsigned long long</a></span>, readonly</dt><dd>The approximate number of bytes occupied by this
<a class="externalDFN">application cache</a>.<div><em>No exceptions.</em></div></dd><dt id="widl-ApplicationCache-version"><code>version</code> of type <span class="idlAttrType"><a>unsigned long</a></span>, readonly</dt><dd>The <a href="#dfn-version" class="internalDFN">version</a> of this <a class="externalDFN">application cache</a><div><em>No exceptions.</em></div></dd></dl></div>
<div class="note">
Interactions with an <a class="externalDFN">application cache</a>
cause background network and storage processing. Since these
actions can take time, an asynchronous request-based API is
specified here.
</div>
<pre class="idl"><span class="idlInterface" id="idl-def-ApplicationCache2Request">interface <span class="idlInterfaceID">ApplicationCache2Request</span> : <span class="idlSuperclass"><a href="#idl-def-ApplicationCache2" class="idlType"><code>ApplicationCache2</code></a></span> {
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-ApplicationCacheRequest-setOutbox">setOutbox</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-ApplicationCacheRequest-immediate">immediate</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">dynamicMethods</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-ApplicationCacheRequest-offline">offline</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>, <span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">body</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">contentType</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">dynamicMethods</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-ApplicationCacheRequest-transaction">transaction</a></span> (<span class="idlParam">in optional <span class="idlParamType"><a>boolean</a></span> <span class="idlParamName">restart</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-ApplicationCacheRequest-offlineTransaction">offlineTransaction</a></span> ();</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-CacheCursorRequest" class="idlType"><code>CacheCursorRequest</code></a></span> <span class="idlMethName"><a href="#widl-ApplicationCacheRequest-openModifiedItemCursor">openModifiedItemCursor</a></span> (<span class="idlParam">in <span class="idlParamType"><a>long</a></span> <span class="idlParamName">version</span></span>) raises (<span class="idlRaises"><a>DOMException</a></span>);</span>
};</span>
</pre><div class="section"><h5 id="methods-1">Methods</h5><dl class="methods"><dt id="widl-ApplicationCacheRequest-immediate"><code>immediate</code></dt><dd>
When this method is called, the user agent returns immediately
with a new <a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called
<var>result</var> and asynchronously performs the following steps:
<ol>
<li>
Perform the steps to <a href="#dfn-create-a-cache-transaction" class="internalDFN">create a cache transaction</a>
using this <a class="externalDFN">application cache group</a>
and an unset off-line flag. Call the returned
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> as <var>transaction</var>.
</li>
<li>
If there was an error while starting a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
then perform the following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
Perform the steps to <a href="#dfn-add-a-resource-to-be-captured" class="internalDFN">add a resource to be captured</a>
with the URI passed to these steps, <var>transaction</var>,
and the dynamic methods passed to these steps.
</li>
<li>
If there was an error while capturing, then perform the
following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
<li>
Switch to the <a class="externalDFN">newest application cache</a>
in this <a class="externalDFN">application cache group</a>.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource to <a title="captured" href="#event-captured" class="internalDFN">capture</a></td></tr><tr><td class="prmName">dynamicMethods</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">
The <a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-ApplicationCacheRequest-offline"><code>offline</code></dt><dd>
When this method is called, the user agent returns immediately
with a new <a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called
<var>result</var> and asynchronously performs the following steps:
<ol>
<li>
Perform the steps to <a href="#dfn-create-a-cache-transaction" class="internalDFN">create a cache transaction</a>
using this <a class="externalDFN">application cache group</a>
and a set off-line flag. Call the returned
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> as <var>transaction</var>.
</li>
<li>
If there was an error while starting a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
then perform the following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
Perform the steps to <a href="#dfn-add-a-resource-to-be-captured" class="internalDFN">add a resource to be captured</a>
with the URI passed to these steps, <var>transaction</var>,
the dynamic methods passed to these steps, the body
passed to these steps, and the content type passed to
these steps.
</li>
<li>
If there was an error while capturing, then perform the
following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
<li>
Switch to the <a class="externalDFN">newest application cache</a>
in this <a class="externalDFN">application cache group</a>.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource to <a title="captured" href="#event-captured" class="internalDFN">capture</a></td></tr><tr><td class="prmName">body</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">entity body for the resource</td></tr><tr><td class="prmName">contentType</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">The MIME type of the entity body</td></tr><tr><td class="prmName">dynamicMethods</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">
The <a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-ApplicationCacheRequest-offlineTransaction"><code>offlineTransaction</code></dt><dd>
When this method is called, the user agent returns immediately
with a new <a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called
<var>result</var> and asynchronously performs the following steps:
<ol>
<li>
Perform the steps to <a href="#dfn-create-a-cache-transaction" class="internalDFN">create a cache transaction</a> with
this <a class="externalDFN">application cache group</a> of this
object and a set off-line flag.
</li>
<li>
If there was an error while starting a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
then perform the following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface
</li>
</ol>
</li>
<li>
Call the returned <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> as
<var>transaction</var>.
</li>
<li>
Let <var>txn</var> be a new
<a href="#idl-def-OfflineTransactionRequest" class="idlType"><code>OfflineTransactionRequest</code></a> object for
<var>transaction</var>.
</li>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-result"><code>result</code></a>
to be <var>txn</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-ApplicationCacheRequest-openModifiedItemCursor"><code>openModifiedItemCursor</code></dt><dd>
When this method is called, the user agent performs the
steps to <a href="#dfn-create-a-cache-cursor" class="internalDFN">create a cache cursor</a> with
this <a class="externalDFN">application cache</a> and the
version passed to these steps, and returns the
result of those steps.
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">version</td><td class="prmType"><code><a>long</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"><a title="version" href="#dfn-version" class="internalDFN">Version</a> of this
<a href="#dfn-application-cache" class="internalDFN">application cache</a> since which modifications are sought.
A value <code>0</code> indicates that every modification since
the first <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> of this
<a href="#dfn-application-cache" class="internalDFN">application cache</a> is sought.</td></tr></table><table class="exceptions"><tr><th>Exception</th><th>Description</th></tr><tr><td class="excName"><a>DOMException</a></td><td class="excDesc">
The method must raise an
<a class="externalDFN"><code>INVALID_STATE_ERR</code></a> if
the version passed to these steps is not less than the
<a href="#dfn-version" class="internalDFN">version</a> of this <a href="#dfn-application-cache" class="internalDFN">application cache</a>.
</td></tr></table><div><em>Return type: </em><code><a href="#idl-def-CacheCursorRequest" class="idlType"><code>CacheCursorRequest</code></a></code></div></dd><dt id="widl-ApplicationCacheRequest-setOutbox"><code>setOutbox</code></dt><dd>
Set the
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource to use as the URL for processing items in
the outbox of the application using this
<a class="externalDFN">application cache</a></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-ApplicationCacheRequest-transaction"><code>transaction</code></dt><dd>
When this method is called, the user agent returns immediately
with a new <a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called
<var>result</var> and asynchronously performs the following steps:
<ol>
<li>
If this <a class="externalDFN">application cache group</a>
has a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> whose <a href="#dfn-commit-status" class="internalDFN">commit status</a>
is <var>pending</var>, then choose from the following:
<dl class="switch">
<dt>If the <var>restart</var> flag
was passed to these steps and it is set</dt>
<dd>Let <var>transaction</var> be that
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.</dd>
<dt>Otherwise</dt>
<dd>Perform the steps to <a href="#dfn-abort-a-cache-transaction" class="internalDFN">abort a cache transaction</a>
with that <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.</dd>
</dl>
</li>
<li>
If <var>transaction</var> is not set, then perform the
following sub-steps:
<ol>
<li>
Perform the steps to <a href="#dfn-create-a-cache-transaction" class="internalDFN">create a cache transaction</a> with
this <a class="externalDFN">application cache group</a> and
an unset off-line flag.
</li>
<li>
If there was an error while starting a <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
then perform the following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
Call the returned <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a> as
<var>transaction</var>.
</li>
</ol>
</li>
<li>
Let <var>txn</var> be a new
<a href="#idl-def-OnlineTransactionRequest" class="idlType"><code>OnlineTransactionRequest</code></a> object for
<var>transaction</var>.
</li>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-result"><code>result</code></a>
to be <var>txn</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">restart</td><td class="prmType"><code><a>boolean</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">This defaults to false. This flag specifies whether to continue a
previously abandoned <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.
</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd></dl></div>
<p>
When the user agent is required to <dfn id="dfn-create-a-cache-cursor">create a cache cursor</dfn>,
given the <a class="externalDFN">application cache</a> and the
low watermark version, the user agent must return a new
<a href="#idl-def-CacheCursorRequest" class="idlType"><code>CacheCursorRequest</code></a> object, called <var>result</var>
and asynchronously perform the following steps:
</p>
<ol>
<li>
Let <var>additions</var> be a list of entities with their URIs and
let <var>removals</var> be a list of URIs.
</li>
<li>
Let <var>cache</var> be the <a class="externalDFN">application cache</a>
passed to these steps.
</li>
<li>
For each <a class="externalDFN">application cache</a> belonging to
<var>cache</var>'s <a class="externalDFN">application cache group</a>,
starting from <var>cache</var>'s <a href="#dfn-version" class="internalDFN">version</a> down to
<var>low watermark version</var>, perform the following sub-steps:
<ol>
<li>
Let <var>old cache</var> be the
<a class="externalDFN">application cache</a>.
</li>
<li>
Let <var>old version</var> be <var>old cache</var>'s <a href="#dfn-version" class="internalDFN">version</a>.
</li>
<li>
For the entity <var>entity</var> of each <a href="#dfn-managed" class="internalDFN">managed</a> resource of
<var>old cache</var> that was added in the <var>old version</var>, perform
the following steps:
<ol>
<li>
Let <var>id</var> be the URI of the <a href="#dfn-managed" class="internalDFN">managed</a> resource.
</li>
<li>
If neither <var>additions</var> nor <var>removals</var>
already includes <var>id</var>, then add <var>id</var>
with <var>entity</var> to <var>additions</var>.
</li>
</ol>
</li>
<li>
For each <a href="#dfn-managed" class="internalDFN">managed</a> resource of <var>old cache</var> that was
removed in the <var>old version</var>, perform the following steps:
<ol>
<li>
Let <var>id</var> be the URI of the <a href="#dfn-managed" class="internalDFN">managed</a> resource.
</li>
<li>
If neither <var>additions</var> nor <var>removals</var>
already includes <var>id</var>, then add <var>id</var>
to <var>removals</var>.
</li>
</ol>
</li>
</ol>
</li>
<li>
Prepare a list of items by appending <var>removals</var> to
<var>additions</var> and set that list as <var>cursor</var>'s
<var>item list</var>.
</li>
<li>
Set <var>cursor</var>'s current position to the first item in
<var>item list</var>.
</li>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-result"><code>result</code></a>
to the item at <var>cursor</var>'s current position in
<var>item list</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<pre class="idl"><span class="idlInterface" id="idl-def-CacheCursorRequest">interface <span class="idlInterfaceID">CacheCursorRequest</span> : <span class="idlSuperclass"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> {
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CacheCursorRequest-continue">continue</a></span> ();</span>
};</span>
</pre><div class="section"><h5 id="methods-2">Methods</h5><dl class="methods"><dt id="widl-CacheCursorRequest-continue"><code>continue</code></dt><dd>
<ol>
<li>
If there are no more items past this object's current position,
in <var>item list</var>, then skip the remaining steps and
perform the following sub-steps:
<ol>
<li>
Set <a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be <code>0</code>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
If there is another item past this object's current position,
in <var>item list</var>, then move this object's current position
to the next in <var>item list</var>.
</li>
<li>
Set <a href="#widl-AppCacheRequest-result"><code>result</code></a>
to the item at <var>cursor</var>'s current position in
<var>item list</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at this object with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface
</li>
</ol>
<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-CacheTransactionRequest">interface <span class="idlInterfaceID">CacheTransactionRequest</span> {
<span class="idlAttribute"> attribute <span class="idlAttrType"><a>Function</a></span> <span class="idlAttrName"><a href="#widl-CacheTransactionRequest-oncaptured">oncaptured</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><a>Function</a></span> <span class="idlAttrName"><a href="#widl-CacheTransactionRequest-onreleased">onreleased</a></span>;</span>
<span class="idlAttribute"> attribute <span class="idlAttrType"><a>Function</a></span> <span class="idlAttrName"><a href="#widl-CacheTransactionRequest-onready">onready</a></span>;</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-resetPendingUpdates">resetPendingUpdates</a></span> ();</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-incrementPendingUpdates">incrementPendingUpdates</a></span> ();</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-decrementPendingUpdates">decrementPendingUpdates</a></span> ();</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-getItem">getItem</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-release">release</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-abort">abort</a></span> ();</span>
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-CacheTransactionRequest-commit">commit</a></span> ();</span>
};</span>
</pre><div class="section"><h5 id="attributes-3">Attributes</h5><dl class="attributes"><dt id="widl-CacheTransactionRequest-oncaptured"><code>oncaptured</code> of type <span class="idlAttrType"><a>Function</a></span></dt><dd>The <a class="externalDFN">event handler</a> for the
<a href="#event-captured"><code>captured</code></a>
event<div><em>No exceptions.</em></div></dd><dt id="widl-CacheTransactionRequest-onready"><code>onready</code> of type <span class="idlAttrType"><a>Function</a></span></dt><dd>The <a class="externalDFN">event handler</a> for the
<a href="#event-ready"><code>ready</code></a>
event<div><em>No exceptions.</em></div></dd><dt id="widl-CacheTransactionRequest-onreleased"><code>onreleased</code> of type <span class="idlAttrType"><a>Function</a></span></dt><dd>The <a class="externalDFN">event handler</a> for the
<a href="#event-released"><code>released</code></a>
event<div><em>No exceptions.</em></div></dd></dl></div><div class="section"><h5 id="methods-3">Methods</h5><dl class="methods"><dt id="widl-CacheTransactionRequest-abort"><code>abort</code></dt><dd>
When called, this method must immediately return with a new
<a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called <var>result</var> and
asynchronously perform the following steps:
<ol>
<li>
Execute the steps to <a href="#dfn-abort-a-cache-transaction" class="internalDFN">abort a cache transaction</a> with the
this <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.
</li>
<li>
If the steps raised an error,
then skip the remaining steps and perform the following sub-steps:
<ol>
<li>
Set <a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error set in the above steps.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at this object with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-CacheTransactionRequest-commit"><code>commit</code></dt><dd>
When called, this method must immediately return with a new
<a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called <var>result</var> and
asynchronously perform the following steps:
<ol>
<li>
Execute the steps to <a href="#dfn-commit-a-cache-transaction" class="internalDFN">commit a cache transaction</a> with the
this <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.
</li>
<li>
If the steps raised an error,
then skip the remaining steps and perform the following sub-steps:
<ol>
<li>
Set <a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error set in the above steps.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at this object with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-CacheTransactionRequest-decrementPendingUpdates"><code>decrementPendingUpdates</code></dt><dd>Decrement the count of pending updates for this
<a class="externalDFN">application cache</a> by <code>1</code><div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-CacheTransactionRequest-getItem"><code>getItem</code></dt><dd>
When called, this method must immediately return with a new
<a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called <var>result</var> and
asynchronously perform the following steps:
<ol>
<li>
If the resource identified by <var>uri</var> does not exist in this
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>'s <a class="externalDFN">application cache</a>,
then skip the remaining steps and perform the following sub-steps:
<ol>
<li>
Set <a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be <a class="externalDFN"><code>NOT_FOUND_ERR</code></a>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
Let <var>item</var> be the entity in this
<a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>'s <a class="externalDFN">application cache</a>.
</li>
<li>
Create <var>object</var>, a new <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a>
object with the associated <var>item</var>.
</li>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-result"><code>result</code></a>
to <var>object</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at this object with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-CacheTransactionRequest-incrementPendingUpdates"><code>incrementPendingUpdates</code></dt><dd>Increment the count of pending updates for this
<a class="externalDFN">application cache</a> by <code>1</code><div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-CacheTransactionRequest-release"><code>release</code></dt><dd>
When called, this method must immediately return with a new
<a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called <var>result</var> and
asynchronously perform the following steps:
<ol>
<li>
Perform the steps to <a href="#dfn-add-a-resource-to-be-released" class="internalDFN">add a resource to be released</a>
with the first argument being <var>uri</var> and
the third being this <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>.
</li>
<li>
If the steps raised an error,
then skip the remaining steps and perform the following sub-steps:
<ol>
<li>
Set <a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error set in the above steps.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at this object with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource to release</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd><dt id="widl-CacheTransactionRequest-resetPendingUpdates"><code>resetPendingUpdates</code></dt><dd>Set the count of pending updates for this
<a class="externalDFN">application cache</a> to <code>0</code><div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-OnlineTransactionRequest">interface <span class="idlInterfaceID">OnlineTransactionRequest</span> : <span class="idlSuperclass"><a href="#idl-def-CacheTransactionRequest" class="idlType"><code>CacheTransactionRequest</code></a></span> {
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-OnlineTransactionRequest-capture">capture</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">dynamicMethods</span></span>);</span>
};</span>
</pre><div class="section"><h5 id="methods-4">Methods</h5><dl class="methods"><dt id="widl-OnlineTransactionRequest-capture"><code>capture</code></dt><dd>
When called, this method must immediately return with a new
<a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called <var>result</var> and
asynchronously perform the following steps:
<ol>
<li>
Perform the steps to <a href="#dfn-add-a-resource-to-be-captured" class="internalDFN">add a resource to be captured</a>
with the URI passed to these steps, this <a href="#dfn-cache-transaction" class="internalDFN">cache transaction</a>,
and the dynamic methods passed to these steps.
</li>
<li>
If there was an error while capturing, then perform the
following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource to <a>capture</a></td></tr><tr><td class="prmName">dynamicMethods</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">
The <a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-OfflineTransactionRequest">interface <span class="idlInterfaceID">OfflineTransactionRequest</span> : <span class="idlSuperclass"><a href="#idl-def-CacheTransactionRequest" class="idlType"><code>CacheTransactionRequest</code></a></span> {
<span class="idlMethod"> <span class="idlMethType"><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></span> <span class="idlMethName"><a href="#widl-OfflineTransactionRequest-capture">capture</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>, <span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">body</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">contentType</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">dynamicMethods</span></span>);</span>
};</span>
</pre><div class="section"><h5 id="methods-5">Methods</h5><dl class="methods"><dt id="widl-OfflineTransactionRequest-capture"><code>capture</code></dt><dd>
When called, this method must immediately return with a new
<a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a> object called <var>result</var> and
asynchronously perform the following steps:
<ol>
<li>
Perform the steps to <a href="#dfn-add-a-resource-to-be-captured" class="internalDFN">add a resource to be captured</a>
with the URI passed to these steps, <var>transaction</var>,
the dynamic methods passed to these steps, the body
passed to these steps, and the content type passed to
these steps.
</li>
<li>
If there was an error while capturing, then perform the
following sub-steps and skip the remaining steps:
<ol>
<li>
Set <var>result</var>'s
<a href="#widl-AppCacheRequest-error"><code>error</code></a>
to be the error of the previous step.
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-error internalDFN" href="#event-error"><code>error</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
</li>
<li>
<a class="externalDFN">Queue a task</a> to fire an event
at <var>result</var> with the name
<a class="#event-success internalDFN" href="#event-success"><code>success</code></a>, which
does not bubble, is not cancelable, and which uses the
<a class="externalDFN"><code>Event</code></a> interface.
</li>
</ol>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the resource to <a>capture</a></td></tr><tr><td class="prmName">body</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">entity body for the resource</td></tr><tr><td class="prmName">contentType</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">The MIME type of the entity body</td></tr><tr><td class="prmName">dynamicMethods</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">
The <a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a href="#idl-def-AppCacheRequest" class="idlType"><code>AppCacheRequest</code></a></code></div></dd></dl></div> <!--
</section>
<section id="sync-datacache-interface" class="section">
<h4>Synchronous Data Cache API</h4>
<dl class="idl" title="interface CacheItemCursor">
<dt>readonly attribute CacheItem item</dt>
<dd></dd>
<dt>bool continue()</dt>
<dd></dd>
</dl>
<dl class="idl" title="interface ApplicationCache2Sync : interface ApplicationCache2">
<dt>void immediate()</dt>
<dd>
When this method is called, the user agent creates a new
<a>cache transaction</a>, and performs the steps to
<a>add a resource to be captured</a> in that <a>cache transaction</a>,
and when the identified resource is <a title="capture">captured</a>,
performs the steps to <a>activate updates</a> for this
<a class="externalDFN">application cache group</a>.
<dl class="parameters">
<dt>DOMString uri</dt>
<dd>identifying the resource to <a>capture</a></dd>
<dt>optional DOMString dynamicMethods</dt>
<dd>
The <a>dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</dd>
</dl>
</dd>
<dt>OnlineTransaction transaction()</dt>
<dd>
<p>
This method must perform the following steps:
</p>
<ol>
<li>
Execute the steps to <a>create a cache transaction</a> with the
first argument being the
<a class="externalDFN">application cache group</a> of this
object and the second argument being false.
</li>
<li>
Let <var>result</var> be a new <a><code>CacheTransaction</code></a>
object for the <var>transaction</var> returned from the previous step.
</li>
<li>Return <var>result</var>.</li>
</ol>
<dl class="parameters">
<dt>optional boolean restart</dt>
<dd>This defaults to false. This flag specifies whether to continue a
previously abandoned <a>cache transaction</a>.</dt>
</dl>
</dd>
<dt>OfflineTransaction offlineTransaction()</dt>
<dd>
This method takes one or two arguments - a <var>transaction
callback</var> and optionally an <var>error callback</var>.
When called, this method must immediately return and asynchronously
perform the following steps:
<ol>
<li>
Execute the steps to <a>create a cache transaction</a> with the
first argument being the
<a class="externalDFN">application cache group</a> of this <a><code>DataCache</code></a>
object and the second argument being <code>true</code>.
</li>
<li>
Let <var>result</var> be a new <a><code>CacheTransaction</code></a>
object for the <var>transaction</var> returned from the previous step.
</li>
<li>
If <var>transaction callback</var> is not null,
<a class="externalDFN">queue a task</a> to invoke the
<var>transaction callback</var>
with the aforementioned <a><code>CacheTransaction</code></a>
object as its only argument, and wait for that task to be run.
</li>
<li>
If <var>transaction callback</var> raised an exception, jump to
the last step.
</li>
<li>
End these steps. The next step is only used when something goes wrong.
</li>
<li>
<a class="externalDFN">Queue a task</a> to invoke the <var>error callback</var>,
if it is not null.
</li>
</ol>
</dd>
<dt>void forEachModificationSince()</dt>
<dd>
<dl class="parameters">
<dt>long version</dt>
<dd></dd>
<dt>ItemCallback callback</dt>
<dd></dd>
</dl>
This method takes one to three parameters - <var>low watermark version</var> and
<var>item callback</var>, and an optional <var> success callback</var>. When
called, this method must immediately return and asynchronously perform the
following steps:
<ol>
<li>
Let <var>additions</var> be a list of entities with their URIs and
let <var>removals</var> be a list of URIs.
</li>
<li>
Let <var>cache</var> be the <a class="externalDFN">application cache</a>
represented by this object.
</li>
<li>
For each <a class="externalDFN">application cache</a> belonging to
<var>cache</var>'s <a class="externalDFN">application cache group</a>,
starting from <var>cache</var>'s
<a>version</a> down to <var>low watermark version</var>,
perform the following sub-steps:
<ol>
<li>
Let <var>old cache</var> be the
<a class="externalDFN">application cache</a>.
</li>
<li>
Let <var>old version</var> be <var>old cache</var>'s <a>version</a>.
</li>
<li>
For the entity <var>entity</var> of each <a>managed</a> resource of
<var>old cache</var> that was added in the <var>old version</var>, perform
the following steps:
<ol>
<li>
Let <var>id</var> be the URI of the <a>managed</a> resource.
</li>
<li>
If neither <var>additions</var> nor <var>removals</var>
already includes <var>id</var>, then add <var>id</var>
with <var>entity</var> to <var>additions</var>.
</li>
</ol>
</li>
<li>
For each <a>managed</a> resource of <var>old cache</var> that was
removed in the <var>old version</var>, perform the following steps:
<ol>
<li>
Let <var>id</var> be the URI of the <a>managed</a> resource.
</li>
<li>
If neither <var>additions</var> nor <var>removals</var>
already includes <var>id</var>, then add <var>id</var>
to <var>removals</var>.
</li>
</ol>
</li>
</ol>
</li>
<li>
If <var>item callback</var> is not null, then for each item
<var>item</var> in <var>additions</var>, perform the following steps:
<ol>
<li>
For each item <var>item</var> in <var>additions</var>,
<a class="externalDFN">queue a task</a> to invoke the
<var>item callback</var> with <var>item</var>.
</li>
<li>
For each item <var>item</var> in <var>removals</var>,
<a class="externalDFN">queue a task</a> to invoke the
<var>item callback</var> with <var>item</var>.
</li>
</ol>
</li>
<li>
If <var>success callback</var> is not null, then
<a class="externalDFN">queue a task</a> to invoke the <var>success callback</var>
</li>
</ol>
</dd>
</dl>
</section>
<section id="transaction-interface" class="section">
<h4>Transaction API</h4>
<dl class="idl" title="interface CacheTransaction">
<dt>void resetPendingUpdates()</dt>
<dd></dd>
<dt>void incrementPendingUpdates()</dt>
<dd></dd>
<dt>void decrementPendingUpdates()</dt>
<dd></dd>
<dt>CacheItem getItem(in DOMString uri)</dt>
<dd>
When called, this method must immediately return and
asynchronously perform the following steps:
<ol>
<li>
If the resource identified by <var>uri</var> does not exist in this
<a><code>CacheTransaction</code></a> object's associated
<a class="externalDFN">application cache</a>, then the method must raise the
<code>NOT_FOUND_ERR</code> exception and terminate these steps.
</li>
<li>
Let <var>item</var> be the entity in this
<a><code>CacheTransaction</code></a> object's associated
<a class="externalDFN">application cache</a>.
</li>
<li>
Create <var>object</var>, a new <a><code>CacheItem</code></a>
object with the associated <var>item</var>.
</li>
<li>
<a class="externalDFN">Queue a task</a> to invoke <var>item callback</var> with the
aforementioned <a><code>CacheItem</code></a> <var>object</var>
as its only argument.
</li>
</ol>
<dl class="parameters">
<dt>DOMString uri</dt>
<dd>identifying the resource</dd>
<dt>ItemCallback callback</dt>
<dd>Callback to invoke with the cached resource information</dd>
</dl>
</dd>
<dt>void release(in DOMString uri)</dt>
<dd>
When called, this method must immediately return and asynchronously
perform the steps to <a>add a resource to be released</a>
with the first argument being <var>uri</var>, second being the
<a class="externalDFN">active document</a> of the
<a class="externalDFN">browsing context</a> of the
<code>Window</code> or <code>WorkerGlobalScope</code> object of the
<code>Worker</code>,
and the third being this <a><code>CacheTransaction</code></a>
object's associated <a>cache transaction</a>.
<dl class="parameters">
<dt>DOMString uri</dt>
<dd>identifying the resource to release</dd>
</dl>
</dd>
<dt>void commit()</dt>
<dd>
When called, this method must immediately return and asynchronously
perform the following steps:
<ol>
<li>
Execute the steps to <a>commit a cache transaction</a> with the
first argument being this <a><code>CacheTransaction</code></a>
object's associated <a>cache transaction</a>,
and the second being the current <code>Window</code> or
<code>Worker</code> object.
</li>
<li>
If <a href="#widl-CacheTransaction-oncommitted"><code>oncommitted</code></a>
attribute on this <a><code>CacheTransaction</code></a> object is not null,
<a class="externalDFN">queue a task</a> to invoke the function identified by
<a href="#widl-CacheTransaction-oncommitted"><code>oncommitted</code></a> .
</li>
</ol>
</dd>
</dl>
<dl class="idl" title="interface OnlineTransaction : CacheTransaction">
<dt>void capture()</dt>
<dd>
When called, this
method must immediately return and asynchronously perform the steps
to <a>add a resource to be captured</a> with the first argument being
<var>uri</var>, second being the <a class="externalDFN">active document</a>
of the <a class="externalDFN">browsing context</a> of the
<code>Window</code> or <code>WorkerGlobalScope</code> object of the
<code>Worker</code>, the third being this
<a><code>CacheTransaction</code></a> object's associated
<a>cache transaction</a>,
the fourth being <var>dynamic methods</var>.
<dl class="parameters">
<dt>DOMString uri</dt>
<dd>identifying the resource to <a>capture</a></dd>
<dt>optional DOMString dynamicMethods</dt>
<dd>
The <a>dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</dd>
</dl>
</dd>
<dt>void abort()</dt>
<dd>
When called, this method must immediately return and asynchronously
perform the steps to <a>abort a cache transaction</a> with the first argument
being this <a><code>CacheTransaction</code></a> object's associated
<a>cache transaction</a>, and the second being the
<code>window</code> or <code>worker</code> object.
</dd>
</dl>
<dl class="idl" title="interface OfflineTransaction : CacheTransaction">
<dt>void capture()</dt>
<dd> When called, this
method must immediately return and asynchronously perform the steps
to <a>add a resource to be captured</a> with the first argument being
<var>uri</var>, second being the
<a class="externalDFN">active document</a> of the
<a class="externalDFN">browsing context</a> of the
<code>window</code> or <code>WorkerGlobalScope</code> object of the
<code>worker</code>,
the third being this <a><code>CacheTransaction</code></a> object's
associated <a>cache transaction</a>, the fourth being
<var>dynamic methods</var>, the fifth being <var>entity body</var>,
and the sixth being <var>content type</var>.
<dl class="parameters">
<dt>DOMString uri</dt>
<dd>identifying the resource to <a>capture</a></dd>
<dt>DOMString body</dt>
<dd>entity body for the resource</dd>
<dt>optional DOMString contentType</dt>
<dd>The MIME type of the entity body</dd>
<dt>optional DOMString dynamicMethods</dt>
<dd>
The <a>dynamic methods</a> that are applicable to the identified
resource. This parameter is a comma separated list of protocol
methods that can be intercepted for local processing. An empty
string is allowed for this parameter.
</dd>
</dl>
</dd>
</dl-->
<pre class="idl"><span class="idlInterface" id="idl-def-CacheItem">interface <span class="idlInterfaceID">CacheItem</span> {
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CacheItem-UNCACHED">UNCACHED</a></span> = <span class="idlConstValue">0</span>;</span>
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CacheItem-FETCHING">FETCHING</a></span> = <span class="idlConstValue">1</span>;</span>
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CacheItem-CACHED">CACHED</a></span> = <span class="idlConstValue">2</span>;</span>
<span class="idlConst"> const <span class="idlConstType"><a>unsigned short</a></span> <span class="idlConstName"><a href="#widl-CacheItem-GONE">GONE</a></span> = <span class="idlConstValue">3</span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned short</a></span> <span class="idlAttrName"><a href="#widl-CacheItem-readyState">readyState</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>Blob</a></span> <span class="idlAttrName"><a href="#widl-CacheItem-body">body</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMStringList</a></span> <span class="idlAttrName"><a href="#widl-CacheItem-dynamicMethods">dynamicMethods</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>any</a></span> <span class="idlAttrName"><a href="#widl-CacheItem-headers">headers</a></span>;</span>
};</span>
</pre><div class="section"><h5 id="attributes-4">Attributes</h5><dl class="attributes"><dt id="widl-CacheItem-body"><code>body</code> of type <span class="idlAttrType"><a>Blob</a></span>, readonly</dt><dd>
This attribute, on getting, must return the entity body, if any, as a
<a class="externalDFN"><code>Blob</code></a> object, of the <a href="#dfn-managed" class="internalDFN">managed</a>
resource associated with this <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object.
<div><em>No exceptions.</em></div></dd><dt id="widl-CacheItem-dynamicMethods"><code>dynamicMethods</code> of type <span class="idlAttrType"><a>DOMStringList</a></span>, readonly</dt><dd>
This attribute, on getting, must return the list of protocol methods,
if any, of the <a href="#dfn-managed" class="internalDFN">managed</a> resource associated with this
<a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object.
<div><em>No exceptions.</em></div></dd><dt id="widl-CacheItem-headers"><code>headers</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>
This attribute, on getting, must return the headers as a native ordered
dictionary data type from the <a href="#dfn-managed" class="internalDFN">managed</a> resource associated
with this <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object. In the ECMAScript
binding, this must be <code>Object</code>. Each header must have
one property (or dictionary
entry), with those properties enumerating in the order that the headers
were recorded in the <a href="#dfn-managed" class="internalDFN">managed</a> resource. Each property must
have the name of the header and its value as recorded in the
<a href="#dfn-managed" class="internalDFN">managed</a> resource.
<div><em>No exceptions.</em></div></dd><dt id="widl-CacheItem-readyState"><code>readyState</code> of type <span class="idlAttrType"><a>unsigned short</a></span>, readonly</dt><dd>
This attribute, on getting, must return the current state of the
<a href="#dfn-managed" class="internalDFN">managed</a> resource.
<div><em>No exceptions.</em></div></dd></dl></div><div class="section"><h5 id="constants-1">Constants</h5><dl class="constants"><dt id="widl-CacheItem-CACHED"><code>CACHED</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>
This <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object is associated with a
<a href="#dfn-managed" class="internalDFN">managed</a> resource which has been cached.
</dd><dt id="widl-CacheItem-FETCHING"><code>FETCHING</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>
This <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object is associated with a
<a href="#dfn-managed" class="internalDFN">managed</a> resource which is currently being fetched.
There is no value available in
<a href="#widl-CacheItem-body"><code>body</code></a>
or <a href="#widl-CacheItem-headers"><code>headers</code></a>.
</dd><dt id="widl-CacheItem-GONE"><code>GONE</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>
This <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object is associated with a
<a href="#dfn-managed" class="internalDFN">managed</a> resource which has been released. There is no
value available in
<a href="#widl-CacheItem-body"><code>body</code></a>,
<a href="#widl-CacheItem-headers"><code>headers</code></a>, or
<a href="#widl-CacheItem-dynamicMethods"><code>dynamicMethods</code></a>.
</dd><dt id="widl-CacheItem-UNCACHED"><code>UNCACHED</code> of type <span class="idlConstType"><a>unsigned short</a></span></dt><dd>
This <a href="#idl-def-CacheItem" class="idlType"><code>CacheItem</code></a> object is associated with a
<a href="#dfn-managed" class="internalDFN">managed</a> resource
which has been added for capturing but has not yet been cached.
There is no value available in <a href="#widl-CacheItem-body"><code>body</code></a>
or <a href="#widl-CacheItem-headers"><code>headers</code></a>.
</dd></dl></div>
</div>
<div id="events-and-error" class="section">
<h4><span class="secno">4.2.9 </span>The <code>CacheEvent</code> Interface</h4>
<p>
The <a class="externalDFN">task source</a> for this task is the
<dfn id="dfn-networking-task-source">networking task source</dfn>.
</p>
<pre class="idl"><span class="idlInterface" id="idl-def-CacheEvent">interface <span class="idlInterfaceID">CacheEvent</span> : <span class="idlSuperclass"><a>Event</a></span> {
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-CacheEvent-uri">uri</a></span>;</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CacheEvent-initCacheEvent">initCacheEvent</a></span> (<span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-CacheEvent-initCacheEventNS">initCacheEventNS</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">namespaceURI</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">uri</span></span>);</span>
};</span>
</pre><div class="section"><h5 id="attributes-5">Attributes</h5><dl class="attributes"><dt id="widl-CacheEvent-uri"><code>uri</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>This attribute, on getting, must return the URI of the
<a href="#dfn-managed" class="internalDFN">managed</a> resource for which this event is fired.
<div><em>No exceptions.</em></div></dd></dl></div><div class="section"><h5 id="methods-6">Methods</h5><dl class="methods"><dt id="widl-CacheEvent-initCacheEvent"><code>initCacheEvent</code></dt><dd>These methods must initialize the event in a manner analogous to the
similarly named methods in the DOM Events interfaces.
[<cite><a class="bibref" rel="biblioentry" href="#bib-DOM-LEVEL-3-EVENTS">DOM-LEVEL-3-EVENTS</a></cite>]
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-CacheEvent-initCacheEventNS"><code>initCacheEventNS</code></dt><dd>These methods must initialize the event in a manner analogous to the
similarly named methods in the DOM Events interfaces.
[<cite><a class="bibref" rel="biblioentry" href="#bib-DOM-LEVEL-3-EVENTS">DOM-LEVEL-3-EVENTS</a></cite>]
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">namespaceURI</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr><tr><td class="prmName">uri</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<p>
The following are the <a href="#dfn-event-handler" class="internalDFN">event handler</a>s (and their corresponding
<a href="#dfn-event-handler-event-type" class="internalDFN">event handler event type</a>s) that must be supported, as IDL
attributes, by objects implementing the
<a><code>CacheTransaction</code></a> interface and
<a href="#idl-def-CacheTransactionRequest" class="idlType"><code>CacheTransactionRequest</code></a> interface:
</p>
<table>
<thead><tr>
<th><a class="externalDFN">Event handler</a> </th>
<th><a class="externalDFN">Event handler event type</a></th>
</tr></thead>
<tbody>
<tr>
<td><dfn id="dfn-onready"><code>onready</code></dfn> </td>
<td><a href="#event-ready"><code>ready</code></a></td>
</tr>
<tr>
<td><dfn id="dfn-oncaptured"><code>oncaptured</code></dfn> </td>
<td><a href="#event-captured"><code>captured</code></a></td>
</tr>
<tr>
<td><dfn id="dfn-onreleased"><code>onreleased</code></dfn> </td>
<td><a href="#event-released"><code>released</code></a></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="local-server" class="section">
<h3><span class="secno">4.3 </span>Programmable HTTP Serving</h3>
<p>
An <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a> is an application script that generates
<a href="#dfn-dynamic" class="internalDFN">dynamic</a> responses to resource requests without making those
requests to the origin server.
</p>
<p>
An <dfn id="dfn-embedded-local-server">embedded local server</dfn> consists of an
<dfn id="dfn-interceptor">interceptor</dfn> function and zero or one <dfn id="dfn-reviewer">reviewer</dfn> function.
</p>
<p>
An <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>
serves requests to resources in its <dfn id="dfn-interception-namespace">interception namespace</dfn>.
</p>
<p>
A <a class="externalDFN">cache host</a> can be associated with
zero or more <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>s.
</p>
<p>
An resource request issued in a <a class="externalDFN">cache host</a> can
be an <dfn id="dfn-interceptible-request">interceptible request</dfn> if the resource is in the
<a href="#dfn-interception-namespace" class="internalDFN">interception namespace</a> of an <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>
registered in the <a class="externalDFN">browsing context</a> of the
<a class="externalDFN">cache host</a> and the resource is a
<a href="#dfn-dynamic-entry" class="internalDFN">dynamic entry</a> in the <a class="externalDFN">application cache group</a>
associated with the <a class="externalDFN">cache host</a> and the request method
is identified as one of the <a href="#dfn-dynamic-entry" class="internalDFN">dynamic entry</a>'s <a href="#dfn-dynamic-methods" class="internalDFN">dynamic methods</a> .
</p>
<p>
If an <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>
can <a>intercept a resource request</a>, then it is called a
<dfn id="dfn-candidate-local-server">candidate local server</dfn> for that request.
</p>
<p>
Multiple <a>embedded local servers</a> can be the <a href="#dfn-candidate-local-server" class="internalDFN">candidate local server</a>
for a given resource request. If a user agent is to
<dfn id="dfn-select-an-embedded-local-server">select an embedded local server</dfn> from a list of
<a href="#dfn-candidate-local-server" class="internalDFN">candidate local server</a>s that can produce a <a href="#dfn-dynamic" class="internalDFN">dynamic</a> representation
of the requested resource, then the user agent must use the
<a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a> that has the most specific
<a href="#dfn-interception-namespace" class="internalDFN">interception namespace</a>.
</p>
<div id="request-interface" class="section">
<h4><span class="secno">4.3.1 </span>Local Server Interfaces</h4>
<pre class="idl"><span class="idlInterface" id="idl-def-NavigatorLocalServer">[<span class="extAttr">Supplemental, NoInterfaceObject</span>]
interface <span class="idlInterfaceID">NavigatorLocalServer</span> {
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-NavigatorLocalServer-registerOfflineHandler">registerOfflineHandler</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">namespace</span></span>, <span class="idlParam">in <span class="idlParamType"><a href="#idl-def-InterceptHandler" class="idlType"><code>InterceptHandler</code></a></span> <span class="idlParamName">intercept</span></span>, <span class="idlParam">in optional <span class="idlParamType"><a href="#idl-def-ReviewHandler" class="idlType"><code>ReviewHandler</code></a></span> <span class="idlParamName">review</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-NavigatorLocalServer-removeOfflineHandler">removeOfflineHandler</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">namespace</span></span>) raises (<span class="idlRaises"><a>DOMException</a></span>);</span>
};</span>
</pre><div class="section"><h5 id="methods-7">Methods</h5><dl class="methods"><dt id="widl-NavigatorLocalServer-registerOfflineHandler"><code>registerOfflineHandler</code></dt><dd>
<p>
This method allows applications to register possible handlers
for particular URI namespaces. Upon being invoked, this method
should create a new <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a> called
<var>server</var> with its <a href="#dfn-interceptor" class="internalDFN">interceptor</a>
function set to <var>intercept handler</var> and its
<a href="#dfn-reviewer" class="internalDFN">reviewer</a> function set to <var>review handler</var>
and add <var>server</var> to the <a href="#dfn-cache-host" class="internalDFN">cache host</a>, which is
the <a href="#dfn-active-document" class="internalDFN">active document</a> of the <a href="#dfn-browsing-context" class="internalDFN">browsing context</a> of the
<code>window</code> containing this <code>Navigator</code> object.
If a handler already exists for the given <var>namespace</var>,
the existing <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a> is replaced with the
one created in this call.
</p>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">namespace</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the <a href="#dfn-interception-namespace" class="internalDFN">interception namespace</a> for this
<a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a></td></tr><tr><td class="prmName">intercept</td><td class="prmType"><code><a href="#idl-def-InterceptHandler" class="idlType"><code>InterceptHandler</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">the <a href="#dfn-interceptor" class="internalDFN">interceptor</a> function of this <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a></td></tr><tr><td class="prmName">review</td><td class="prmType"><code><a href="#idl-def-ReviewHandler" class="idlType"><code>ReviewHandler</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptTrue">✔</td><td class="prmDesc">the <a href="#dfn-reviewer" class="internalDFN">reviewer</a> function of this <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-NavigatorLocalServer-removeOfflineHandler"><code>removeOfflineHandler</code></dt><dd>
This method removes the registered <a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a>
for the given namespace from the <a href="#dfn-cache-host" class="internalDFN">cache host</a>, which is
the <a href="#dfn-active-document" class="internalDFN">active document</a> of the <a href="#dfn-browsing-context" class="internalDFN">browsing context</a> of the
<code>window</code> containing this <code>Navigator</code> object.
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">namespace</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc">identifying the <a href="#dfn-interception-namespace" class="internalDFN">interception namespace</a> for this
<a href="#dfn-embedded-local-server" class="internalDFN">embedded local server</a></td></tr></table><table class="exceptions"><tr><th>Exception</th><th>Description</th></tr><tr><td class="excName"><a>DOMException</a></td><td class="excDesc">
The method must raise an
<a class="externalDFN"><code>NOT_FOUND_ERR</code></a> if
the version passed to these steps is not less than the
<a href="#dfn-version" class="internalDFN">version</a> of this <a href="#dfn-application-cache" class="internalDFN">application cache</a>.
</td></tr></table><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<pre class="idl"><span class="idlImplements"><a>Navigator</a> implements <a href="#idl-def-NavigatorLocalServer" class="idlType"><code>NavigatorLocalServer</code></a>;</span></pre><div class="idlImplementsDesc"><p>All instances of the <code><a>Navigator</a></code> type are defined to also implement the <a href="#idl-def-NavigatorLocalServer" class="idlType"><code>NavigatorLocalServer</code></a> interface.</p></div>
<pre class="idl"><span class="idlInterface" id="idl-def-InterceptHandler">[<span class="extAttr">Callback=FunctionOnly, NoInterfaceObject</span>]
interface <span class="idlInterfaceID">InterceptHandler</span> {
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-InterceptHandler-callback">callback</a></span> (<span class="idlParam">in <span class="idlParamType"><a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a></span> <span class="idlParamName">request</span></span>, <span class="idlParam">in <span class="idlParamType"><a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a></span> <span class="idlParamName">response</span></span>);</span>
};</span>
</pre><div class="section"><h5 id="methods-8">Methods</h5><dl class="methods"><dt id="widl-InterceptHandler-callback"><code>callback</code></dt><dd>
<p>
The user agent must invoke the <a href="#idl-def-InterceptHandler" class="idlType"><code>InterceptHandler</code></a>,
with an <a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a>
object <var>request</var> based on the application's resource request and an
<a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a>
object <var>response</var>. If the <a href="#widl-MutableHttpResponse-delay">
<code>delay()</code></a> method is invoked on <var>response</var>,
then when the <a href="#widl-MutableHttpResponse-send">
<code>send()</code></a> method is invoked on <var>response</var>, the
user agent <em class="rfc2119" title="must">must</em> respond to <var>request</var> with the headers, body, and
status specified in <var>response</var>.
If the <a href="#widl-MutableHttpResponse-delay">
<code>delay()</code></a> method is not invoked on <var>response</var>
in this callback, then the user agent <em class="rfc2119" title="must">must</em> respond to <var>request</var>
with the headers, body, and status, specified in <var>response</var>
when this function exits.
</p>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">request</td><td class="prmType"><code><a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr><tr><td class="prmName">response</td><td class="prmType"><code><a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-ReviewHandler">[<span class="extAttr">Callback=FunctionOnly, NoInterfaceObject</span>]
interface <span class="idlInterfaceID">ReviewHandler</span> {
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-ReviewHandler-callback">callback</a></span> (<span class="idlParam">in <span class="idlParamType"><a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a></span> <span class="idlParamName">request</span></span>, <span class="idlParam">in <span class="idlParamType"><a href="#idl-def-HttpResponse" class="idlType"><code>HttpResponse</code></a></span> <span class="idlParamName">response</span></span>);</span>
};</span>
</pre><div class="section"><h5 id="methods-9">Methods</h5><dl class="methods"><dt id="widl-ReviewHandler-callback"><code>callback</code></dt><dd>
<p>
The user agent must invoke the <a href="#idl-def-ReviewHandler" class="idlType"><code>ReviewHandler</code></a>,
with an <a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a>
object <var>request</var> based on the application's resource request and an
<a href="#idl-def-HttpResponse" class="idlType"><code>HttpResponse</code></a>
object <var>response</var> based on the host's response to that request.
</p>
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">request</td><td class="prmType"><code><a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr><tr><td class="prmName">response</td><td class="prmType"><code><a href="#idl-def-HttpResponse" class="idlType"><code>HttpResponse</code></a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-HttpRequest">interface <span class="idlInterfaceID">HttpRequest</span> {
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-HttpRequest-method">method</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-HttpRequest-target">target</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-HttpRequest-bodyText">bodyText</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>any</a></span> <span class="idlAttrName"><a href="#widl-HttpRequest-headers">headers</a></span>;</span>
};</span>
</pre><div class="section"><h5 id="attributes-6">Attributes</h5><dl class="attributes"><dt id="widl-HttpRequest-bodyText"><code>bodyText</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>
This attribute is a DOMString representing the request entity body,
which on getting, must return the result of the following steps:
<ol>
<li>
If the request entity body is null, return the empty string and
terminate these steps.
</li>
<li>
Let <var>charset</var> be the value of the
<code>charset</code> parameter of the <code>Content-Type</code>
header or <code>null</code> if there was no <code>charset</code>
parameter or if the header could not be parsed properly or was
omitted.
</li>
<li>
Let <var>mime</var> be the MIME type the <code>Content-Type</code>
header contains without any parameters or <code>null</code> if
the header could not be parsed properly or was omitted.
</li>
<li>
If <var>charset</var> is <code>null</code> and <var>mime</var>
is <code>text/xml</code>,
<code>application/xml</code>, or ends in <code>+xml</code>
use the rules set forth in the XML specifications to determine
the character encoding. Let <var>charset</var> be the
determined character encoding.
</li>
<li>
If <var>charset</var> is <code>null</code> and <var>mime</var> is
<code>application/json</code> follow the rules set forth in the
[<cite><a class="bibref" rel="biblioentry" href="#bib-RFC4627">RFC4627</a></cite>] specification to determine the character encoding.
Let <var>charset</var> be the determined character encoding.
</li>
<li>
If <var>charset</var> is <code>null</code> and <var>mime</var> is
<code>text/html</code> follow the rules set forth in the [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>]
specification to determine the character encoding. Let
<var>charset</var> be the determined character encoding.
</li>
<li>
If <var>charset</var> is <code>null</code>, then let
<var>charset</var> be <code>UTF-8</code>.
</li>
<li>
Return the result of decoding the response entity body using
<var>charset</var>. Replace bytes or sequences of bytes that are
not valid accordng to the <var>charset</var> with a single
U+FFFD REPLACEMENT CHARACTER character.
</li>
</ol>
<div><em>No exceptions.</em></div></dd><dt id="widl-HttpRequest-headers"><code>headers</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>
This attribute, on getting, must return the headers as a native ordered
dictionary data type from this <a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a> object.
In the JavaScript binding, this must be
<code>Object</code>. Each header must have one property (or dictionary
entry), with those properties enumerating in the order that the headers
were present in the request. Each property must have the name of the
header and its value as present in the request.
<div><em>No exceptions.</em></div></dd><dt id="widl-HttpRequest-method"><code>method</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>
This attribute, on getting, must return the HTTP method,
in upper-case characters, present on this
<a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a> object.
<div><em>No exceptions.</em></div></dd><dt id="widl-HttpRequest-target"><code>target</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>
This attribute, on getting, must return the URI of this
<a href="#idl-def-HttpRequest" class="idlType"><code>HttpRequest</code></a> object.
<div><em>No exceptions.</em></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-MutableHttpResponse">interface <span class="idlInterfaceID">MutableHttpResponse</span> {
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MutableHttpResponse-setStatus">setStatus</a></span> (<span class="idlParam">in <span class="idlParamType"><a>unsigned short</a></span> <span class="idlParamName">code</span></span>, <span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">message</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MutableHttpResponse-setResponseText">setResponseText</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">text</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MutableHttpResponse-setResponseHeader">setResponseHeader</a></span> (<span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">name</span></span>, <span class="idlParam">in <span class="idlParamType"><a>DOMString</a></span> <span class="idlParamName">value</span></span>);</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MutableHttpResponse-delay">delay</a></span> ();</span>
<span class="idlMethod"> <span class="idlMethType"><a>void</a></span> <span class="idlMethName"><a href="#widl-MutableHttpResponse-send">send</a></span> ();</span>
};</span>
</pre><div class="section"><h5 id="methods-10">Methods</h5><dl class="methods"><dt id="widl-MutableHttpResponse-delay"><code>delay</code></dt><dd>
Mark this response to be explicitly dispatched. This means that the
<a href="#idl-def-InterceptHandler" class="idlType"><code>InterceptHandler</code></a> would need to explicitly call
<a href="#widl-MutableHttpResponse-send"><code>send()</code></a>
in order to mark the response as ready for being returned to the
application.
<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-MutableHttpResponse-send"><code>send</code></dt><dd>
Upon calling, this method must dispatch this
<a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a>
object. No further changes must be allowed to it.
<div><em>No parameters.</em></div><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-MutableHttpResponse-setResponseHeader"><code>setResponseHeader</code></dt><dd>
This method takes two arguments - <var>name</var> and <var>value</var>
of a response header. Upon calling, this method must store the header
with <var>name</var> and <var>value</var> in this
<a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a>
object. If a value is already associated with this header, then
this method must append <var>value</var> to it.
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">name</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr><tr><td class="prmName">value</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-MutableHttpResponse-setResponseText"><code>setResponseText</code></dt><dd>
This method takes a single arguments - <var>body</var> of the response entity.
Upon calling, this method must store the entity <var>body</var> in this
<a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a>
object, replacing any previous value.
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">text</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd><dt id="widl-MutableHttpResponse-setStatus"><code>setStatus</code></dt><dd>
This method takes two arguments - <var>code</var> and <var>message</var>
of the response status. Upon calling, this method must store the status
with <var>code</var> and <var>message</var> in this
<a href="#idl-def-MutableHttpResponse" class="idlType"><code>MutableHttpResponse</code></a>
object, replacing any previous values for both.
<table class="parameters"><tr><th>Parameter</th><th>Type</th><th>Nullable</th><th>Optional</th><th>Description</th></tr><tr><td class="prmName">code</td><td class="prmType"><code><a>unsigned short</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr><tr><td class="prmName">message</td><td class="prmType"><code><a>DOMString</a></code></td><td class="prmNullFalse">✘</td><td class="prmOptFalse">✘</td><td class="prmDesc"></td></tr></table><div><em>No exceptions.</em></div><div><em>Return type: </em><code><a>void</a></code></div></dd></dl></div>
<pre class="idl"><span class="idlInterface" id="idl-def-HttpResponse">interface <span class="idlInterfaceID">HttpResponse</span> {
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>unsigned short</a></span> <span class="idlAttrName"><a href="#widl-HttpResponse-statusCode">statusCode</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-HttpResponse-statusMessage">statusMessage</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>DOMString</a></span> <span class="idlAttrName"><a href="#widl-HttpResponse-bodyText">bodyText</a></span>;</span>
<span class="idlAttribute"> readonly attribute <span class="idlAttrType"><a>any</a></span> <span class="idlAttrName"><a href="#widl-HttpResponse-headers">headers</a></span>;</span>
};</span>
</pre><div class="section"><h5 id="attributes-7">Attributes</h5><dl class="attributes"><dt id="widl-HttpResponse-bodyText"><code>bodyText</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>
This attribute is a DOMString representing the response entity body,
which on getting, must return the result of the following steps:
<ol>
<li>
If the response entity body is null, return the empty string and
terminate these steps.
</li>
<li>
Let <var>charset</var> be the value of the
<code>charset</code> parameter of the <code>Content-Type</code>
header or <code>null</code> if there was no <code>charset</code>
parameter or if the header could not be parsed properly or was
omitted.
</li>
<li>
Let <var>mime</var> be the MIME type the <code>Content-Type</code>
header contains without any parameters or <code>null</code> if
the header could not be parsed properly or was omitted.
</li>
<li>
If <var>charset</var> is <code>null</code> and <var>mime</var>
is <code>text/xml</code>,
<code>application/xml</code>, or ends in <code>+xml</code>
use the rules set forth in the XML specifications to determine
the character encoding. Let <var>charset</var> be the
determined character encoding.
</li>
<li>
If <var>charset</var> is <code>null</code> and <var>mime</var> is
<code>application/json</code> follow the rules set forth in the
[<cite><a class="bibref" rel="biblioentry" href="#bib-RFC4627">RFC4627</a></cite>] specification to determine the character encoding.
Let <var>charset</var> be the determined character encoding.
</li>
<li>
If <var>charset</var> is <code>null</code> and <var>mime</var> is
<code>text/html</code> follow the rules set forth in the [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>]
specification to determine the character encoding. Let
<var>charset</var> be the determined character encoding.
</li>
<li>
If <var>charset</var> is <code>null</code>, then let
<var>charset</var> be <code>UTF-8</code>.
</li>
<li>
Return the result of decoding the response entity body using
<var>charset</var>. Replace bytes or sequences of bytes that are
not valid accordng to the <var>charset</var> with a single
U+FFFD REPLACEMENT CHARACTER character.
</li>
</ol>
<div><em>No exceptions.</em></div></dd><dt id="widl-HttpResponse-headers"><code>headers</code> of type <span class="idlAttrType"><a>any</a></span>, readonly</dt><dd>
This attribute, on getting, must return the headers as a native ordered
dictionary data type from this
<a href="#idl-def-HttpResponse" class="idlType"><code>HttpResponse</code></a> object.
In the JavaScript binding, this must be
<code>Object</code>. Each header must have one property (or dictionary
entry), with those properties enumerating in the order that the headers
were present in the response. Each property must have the name of the
header and its value as present in the response.
<div><em>No exceptions.</em></div></dd><dt id="widl-HttpResponse-statusCode"><code>statusCode</code> of type <span class="idlAttrType"><a>unsigned short</a></span>, readonly</dt><dd>
This attribute, on getting, must return the status code of this
<a href="#idl-def-HttpResponse" class="idlType"><code>HttpResponse</code></a> object.
<div><em>No exceptions.</em></div></dd><dt id="widl-HttpResponse-statusMessage"><code>statusMessage</code> of type <span class="idlAttrType"><a>DOMString</a></span>, readonly</dt><dd>
This attribute, on getting, must return the status message of this
<a href="#idl-def-HttpResponse" class="idlType"><code>HttpResponse</code></a> object.
<div><em>No exceptions.</em></div></dd></dl></div>
</div>
<div class="section" id="networking-model-changes">
<h4><span class="secno">4.3.2 </span>Changes to the networking model</h4>
<p>
When a <a class="externalDFN">cache host</a> is associated with an
<a class="externalDFN">application cache</a> whose
<a href="#dfn-dynamic-completeness-flag" class="internalDFN">dynamic completeness flag</a> is <var>complete</var>, any and all
loads for resources related to that <a class="externalDFN">cache host</a>
other than those for <a class="externalDFN">child browsing contexts</a>
must go through the following steps prior to the
the networking model for application caches defined in [<cite><a class="bibref" rel="biblioentry" href="#bib-HTML5">HTML5</a></cite>].
</p>
<ol>
<li>
Let <var>request</var> be the resource request for
<a title="fetch">fetching</a> the resource.
</li>
<li>
If <var>request</var> includes the HTTP header <code>Cache-Control</code>
with the value <code>no-cache</code>, then <a>fetch</a> the resource
normally, and abort these steps.
</li>
<li>
Let <var>cache</var> be the <a class="externalDFN">application cache</a>
for the <a class="externalDFN">cache host</a>.
</li>
<li>
Let <var>resource</var> be the resource to be <a title="fetch">fetched</a>.
</li>
<li>
If <var>resource</var> is not <a href="#dfn-managed" class="internalDFN">managed</a> in <var>cache</var>, then
<a class="externalDFN">fetch</a> a representation of <var>resource</var>
normally and abort these steps.
</li>
<li>
If <var>request</var> is using the HTTP <code>GET</code> mechanism
and <var>resource</var> is not defined in <var>cache</var> with a
<a title="dynamic methods" href="#dfn-dynamic-methods" class="internalDFN">dynamic <code>GET</code> method</a>,
then get the entity for <var>resource</var> from <var>cache</var>
(instead of <a class="externalDFN">fetching</a> it), and abort these steps.
</li>
<li>
If <var>request</var> is using the HTTP <code>HEAD</code> mechanism
and <var>resource</var> is not defined in <var>cache</var> with a
<a title="dynamic methods" href="#dfn-dynamic-methods" class="internalDFN">dynamic <code>HEAD</code> method</a>,
then get the entity headers for <var>resource</var> from <var>cache</var>
(instead of <a class="externalDFN">fetching</a> it), and abort these steps.
</li>
<li>
If <var>resource</var> is not defined in <var>cache</var> with the
<a title="dynamic methods" href="#dfn-dynamic-methods" class="internalDFN">dynamic method</a> that
<var>request</var> is using, then <a class="externalDFN">fetch</a> a
representation of <var>resource</var> normally and abort these steps.
</li>
<li>
Perform the steps to <a href="#dfn-select-an-embedded-local-server" class="internalDFN">select an embedded local server</a>
<var>server</var>.
</li>
<li>
If <var>server</var> is not set, then <a class="externalDFN">fetch</a>
a representation of <var>resource</var> normally and abort these steps.
</li>
<li>
Pick the appropriate steps:
<dl class="switch">
<dt>If the user agent is off-line</dt>
<dd><ol>
<li>
Create a new response object to hold the <a href="#dfn-dynamic" class="internalDFN">dynamic</a>
response to <var>request</var>.
</li>
<li>
Call the <a href="#dfn-interceptor" class="internalDFN">interceptor</a> function of <var>server</var>
passing as arguments <var>request</var> and <var>response</var>.
</li>
<li>
Wait for the <a href="#dfn-interceptor" class="internalDFN">interceptor</a> function to dispatch the
<a href="#dfn-dynamic" class="internalDFN">dynamic</a> response until the typical network timeout.
</li>
<li>
If the <a href="#dfn-dynamic" class="internalDFN">dynamic</a> response times out, then raise a
time out error and abort these steps.
</li>
<li>
Handle <var>response</var> as the <a href="#dfn-dynamic" class="internalDFN">dynamic</a> response,
and abort these steps.
</li>
</ol></dd>
<dt>If the user agent is online</dt>
<dd><ol>
<li>
If the <a href="#dfn-reviewer" class="internalDFN">reviewer</a> function of <var>server</var>
is not set, then abort these steps and perform the steps
for the case when the user agent is off-line.
</li>
<li>
<a class="externalDFN">Fetch</a> a representation of
<var>resource</var> normally and call it <var>response</var>.
</li>
<li>
Call the <a href="#dfn-reviewer" class="internalDFN">reviewer</a> function of <var>server</var> passing as
arguments <var>request</var> and <var>response</var>.
</li>
<li>
Handle <var>response</var> as the <a href="#dfn-dynamic" class="internalDFN">dynamic</a> response, and abort
these steps.
</li>
</ol></dd>
</dl>
</li>
</ol>
</div>
</div>
</div>
<div id="security" class="section">
<!--OddPage--><h2><span class="secno">5. </span>Security Considerations</h2>
<div class="ednote">
This section is not complete.
</div>
<p>
Apart from requirements affecting security made throughout
this specification implementations may, at their discretion,
not expose certain headers, such as HttpOnly cookies.
</p>
</div>
<div class="section appendix" id="acknowledgements">
<!--OddPage--><h2><span class="secno">A. </span>Acknowledgements</h2>
<div>
The editor of this specification was employed by Oracle Corp during its early
drafts.
</div>
<div>
Thanks to Garret Swart, Colm Divilly, Ashish Motivala, Joseph Pecoraro, and Mike Wilson
for their useful comments that have led to improvements to this specification over time.
</div>
</div>
<div id="references" class="appendix section"><!--OddPage--><h2><span class="secno">B. </span>References</h2><div id="normative-references" class="section"><h3><span class="secno">B.1 </span>Normative references</h3><dl class="bibliography"><dt id="bib-COOKIES">[COOKIES]</dt><dd>Adam Barth. <cite><a href="http://tools.ietf.org/html/draft-abarth-cookie">HTTP State Management Mechanism</a>.</cite> IETF, November 2009
</dd><dt id="bib-DOM-LEVEL-3-CORE">[DOM-LEVEL-3-CORE]</dt><dd>Gavin Nicol; et al. <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407"><cite>Document Object Model (DOM) Level 3 Core Specification.</cite></a> 7 April 2004. W3C Recommendation. URL: <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407">http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407</a>
</dd><dt id="bib-DOM-LEVEL-3-EVENTS">[DOM-LEVEL-3-EVENTS]</dt><dd>Björn Höhrmann; Tom Pixley; Philippe Le Hégaret. <a href="http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221"><cite>Document Object Model (DOM) Level 3 Events Specification.</cite></a> 21 December 2007. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221">http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221</a>
</dd><dt id="bib-FILE-API">[FILE-API]</dt><dd>Arun Ranganathan. <a href="http://www.w3.org/TR/2009/WD-FileAPI-20091117/"><cite>File API.</cite></a> 17 November 2009. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2009/WD-FileAPI-20091117/">http://www.w3.org/TR/2009/WD-FileAPI-20091117/</a>
</dd><dt id="bib-HTML5">[HTML5]</dt><dd>Ian Hickson; David Hyatt. <a href="http://www.w3.org/TR/2010/WD-html5-20100304/"><cite>HTML 5.</cite></a> 4 March 2010. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2010/WD-html5-20100304/">http://www.w3.org/TR/2010/WD-html5-20100304/</a>
</dd><dt id="bib-HTTP11">[HTTP11]</dt><dd>R. Fielding; et al. <a href="http://www.ietf.org/rfc/rfc2616.txt"><cite>Hypertext Transfer Protocol - HTTP/1.1.</cite></a> June 1999. Internet RFC 2616. URL: <a href="http://www.ietf.org/rfc/rfc2616.txt">http://www.ietf.org/rfc/rfc2616.txt</a>
</dd><dt id="bib-RFC2119">[RFC2119]</dt><dd>S. Bradner. <a href="http://www.ietf.org/rfc/rfc2119.txt"><cite>Key words for use in RFCs to Indicate Requirement Levels.</cite></a> March 1997. Internet RFC 2119. URL: <a href="http://www.ietf.org/rfc/rfc2119.txt">http://www.ietf.org/rfc/rfc2119.txt</a>
</dd><dt id="bib-RFC4627">[RFC4627]</dt><dd>D. Crockford <a href="http://www.ietf.org/rfc/rfc4627.txt">The application/json Media Type for JavaScript Object Notation (JSON)</a> July 2006. Internet RFC 4627. URL: <a href="http://www.ietf.org/rfc/rfc4627.txt">http://www.ietf.org/rfc/rfc4627.txt</a>
</dd><dt id="bib-WEBIDL">[WEBIDL]</dt><dd>Cameron McCormack. <a href="http://www.w3.org/TR/2008/WD-WebIDL-20081219"><cite>Web IDL.</cite></a> 19 December 2008. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2008/WD-WebIDL-20081219">http://www.w3.org/TR/2008/WD-WebIDL-20081219</a>
</dd></dl></div><div id="informative-references" class="section"><h3><span class="secno">B.2 </span>Informative references</h3><dl class="bibliography"><dt id="bib-XMLHTTPREQUEST">[XMLHTTPREQUEST]</dt><dd>Anne van Kesteren. <a href="http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415"><cite>The XMLHttpRequest Object.</cite></a> 15 April 2008. W3C Working Draft. (Work in progress.) URL: <a href="http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415">http://www.w3.org/TR/2008/WD-XMLHttpRequest-20080415</a>
</dd></dl></div></div></body></html>