[Curl] Fix r222147
[WebKit-https.git] / LayoutTests / http / wpt / resource-timing / rt-initiatorType-element.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>Resource Timing - Element localName initiatorType</title>
6 <link rel="help" href="https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-initiatortype">
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
9 <script src="resources/rt-utilities.sub.js"></script>
10 </head>
11 <body>
12 <h1>Resource Timing: Element localName initiatorType</h1>
13 <div id="log"></div>
14 <script>
15 resource_entry_type_test({
16     name: "img - <img src>",
17     url: uniqueImageURL("img-src"),
18     initiatorType: "img",
19     generateResource(url) {
20         let img = document.createElement("img");
21         img.src = url;
22     }
23 });
24
25 resource_entry_type_test({
26     name: "img - <img srcset>",
27     url: uniqueImageURL("img-srcset"),
28     initiatorType: "img",
29     generateResource(url) {
30         let img = document.createElement("img");
31         img.srcset = `${url} 1x, ${url} 2x`;
32     }
33 });
34
35 resource_entry_type_test({
36     name: "img - <picture>",
37     url: uniqueImageURL("picture"),
38     initiatorType: "img",
39     generateResource(url) {
40         let picture = document.createElement("picture");
41         let source = picture.appendChild(document.createElement("source"));
42         source.srcset = `${url} 1x, ${url} 2x`;
43         let img = picture.appendChild(document.createElement("img"));
44         img.src = uniqueImageURL("inner-image"); // Different URL.
45         document.body.appendChild(picture);
46     }
47 });
48
49 resource_entry_type_test({
50     name: "image - <svg:image xlink:href>",
51     url: uniqueImageURL("svg-image"),
52     initiatorType: "image",
53     generateResource(url) {
54         const svgNamespace = "http://www.w3.org/2000/svg";
55         const xlinkNamespace = "http://www.w3.org/1999/xlink";
56         let svgElement = document.createElementNS(svgNamespace, "svg");
57         let imageElement = svgElement.appendChild(document.createElementNS(svgNamespace, "image"));
58         imageElement.setAttributeNS(xlinkNamespace, "xlink:href", url);
59         document.body.appendChild(svgElement);
60     }
61 });
62
63 resource_entry_type_test({
64     name: "input - <input type=image>",
65     url: uniqueImageURL("input-image"),
66     initiatorType: "input",
67     generateResource(url) {
68         let input = document.createElement("input");
69         input.type = "image";
70         input.src = url;
71         document.body.appendChild(input);
72     }
73 });
74
75 resource_entry_type_test({
76     name: "script - <script type=script>",
77     url: uniqueScriptURL("script"),
78     initiatorType: "script",
79     generateResource(url) {
80         let script = document.createElement("script");
81         script.src = url;
82         document.head.appendChild(script);
83     }
84 });
85
86 resource_entry_type_test({
87     name: "link - <link rel=stylesheet>",
88     url: uniqueStylesheetURL("link-stylesheet"),
89     initiatorType: "link",
90     generateResource(url) {
91         let link = document.createElement("link");
92         link.rel = "stylesheet";
93         link.href = url;
94         document.head.appendChild(link);
95     }
96 });
97
98 resource_entry_type_test({
99     name: "iframe - <iframe src>",
100     url: uniqueDocumentURL("iframe"),
101     initiatorType: "iframe",
102     generateResource(url) {
103         let iframe = document.createElement("iframe");
104         iframe.src = url;
105         document.body.appendChild(iframe);
106     }
107 });
108
109 resource_entry_type_test({
110     name: "object - <object data>",
111     url: uniqueDataURL("object"),
112     initiatorType: "object",
113     generateResource(url) {
114         let object = document.createElement("object");
115         object.data = url;
116         document.body.appendChild(object);
117     }
118 });
119
120 resource_entry_type_test({
121     name: "embed - <embed data>",
122     url: uniqueDataURL("embed"),
123     initiatorType: "embed",
124     generateResource(url) {
125         let embed = document.createElement("embed");
126         embed.src = url;
127         document.body.appendChild(embed);
128     }
129 });
130
131 resource_entry_type_test({
132     name: "video - <video poster>",
133     url: uniqueImageURL("video"),
134     initiatorType: "video",
135     generateResource(url) {
136         let video = document.createElement("video");
137         video.poster = url;
138     }
139 });
140
141 // FIXME: <html manifest>?
142 // FIXME: <track>?
143 </script>
144 </body>
145 </html>