diff --git a/lint.ignore b/lint.ignore index 3feeade3388a7c..943ce836aaf563 100644 --- a/lint.ignore +++ b/lint.ignore @@ -415,6 +415,7 @@ SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/c SET TIMEOUT: html/webappapis/timers/* SET TIMEOUT: portals/history/resources/portal-harness.js SET TIMEOUT: requestidlecallback/deadline-after-expired-timer.html +SET TIMEOUT: resource-timing/tentative/initiator-url/set-timeout.html SET TIMEOUT: resources/* SET TIMEOUT: scheduler/tentative/current-task-signal-async-abort.any.js SET TIMEOUT: scheduler/tentative/current-task-signal-async-priority.any.js diff --git a/resource-timing/resources/iframe-post-message.html b/resource-timing/resources/iframe-post-message.html new file mode 100644 index 00000000000000..da9d5ecc1c5ecb --- /dev/null +++ b/resource-timing/resources/iframe-post-message.html @@ -0,0 +1,9 @@ + + + + diff --git a/resource-timing/resources/loading-resource-lib.js b/resource-timing/resources/loading-resource-lib.js new file mode 100644 index 00000000000000..2e607563face65 --- /dev/null +++ b/resource-timing/resources/loading-resource-lib.js @@ -0,0 +1,9 @@ +// This js file actually calls fetch to load an image to +// an element. +async function load_image(label, img_element) { + const url = "/images/blue.png?"+label; + const response = await fetch(url); + blob = await response.blob(); + const imgURL = URL.createObjectURL(blob); + img_element.src = imgURL; +} diff --git a/resource-timing/resources/loading-resources-in-posted-task.js b/resource-timing/resources/loading-resources-in-posted-task.js new file mode 100644 index 00000000000000..6a2a5eb8b42e7d --- /dev/null +++ b/resource-timing/resources/loading-resources-in-posted-task.js @@ -0,0 +1,29 @@ +function load_resources() { + //Fetching the Stylesheet + var link = document.createElement("link"); + link.rel = "stylesheet"; + link.href = "resources/empty_style.css?no_cache"; + link.id = "link_id"; + document.head.appendChild(link); + + // Fetching an image + var img = document.createElement("img"); + img.src = "/images/blue.png?no_cache"; + img.alt = "Sample Image for testing initiator Attribute"; + img.id = "img_id" + document.body.appendChild(img); + + // Inserting a script element + var script = document.createElement("script"); + script.src = "resources/empty.js?no_cache"; + script.id = "script_id" + document.body.appendChild(script); + + //Inserting a html document in an iframe + var iframe = document.createElement("iframe"); + iframe.src = "resources/green.html?no_cache"; + iframe.id = "iframe_id"; + document.body.appendChild(iframe); +} + +scheduler.postTask(load_resources); diff --git a/resource-timing/resources/loadingResources.js b/resource-timing/resources/loading-resources.js similarity index 65% rename from resource-timing/resources/loadingResources.js rename to resource-timing/resources/loading-resources.js index e5d5d71982af05..62da62c444eb49 100644 --- a/resource-timing/resources/loadingResources.js +++ b/resource-timing/resources/loading-resources.js @@ -1,21 +1,25 @@ //Fetching the Stylesheet var link = document.createElement("link"); link.rel = "stylesheet"; -link.href = "../resources/empty_style.css"; +link.href = "resources/empty_style.css?no_cache"; +link.id = "link_id"; document.head.appendChild(link); // Fetching an image var img = document.createElement("img"); -img.src = "/images/blue.png"; +img.src = "/images/blue.png?no_cache"; img.alt = "Sample Image for testing initiator Attribute"; +img.id = "img_id" document.body.appendChild(img); -//Inserting a html document in an iframe -var iframe = document.createElement("iframe"); -iframe.src = "../resources/green.html"; -document.body.appendChild(iframe); - // Inserting a script element var script = document.createElement("script"); -script.src = "../resources/empty.js"; +script.src = "resources/empty.js?no_cache"; +script.id = "script_id" document.body.appendChild(script); + +//Inserting a html document in an iframe +var iframe = document.createElement("iframe"); +iframe.src = "resources/green.html?no_cache"; +iframe.id = "iframe_id"; +document.body.appendChild(iframe); diff --git a/resource-timing/tentative/initiator-url/event-handler.html b/resource-timing/tentative/initiator-url/event-handler.html new file mode 100644 index 00000000000000..26071408e9edc6 --- /dev/null +++ b/resource-timing/tentative/initiator-url/event-handler.html @@ -0,0 +1,37 @@ + +
+ + + + + + + + +This test verifies that, for a resource fetched via event handler, + the initiator_url points to script that sets up the event handler. +
+ + diff --git a/resource-timing/tentative/initiator-url/external-script-in-posted-task.html b/resource-timing/tentative/initiator-url/external-script-in-posted-task.html new file mode 100644 index 00000000000000..873375a4dba5d5 --- /dev/null +++ b/resource-timing/tentative/initiator-url/external-script-in-posted-task.html @@ -0,0 +1,31 @@ + + + + + + + + + + + +This test loads a number of resources in the loading-resources.js via scheduler.postTask() + and verifies that `iniatitor_url`s in ResourceTiming are expected. +
+ + diff --git a/resource-timing/tentative/initiator-url/external-script.html b/resource-timing/tentative/initiator-url/external-script.html new file mode 100644 index 00000000000000..772c2a43021896 --- /dev/null +++ b/resource-timing/tentative/initiator-url/external-script.html @@ -0,0 +1,31 @@ + + + + + + + + + + + +This test loads a number of resources in the loading-resources.js and + verifies that `iniatitor_url`s in ResourceTiming entries are as expected. +
+ + diff --git a/resource-timing/tentative/initiator-url/iframe-post-message.html b/resource-timing/tentative/initiator-url/iframe-post-message.html new file mode 100644 index 00000000000000..461a07e8be014b --- /dev/null +++ b/resource-timing/tentative/initiator-url/iframe-post-message.html @@ -0,0 +1,42 @@ + + + + + + + + + + +This test verifies that, for a resource fetched via message handler, + the initiator_url points to script that sends the message. +
+ + diff --git a/resource-timing/tentative/initiator-url/inline-document-write.html b/resource-timing/tentative/initiator-url/inline-document-write.html index ac8f20404bfed8..c23e19e7444fca 100644 --- a/resource-timing/tentative/initiator-url/inline-document-write.html +++ b/resource-timing/tentative/initiator-url/inline-document-write.html @@ -17,8 +17,8 @@ document.write(''); document.write(' + + + + + + +This test verifies that, for resources including an + iframe, that are loaded by an inline script, the + initiatorUrl is properly reported. +
+ + diff --git a/resource-timing/tentative/initiator-url/post-task.html b/resource-timing/tentative/initiator-url/post-task.html new file mode 100644 index 00000000000000..2eb5c6ed6f9e5c --- /dev/null +++ b/resource-timing/tentative/initiator-url/post-task.html @@ -0,0 +1,31 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a postTask, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/promise.html b/resource-timing/tentative/initiator-url/promise.html new file mode 100644 index 00000000000000..bbdb4d42961f4a --- /dev/null +++ b/resource-timing/tentative/initiator-url/promise.html @@ -0,0 +1,32 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a Promise, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/queue-microtask.html b/resource-timing/tentative/initiator-url/queue-microtask.html new file mode 100644 index 00000000000000..ccad8d61e395cc --- /dev/null +++ b/resource-timing/tentative/initiator-url/queue-microtask.html @@ -0,0 +1,30 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a queueMicrotask, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/request-animation-frame.html b/resource-timing/tentative/initiator-url/request-animation-frame.html new file mode 100644 index 00000000000000..85c6d2d14c0d6c --- /dev/null +++ b/resource-timing/tentative/initiator-url/request-animation-frame.html @@ -0,0 +1,31 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a requestAnimationFrame, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/request-idle-callback.html b/resource-timing/tentative/initiator-url/request-idle-callback.html new file mode 100644 index 00000000000000..9981f5fe098a93 --- /dev/null +++ b/resource-timing/tentative/initiator-url/request-idle-callback.html @@ -0,0 +1,30 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a requestIdleCallback, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/set-interval.html b/resource-timing/tentative/initiator-url/set-interval.html new file mode 100644 index 00000000000000..b53ab4deabf3cc --- /dev/null +++ b/resource-timing/tentative/initiator-url/set-interval.html @@ -0,0 +1,30 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a setInterval, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/set-timeout.html b/resource-timing/tentative/initiator-url/set-timeout.html new file mode 100644 index 00000000000000..9df57541c70b36 --- /dev/null +++ b/resource-timing/tentative/initiator-url/set-timeout.html @@ -0,0 +1,31 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a setTimeout, + the initiator_url points to the async caller script, + instead of the callee script. +
+ + diff --git a/resource-timing/tentative/initiator-url/document-initiated.html b/resource-timing/tentative/initiator-url/static-resource.html similarity index 62% rename from resource-timing/tentative/initiator-url/document-initiated.html rename to resource-timing/tentative/initiator-url/static-resource.html index 09da30550bd5d3..7a0a44b1b24115 100644 --- a/resource-timing/tentative/initiator-url/document-initiated.html +++ b/resource-timing/tentative/initiator-url/static-resource.html @@ -44,26 +44,9 @@ diff --git a/resource-timing/tentative/initiator-url/xml-http-request.html b/resource-timing/tentative/initiator-url/xml-http-request.html new file mode 100644 index 00000000000000..d1c5b5cf1a31cb --- /dev/null +++ b/resource-timing/tentative/initiator-url/xml-http-request.html @@ -0,0 +1,33 @@ + + + + + + + + + + +This test verifies that, for a resource fetched with a XMLHttpRequest, + the initiator_url points to the script where xmlhttprequest.send() + happens. +
+ + diff --git a/resource-timing/tentative/script-initiated.html b/resource-timing/tentative/script-initiated.html deleted file mode 100644 index d6f3d1a32034a7..00000000000000 --- a/resource-timing/tentative/script-initiated.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - -