Bug 1425458 - Resource timing entries Workers - part 8 - WPT, r=smaug
☠☠ backed out by e0c276b06c0d ☠ ☠
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 24 Jan 2018 17:17:33 +0100
changeset 400593 b96d58fd945ced9050f9b4602b9dfdf857d0954c
parent 400592 f140da44ba689c3b70bc2ca2f01a5972745541b1
child 400594 a29e9dbb8c42f927889b8f755e8c5e137920cdb1
push id99191
push useramarchesini@mozilla.com
push dateWed, 24 Jan 2018 16:18:05 +0000
treeherdermozilla-inbound@b96d58fd945c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1425458
milestone60.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 1425458 - Resource timing entries Workers - part 8 - WPT, r=smaug
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/resource-timing/resource_timing.worker.js
testing/web-platform/tests/resource-timing/resources/empty.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -284567,16 +284567,21 @@
      {}
     ]
    ],
    "resource-timing/resources/blue.png": [
     [
      {}
     ]
    ],
+   "resource-timing/resources/empty.js": [
+    [
+     {}
+    ]
+   ],
    "resource-timing/resources/fake_responses.html": [
     [
      {}
     ]
    ],
    "resource-timing/resources/fake_responses.py": [
     [
      {}
@@ -348851,16 +348856,22 @@
     ]
    ],
    "resource-timing/resource_subframe_self_navigation.html": [
     [
      "/resource-timing/resource_subframe_self_navigation.html",
      {}
     ]
    ],
+   "resource-timing/resource_timing.worker.js": [
+    [
+     "/resource-timing/resource_timing.worker.html",
+     {}
+    ]
+   ],
    "resource-timing/single-entry-per-resource.html": [
     [
      "/resource-timing/single-entry-per-resource.html",
      {
       "timeout": "long"
      }
     ]
    ],
@@ -573630,24 +573641,32 @@
   "resource-timing/resource_dynamic_insertion.html": [
    "1b6e111056101c88623eda6148042c310a5b7a6d",
    "testharness"
   ],
   "resource-timing/resource_subframe_self_navigation.html": [
    "072eb2cd05a0711abc498f4180738aef7d1bf282",
    "testharness"
   ],
+  "resource-timing/resource_timing.worker.js": [
+   "c458be6cb1c70c151761f69b07d92163a30001f5",
+   "testharness"
+  ],
   "resource-timing/resources/TAOResponse.py": [
    "9e8051a2ff8fff72b36ed1cecb61f9e7bba29071",
    "support"
   ],
   "resource-timing/resources/blue.png": [
    "99949c515749e66f471c3589ee7a0ef518aaccb5",
    "support"
   ],
+  "resource-timing/resources/empty.js": [
+   "51e0050cf1bdeb051d0d7ab6f23a7a2173cb40db",
+   "support"
+  ],
   "resource-timing/resources/fake_responses.html": [
    "c942abc1e8c1672935ffc8ce34821891345bacb9",
    "support"
   ],
   "resource-timing/resources/fake_responses.py": [
    "ea5b33477356da9f1053413537f36684ac5efdf2",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resource_timing.worker.js
@@ -0,0 +1,64 @@
+importScripts("/resources/testharness.js");
+
+function check(initiatorType, protocol) {
+  let entries = performance.getEntries();
+  assert_equals(entries.length, 1);
+
+  assert_true(entries[0] instanceof PerformanceEntry);
+  assert_equals(entries[0].entryType, "resource");
+  assert_true(entries[0].startTime > 0);
+  assert_true(entries[0].duration > 0);
+
+  assert_true(entries[0] instanceof PerformanceResourceTiming);
+  assert_equals(entries[0].initiatorType, initiatorType);
+  assert_equals(entries[0].nextHopProtocol, protocol);
+}
+
+async_test(t => {
+  performance.clearResourceTimings();
+
+  // Fetch
+  fetch("resources/empty.js")
+  .then(r => r.blob())
+  .then(blob => {
+    check("fetch", "http/1.1");
+  })
+
+  // XMLHttpRequest
+  .then(() => {
+    return new Promise(resolve => {
+      performance.clearResourceTimings();
+      let xhr = new XMLHttpRequest();
+      xhr.onload = () => {
+        check("xmlhttprequest", "http/1.1");
+        resolve();
+      };
+      xhr.open("GET", "resources/empty.js");
+      xhr.send();
+    });
+  })
+
+  // Sync XMLHttpREquest
+  .then(() => {
+    performance.clearResourceTimings();
+    let xhr = new XMLHttpRequest();
+    xhr.open("GET", "resources/empty.js", false);
+    xhr.send();
+
+    check("xmlhttprequest", "http/1.1");
+  })
+
+  // ImportScripts
+  .then(() => {
+    performance.clearResourceTimings();
+    importScripts(["resources/empty.js"]);
+    check("other", "http/1.1");
+  })
+
+  // All done.
+  .then(() => {
+    t.done();
+  });
+}, "Performance Resouce Entries in workers");
+
+done();
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/resource-timing/resources/empty.js
@@ -0,0 +1,1 @@
+/* Nothing here */