summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/embed-and-object-are-not-intercepted.https.html
blob: 581dbeca9772268ab85a2b50d8f7f45cf61e781f (plain)
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
<!DOCTYPE html>
<meta charset="utf-8">
<title>embed and object are not intercepted</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/test-helpers.sub.js?pipe=sub"></script>
<body>
<script>
let registration;

const kScript = 'resources/embed-and-object-are-not-intercepted-worker.js';
const kScope = 'resources/';

promise_test(t => {
    return service_worker_unregister_and_register(t, kScript, kScope)
      .then(registration => {
          promise_test(() => {
              return registration.unregister();
            }, 'restore global state');

          return wait_for_state(t, registration.installing, 'activated');
        })
  }, 'initialize global state');

promise_test(t => {
    let frame;
    return with_iframe('resources/embed-is-not-intercepted-iframe.html')
      .then(f => {
          frame = f;
          t.add_cleanup(() => { frame.remove(); });
          return frame.contentWindow.test_promise;
        })
      .then(result => {
          assert_equals(result, 'request for embedded content was not intercepted');
        });
  }, 'requests for EMBED elements of embedded HTML content should not be intercepted by service workers');

promise_test(t => {
    let frame;
    return with_iframe('resources/object-is-not-intercepted-iframe.html')
      .then(f => {
          frame = f;
          t.add_cleanup(() => { frame.remove(); });
          return frame.contentWindow.test_promise;
        })
      .then(result => {
          assert_equals(result, 'request for embedded content was not intercepted');
        });
  }, 'requests for OBJECT elements of embedded HTML content should not be intercepted by service workers');

promise_test(t => {
    let frame;
    return with_iframe('resources/embed-image-is-not-intercepted-iframe.html')
      .then(f => {
          frame = f;
          t.add_cleanup(() => { frame.remove(); });
          return frame.contentWindow.test_promise;
        })
      .then(result => {
          assert_equals(result, 'request was not intercepted');
        });
  }, 'requests for EMBED elements of an image should not be intercepted by service workers');

promise_test(t => {
    let frame;
    return with_iframe('resources/object-image-is-not-intercepted-iframe.html')
      .then(f => {
          frame = f;
          t.add_cleanup(() => { frame.remove(); });
          return frame.contentWindow.test_promise;
        })
      .then(result => {
          assert_equals(result, 'request was not intercepted');
        });
  }, 'requests for OBJECT elements of an image should not be intercepted by service workers');

promise_test(t => {
    let frame;
    return with_iframe('resources/object-navigation-is-not-intercepted-iframe.html')
      .then(f => {
          frame = f;
          t.add_cleanup(() => { frame.remove(); });
          return frame.contentWindow.test_promise;
        })
      .then(result => {
          assert_equals(result, 'request for embedded content was not intercepted');
        });
  }, 'post-load navigation of OBJECT elements should not be intercepted by service workers');


promise_test(t => {
    let frame;
    return with_iframe('resources/embed-navigation-is-not-intercepted-iframe.html')
      .then(f => {
          frame = f;
          t.add_cleanup(() => { frame.remove(); });
          return frame.contentWindow.test_promise;
        })
      .then(result => {
          assert_equals(result, 'request for embedded content was not intercepted');
        });
  }, 'post-load navigation of EMBED elements should not be intercepted by service workers');
</script>