summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/navigation-preload/empty-preload-response-body.https.html
blob: 7e8aacdd36a58cdd88d2f1e70fec69c580526f00 (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Navigation Preload empty response body</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/test-helpers.sub.js"></script>
<script>
promise_test(t => {
    var script = 'resources/empty-preload-response-body-worker.js';
    var scope = 'resources/empty-preload-response-body-scope.html';
    return service_worker_unregister_and_register(t, script, scope)
      .then(registration => {
          add_completion_callback(_ => registration.unregister());
          var worker = registration.installing;
          return wait_for_state(t, worker, 'activated');
        })
      .then(_ => with_iframe(scope))
      .then(frame => {
          assert_equals(
            frame.contentDocument.body.textContent,
            '[]');
        });
  }, 'Navigation Preload empty response body.');

</script>