| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Cache Storage: Verify credentials are respected by Cache operations</titl
e> |
| 4 <link rel="help" href="https://w3c.github.io/ServiceWorker/#cache-storage"> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="../../service-worker/resources/test-helpers.sub.js"></script> |
| 8 <style>iframe { display: none; }</style> |
| 9 <script> |
| 10 |
| 11 var worker = "../resources/credentials-worker.js"; |
| 12 var scope = "../resources/credentials-iframe.html"; |
| 13 promise_test(function(t) { |
| 14 return self.caches.delete('credentials') |
| 15 .then(function() { |
| 16 return service_worker_unregister_and_register(t, worker, scope) |
| 17 }) |
| 18 .then(function(reg) { |
| 19 return wait_for_state(t, reg.installing, 'activated'); |
| 20 }) |
| 21 .then(function() { |
| 22 return with_iframe(scope); |
| 23 }) |
| 24 .then(function(frame) { |
| 25 frame.contentWindow.postMessage([ |
| 26 {name: 'file.txt', username: 'aa', password: 'bb'}, |
| 27 {name: 'file.txt', username: 'cc', password: 'dd'}, |
| 28 {name: 'file.txt'} |
| 29 ], '*'); |
| 30 return new Promise(function(resolve, reject) { |
| 31 window.onmessage = t.step_func(function(e) { |
| 32 resolve(e.data); |
| 33 }); |
| 34 }); |
| 35 }) |
| 36 .then(function(data) { |
| 37 assert_equals(data.length, 3, 'three entries should be present'); |
| 38 assert_equals(data.filter(function(url) { return /@/.test(url); }).length,
2, |
| 39 'two entries should contain credentials'); |
| 40 assert_true(data.some(function(url) { return /aa:bb@/.test(url); }), |
| 41 'entry with credentials aa:bb should be present'); |
| 42 assert_true(data.some(function(url) { return /cc:dd@/.test(url); }), |
| 43 'entry with credentials cc:dd should be present'); |
| 44 }); |
| 45 }, "Cache API matching includes credentials"); |
| 46 </script> |
| OLD | NEW |