File: document-initiated.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (90 lines) | stat: -rw-r--r-- 3,388 bytes parent folder | download | duplicates (4)
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
<!DOCTYPE html>
<head>
  <script src="/resources/testharness.js"></script>
  <script src="/resources/testharnessreport.js"></script>
  <script src="/resource-timing/resources/observe-entry.js"></script>
  <script src="../../resources/test-initiator.js"></script>
  <script src="/common/get-host-info.sub.js"></script>

  <!-- Empty Blocking Script -->
  <script src="../../resources/empty.js?blocking"></script>
  <!-- Empty Preloaded Script -->
  <link rel="preload" href="../../resources/display_paragraph.js" as="script" />
  <!--  Loading arbitrary Empty Blocking Async Script -->
  <script async src="../../resources/empty.js?async"></script>
  <!-- Loading arbitrary Empty Deferred Script -->
  <script defer src="../../resources/empty.js?deferred"></script>
  <!-- Loading arbitrary Empty Module Script -->
  <script type="module" src="../../resources/empty.js?module"></script>
  <!-- Empty Stylesheet -->
  <link rel="stylesheet" href="../../resources/empty_style.css?link" />
  <script src="../../resources/display_paragraph.js"></script>
  <!-- Inline Styles -->
  <style>
    body {
      background-image: url("/images/blue.png?inline-style");
      font-family: remoteFont, sans-serif;
    }
    @font-face {
      font-family: remoteFont;
      /* This query parameter ensures that the Ahem.ttf is not retrieved from the cache. */
      src: url("/fonts/Ahem.ttf?initiator-html");
    }
  </style>
</head>
<body>
  <!-- Loading an arbitrary Image using <img> tag -->
  <img
    src="/images/blue.png?using-Img-tag"
    alt="Sample Image for testing initiator Attribute"
  />

  <iframe src="../../resources/green.html"></iframe>

  <script>
    display_paragraph();

    // TODO(crbug.com/40919714): The two elements below are not initiated by html.
    // They are initiated by script. They should be moved out of this test.
    // As of 08/2025 the two below are passing for chromium but because of wrong
    // reasons. They are not recognized to be resources initaited by scripts, so they
    // are thought to be initiated from main html, for which the url happens to be
    // correct for inline scripts.

    // Load arbitrary stylesheet with inline script.
    const link = document.createElement("link");
    link.rel = "stylesheet";
    link.href = "../../resources/empty_style.css?inline-script";
    document.head.appendChild(link);
    // Load arbitrary image with inline script
    const img = document.createElement("img");
    img.src = "/images/blue.png?inline-script";
    document.body.appendChild(img);

    const host_info = get_host_info();
    const expectedInitiatorUrl = host_info["ORIGIN"] +
      "/resource-timing/tentative/initiator-url/document-initiated.html";

    const resources = [
      "empty.js?blocking",
      "display_paragraph.js",
      "empty.js?async",
      "empty.js?deferred",
      "empty.js?module",
      "empty_style.css?link",
      "blue.png?inline-style",
      "Ahem.ttf?initiator-html",
      "blue.png?using-Img-tag",
        /*        "green.html",
        TODO(crbug.com/40919714): report initiator for iframe element.
        */
      "empty_style.css?inline-script",
      "blue.png?inline-script",
    ];
    for (const resource of resources) {
      initiator_url_test(resource, expectedInitiatorUrl, resource+
        " initiatorUrl from document-initiated", resource+" timeout");
    }

  </script>
</body>