Bug 1551469 [wpt PR 16792] - worker: Add wpt for ResourceTiming on nested dedicated workers, a=testonly

Automatic update from web-platform-tests
worker: Add wpt for ResourceTiming on nested dedicated workers

If a worker creates a nested worker, there should be a performance
entry on the parent worker because:
* The spec specifies that the client of "run a worker"[1] comes
  from outside settings object.
* [2] says that a performance entry should be included in the
  performance timeline of the client's global context.

[1] https://html.spec.whatwg.org/multipage/workers.html#run-a-worker
[2] https://w3c.github.io/resource-timing/#resources-included-in-the-performanceresourcetiming-interface

Bug: 961552
Change-Id: I979f3f2e89a93545746ddd2124c931f4aa334bbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1607714
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658961}

--

wpt-commits: dbbcf115340e33877a3419a2f17f34d3e3483e48
wpt-pr: 16792
This commit is contained in:
Kenichi Ishibashi 2019-06-12 16:06:47 +00:00 коммит произвёл James Graham
Родитель 2ebf2afb22
Коммит 9ec223d81c
2 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,17 @@
importScripts("/resources/testharness.js");
async_test(async function() {
const worker = new Worker('resources/worker_with_images.js');
worker.onmessage = this.step_func_done((event) => {
const childNumEntries = event.data;
assert_equals(2, childNumEntries,
"There should be two resource timing entries: 2 image XHRs");
const parentNumEntries = performance.getEntries().length;
assert_equals(2, parentNumEntries,
"There should be two resource timing entries: " +
"one is for importScripts() and the another is for a nested worker");
worker.terminate();
});
}, "Resource timing for nested dedicated workers");
done();

Просмотреть файл

@ -3,7 +3,8 @@ let numComplete = 0;
function checkDone() {
++numComplete;
if (numComplete == 2) {
postMessage('');
const numEntries = performance.getEntries().length;
postMessage(numEntries);
}
}