Bug 1635673 [wpt PR 23412] - [ResourceTiming] Dispatch entry for 404 scripts, a=testonly
authorNicolás Peña Moreno <npm@chromium.org>
Wed, 13 May 2020 09:44:08 +0000
changeset 531107 877e73caedb35f2dca41703f3fb84eac82cec06d
parent 531106 e8c21c7b788b39f6149d47352ece2bb9c0cde7b5
child 531108 d318fb86b3225bc87c4faee9c4c0f7fcc0eafd5e
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1635673, 23412, 883400, 2181828, 766123
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1635673 [wpt PR 23412] - [ResourceTiming] Dispatch entry for 404 scripts, a=testonly Automatic update from web-platform-tests [ResourceTiming] Dispatch entry for 404 scripts This CL fixes dispatching PerformanceResourceTiming entries when the resource was a 404 script. These do not go through HandleLoaderFinish() and instead go through HandleLoaderError(). The ResourceTimingInfo was already being discarded in that method, so instead we report the entry as resources with error statuses must be reported. Bug: 883400 Change-Id: I72e95b79f70f10b3f1f9c18a8053d2a31f5a6008 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2181828 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Yoav Weiss <yoavweiss@chromium.org> Cr-Commit-Position: refs/heads/master@{#766123} -- wpt-commits: f4bf034f4fd62cfebc956b9d1a0b8fd48398674c wpt-pr: 23412
testing/web-platform/tests/preload/subresource-integrity.html
testing/web-platform/tests/resource-timing/status-codes-create-entry.html
--- a/testing/web-platform/tests/preload/subresource-integrity.html
+++ b/testing/web-platform/tests/preload/subresource-integrity.html
@@ -193,17 +193,17 @@
         {integrity: "sha256-deadbeef2S+pTRZgiw3DWrhC6JLDlt2zRyGpwH7unU8=", crossOrigin: "use-credentials"},
         {crossOrigin: "use-credentials"}
     )
 
     SRIPreloadTest(
         false,
         false,
         `<crossorigin='anonymous'> ${destination} with CORS-ineligible resource`,
-        0,
+        1,
         destination,
         // not piping ACAO header makes this CORS-ineligible
         xorigin_prefix + destination + ext + `?${token()}`,
         {integrity: sha256, crossOrigin: "anonymous"},
         {crossOrigin: "anonymous"}
     )
 
     SRIPreloadTest(
--- a/testing/web-platform/tests/resource-timing/status-codes-create-entry.html
+++ b/testing/web-platform/tests/resource-timing/status-codes-create-entry.html
@@ -4,19 +4,33 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 </head>
 <body>
 <img src="resources/status-code.py?status=200">
 <img src="resources/status-code.py?status=307">
 <img src="resources/status-code.py?status=404">
 <img src="resources/status-code.py?status=502">
+<script src="resources/status-code.py?status=200&script=1"></script>
+<script src="resources/status-code.py?status=307&script=1"></script>
+<script src="resources/status-code.py?status=404&script=1"></script>
+<script src="resources/status-code.py?status=502&script=1"></script>
 <script>
 async_test(t => {
-  window.addEventListener("load", t.step_func(() => {
+  window.addEventListener("load", t.step_func_done(() => {
     const images = document.getElementsByTagName("img");
     for (let img of images) {
       assert_greater_than(performance.getEntriesByName(img.src).length, 0, img.src);
     }
-    t.done();
+    const scripts = document.getElementsByTagName("script");
+    let noSrcScriptFound = false;
+    for (let script of scripts) {
+      if (script.src) {
+        assert_greater_than(performance.getEntriesByName(script.src).length, 0, script.src);
+      } else {
+        // Ignore this script, which has no src value. There should only be one such script.
+        assert_false(noSrcScriptFound);
+        noSrcScriptFound = true;
+      }
+    }
   }));
 }, "Make sure all status codes are reported");
 </script>