summaryrefslogtreecommitdiffstats
path: root/dom/manifest/test/test_link_relList_supports_manifest.html
blob: 2a5c0e1ee11d061ff1b1915d79cad03f09edd7c2 (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
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1596040
-->

<head>
  <meta charset="utf-8">
  <title>Test for Bug 1596040 - Link relList support returns false for manifest</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
  <script>
  "use strict";
  SimpleTest.waitForExplicitFinish();

  async function run() {
    const prefSetting = [
      { manifest: true, modulepreload: true },
      { manifest: true, modulepreload: false },
      { manifest: false, modulepreload: true },
      { manifest: false, modulepreload: false },
    ];
    for (const { manifest, modulepreload } of prefSetting) {
      await SpecialPowers.pushPrefEnv({
        set: [
          ["dom.manifest.enabled", manifest],
          ["network.modulepreload", modulepreload],
        ],
      });
      const { relList } = document.createElement("link");
      is(
        relList.supports("manifest"),
        manifest,
        `Expected manifest to be ${manifest}`
      );
      is(
        relList.supports("modulepreload"),
        modulepreload,
        `Expected preload to be ${modulepreload}`
      );
    }
  }
  run()
    .catch(console.error)
    .finally(() => SimpleTest.finish());
  </script>
</head>