Bug 1518746: Switch to load events for all tested resources. r=valentin
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 21 Jan 2019 07:48:26 +0000
changeset 514724 a9ff8ccd4e3ddb1c53267f98a75a64a3a74f87bb
parent 514708 85ba084b3f903f4b479bf07f2c62f5184f61e44c
child 514725 565a04cfb0e443328f4b2c74e2ce439fc12eaa9f
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1518746
milestone66.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 1518746: Switch to load events for all tested resources. r=valentin Differential Revision: https://phabricator.services.mozilla.com/D16901
netwerk/test/mochitests/test_accept_header.html
--- a/netwerk/test/mochitests/test_accept_header.html
+++ b/netwerk/test/mochitests/test_accept_header.html
@@ -18,60 +18,42 @@ function test_last_request_and_continue(
   fetch("test_accept_header.sjs?get").then(r => r.json()).then(json => {
     is(json.type, query, "Expected: " + query);
     is(json.accept, expected, "Accept header: " + expected);
     next();
   });
 }
 
 function test_iframe() {
-  let observer = new PerformanceObserver(function(list, obj) {
-    list.getEntries().forEach(entry => info(entry.name));
-    list.getEntries().forEach(entry => {
-      if (entry.name.endsWith("test_accept_header.sjs?iframe")) {
-        obj.disconnect();
-        test_last_request_and_continue("iframe", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
-      }
-    });
-  });
-
-  observer.observe({entryTypes: ["resource"]});
-
   let ifr = document.createElement("iframe");
   ifr.src = "test_accept_header.sjs?iframe";
+  ifr.onload = () => {
+    test_last_request_and_continue("iframe", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
+  };
   document.body.appendChild(ifr);
 }
 
 function test_image() {
   let i = new Image();
   i.src = "test_accept_header.sjs?image";
   i.onload = function() {
     // Fetch spec says we should have: "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"
     test_last_request_and_continue("image", "image/webp,*/*");
   }
 }
 
 function test_style() {
-  let observer = new PerformanceObserver(function(list, obj) {
-    list.getEntries().forEach(entry => info(entry.name));
-    list.getEntries().forEach(entry => {
-      if (entry.name.endsWith("test_accept_header.sjs?style")) {
-        obj.disconnect();
-        test_last_request_and_continue("style", "text/css,*/*;q=0.1");
-      }
-    });
-  });
-
-  observer.observe({entryTypes: ["resource"]});
-
   let head = document.getElementsByTagName("head")[0];
   let link = document.createElement("link");
   link.rel = "stylesheet";
   link.type = "text/css";
   link.href = "test_accept_header.sjs?style";
+  link.onload = () => {
+    test_last_request_and_continue("style", "text/css,*/*;q=0.1");
+  };
   head.appendChild(link);
 }
 
 function test_worker() {
   let w = new Worker("test_accept_header.sjs?worker");
   w.onmessage = function() {
     test_last_request_and_continue("worker", "*/*");
   }