File: credentials.html

package info (click to toggle)
firefox-esr 52.8.1esr-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 1,983,244 kB
  • sloc: cpp: 4,810,275; ansic: 2,004,548; python: 451,282; java: 241,615; asm: 178,649; xml: 136,302; sh: 82,207; makefile: 22,575; perl: 15,783; objc: 4,389; yacc: 1,816; ada: 1,697; pascal: 1,519; lex: 1,257; cs: 879; exp: 499; php: 436; lisp: 258; awk: 152; sed: 51; ruby: 47; csh: 27
file content (46 lines) | stat: -rw-r--r-- 1,817 bytes parent folder | download | duplicates (16)
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
<!DOCTYPE html>
<meta charset=utf-8>
<title>Cache Storage: Verify credentials are respected by Cache operations</title>
<link rel="help" href="https://w3c.github.io/ServiceWorker/#cache-storage">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../service-worker/resources/test-helpers.sub.js"></script>
<style>iframe { display: none; }</style>
<script>

var worker = "../resources/credentials-worker.js";
var scope = "../resources/credentials-iframe.html";
promise_test(function(t) {
  return self.caches.delete('credentials')
    .then(function() {
      return service_worker_unregister_and_register(t, worker, scope)
    })
    .then(function(reg) {
      return wait_for_state(t, reg.installing, 'activated');
    })
    .then(function() {
      return with_iframe(scope);
    })
    .then(function(frame) {
      frame.contentWindow.postMessage([
        {name: 'file.txt', username: 'aa', password: 'bb'},
        {name: 'file.txt', username: 'cc', password: 'dd'},
        {name: 'file.txt'}
      ], '*');
      return new Promise(function(resolve, reject) {
        window.onmessage = t.step_func(function(e) {
          resolve(e.data);
        });
      });
    })
    .then(function(data) {
      assert_equals(data.length, 3, 'three entries should be present');
      assert_equals(data.filter(function(url) { return /@/.test(url); }).length, 2,
        'two entries should contain credentials');
      assert_true(data.some(function(url) { return /aa:bb@/.test(url); }),
        'entry with credentials aa:bb should be present');
      assert_true(data.some(function(url) { return /cc:dd@/.test(url); }),
        'entry with credentials cc:dd should be present');
    });
}, "Cache API matching includes credentials");
</script>