crossorigin element resource loading should check HTTP redirection
[WebKit-https.git] / LayoutTests / storage / domstorage / storage-close-database-on-idle.html
1 <html>
2 <head>
3 <script>
4
5 if (window.testRunner) {
6     testRunner.dumpAsText();
7     testRunner.waitUntilDone();
8 }
9
10 function log(a)
11 {
12     document.getElementById("logger").innerHTML += a + "<br>";
13 }
14
15 function loadNextPage()
16 {
17     location.href = "../resources/storage-close-data-on-idle-switch.html";
18 }
19
20 function runTest()
21 {
22     if (window.testRunner) {
23         testRunner.setStorageDatabaseIdleInterval(0);
24         testRunner.setCacheModel(0); // WebCacheModelDocumentViewer.
25     }
26
27     // Test to make sure the storage values don't change after the database is closed.
28     if ("localStorage" in window) {
29         var loadCount = window.sessionStorage['loadCount'];
30         if (loadCount !== undefined)
31             loadCount++;
32         else
33             loadCount = 1;
34
35         window.sessionStorage['loadCount'] = loadCount;
36
37         if (loadCount == 1 ) {
38             window.localStorage.clear();
39             window.localStorage['foo'] = 'FOO';
40             window.localStorage['bar'] = 'BAR';
41
42             setTimeout("loadNextPage()", 0);
43         } else {
44             // Test if we still have the right values.
45             log(window.localStorage['foo'] === 'FOO' ? 'PASS' : 'FAIL');
46             log(window.localStorage['bar'] === 'BAR' ? 'PASS' : 'FAIL');
47
48             if (window.testRunner) {
49                 testRunner.setStorageDatabaseIdleInterval(300);
50                 window.testRunner.notifyDone();
51             }
52         }
53     }
54 }
55
56 </script>
57 </head>
58 <body onload="runTest();">
59 <div id="logger"></div>
60 </body>
61 </html>
62