Debian Codegraph @

testing/web-platform/mozilla/tests/service-workers/bug1675097.https.html

raw
1 <!DOCTYPE html>
2 <title>Controlled iframe with initial about:blank becomes sandboxed</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script src="/service-workers/service-worker/resources/test-helpers.sub.js"></script>
6 <body>
7 <script>
8
9 // This test creates an iframe controlled by a service worker, which in turn has
10 // another iframe in it. The inner iframe's fetch is intercepted by the service
11 // worker, which notifies the outer iframe, which then adds the sandbox
12 // attribute to the inner iframe. The outer iframe then signals the service
13 // worker that it should evaluate self.clients.matchAll() and finally respond to
14 // the inner iframe's fetch.
15 // Evaluating self.clients.matchAll() causes the creation of the initial
16 // about:blank document for the inner iframe, and if the sandboxing flags used
17 // for that document are not the original flags for the inner iframe (i.e. none)
18 // then the document will have an opaque origin, a case that we need to handle
19 // properly.
20 promise_test(async t => {
21 const URL = 'resources/bug1675097-sw.js';
22 const SCOPE = 'resources/';
23
24 const registration = await service_worker_unregister_and_register(t, URL, SCOPE);
25 t.add_cleanup(() => registration.unregister());
26
27 await wait_for_state(t, registration.installing, 'activated');
28
29 const outer = await with_iframe(SCOPE + 'bug1675097-iframe.html');
30 t.add_cleanup(() => outer.remove());
31 }, 'Regression test for bug 1675097');
32
33 </script>
34 </body>