Bug 1425458 - Resource timing entries Workers - part 8 - WPT, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 24 Jan 2018 17:17:33 +0100
changeset 400807 4f292fa4e4a30c8ba0745cf9884dc08c098752c0
parent 400806 e08739c23a5e7ad129e1c20f15e8d800b6318832
child 400808 87fed30c57597ade9c70b3509c41fcc26f54b6e1
push id33319
push useraiakab@mozilla.com
push dateFri, 26 Jan 2018 00:22:49 +0000
treeherdermozilla-central@b5b38db26ed7 [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/meta/performance-timeline/case-sensitivity.any.js.ini
testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
testing/web-platform/meta/workers/worker-performance.worker.js.ini
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
@@ -284665,16 +284665,21 @@
      {}
     ]
    ],
    "resource-timing/resources/blue.png": [
     [
      {}
     ]
    ],
+   "resource-timing/resources/empty.js": [
+    [
+     {}
+    ]
+   ],
    "resource-timing/resources/fake_responses.html": [
     [
      {}
     ]
    ],
    "resource-timing/resources/fake_responses.py": [
     [
      {}
@@ -348949,16 +348954,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"
      }
     ]
    ],
@@ -573784,24 +573795,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"
   ],
deleted file mode 100644
--- a/testing/web-platform/meta/performance-timeline/case-sensitivity.any.js.ini
+++ /dev/null
@@ -1,9 +0,0 @@
-[case-sensitivity.any.worker.html]
-  [getEntriesByType values are case sensitive]
-    expected: FAIL
-
-  [getEntriesByName values are case sensitive]
-    expected: FAIL
-
-
-[case-sensitivity.any.html]
--- a/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
+++ b/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
@@ -1,4 +1,3 @@
 [performance-timeline.https.html]
   [Resource Timing]
-    expected: FAIL
-
+    expected: TIMEOUT
--- a/testing/web-platform/meta/workers/worker-performance.worker.js.ini
+++ b/testing/web-platform/meta/workers/worker-performance.worker.js.ini
@@ -1,13 +1,4 @@
 [worker-performance.worker.html]
-  [Resource timing seems to work in workers]
-    expected: FAIL
-
-  [performance.clearResourceTimings in workers]
-    expected: FAIL
-
-  [performance.setResourceTimingBufferSize in workers]
-    expected: FAIL
-
   [performance.toJSON is available in workers]
     expected: FAIL
 
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 */