| <!-- webkit-test-runner [ useEphemeralSession=true ] --> |
| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Cache Storage: testing persistency</title> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <div id="check"></div> |
| <script> |
| promise_test(test => { |
| return self.caches.keys().then(keys => { |
| var pending = []; |
| for (key of keys) |
| pending.push(self.caches.delete(keys[0])); |
| return Promise.all(pending); |
| }); |
| }, "Cleaning existing caches"); |
| |
| promise_test(test => { |
| if (!window.internals || !window.testRunner) |
| return Promise.reject("Test requires internals"); |
| |
| return new Promise((resolve, reject) => { |
| window.addEventListener("message", test.step_func((event) => { |
| if (event.data === "ready") { |
| internals.clearCacheStorageMemoryRepresentation().then(() => { |
| check.innerHTML = "<iframe src='resources/cache-persistency-iframe.html#check'></iframe>"; |
| }); |
| return; |
| } |
| assert_true(event.data === false, "No cache object should be found"); |
| resolve(); |
| })); |
| check.innerHTML = "<iframe src='resources/cache-persistency-iframe.html'></iframe>"; |
| }) |
| }, "Clear memory representation and disable disk persistency"); |
| </script> |
| </body> |
| </html> |
| |