summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/mozilla/tests/fetch/fetchpriority/support/script-tests/script-dynamic-insertion.h2.html
blob: 27103c81c16ce2ed6cdd001dea4597e6a3d1bb84 (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
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>fetchpriority</title>
</head>
<body>
<script>
  onload = function() {
    const kData = [
        { src: "../resources/dummy.js?1", fetchPriority: "low"},
        { src: "../resources/dummy.js?2", fetchPriority: "high"},
        { src: "../resources/dummy.js?3", fetchPriority: "auto"},
        { src: "../resources/dummy.js?4"}
    ];

    let allScriptElements = [];
    for (data of kData) {
      let scriptElement = document.createElement("script");
      scriptElement.src = data.src;

      if ("fetchPriority" in data) {
        scriptElement.fetchPriority = data.fetchPriority;
      }

      allScriptElements.push(scriptElement);
    }

    document.head.append(...allScriptElements)

    opener.postMessage("ChildLoaded", "*");
  }
</script>
</body>
</html>