Skip to content

Commit

Permalink
Sort the registrations returned by getRegistrations() by registration…
Browse files Browse the repository at this point in the history
… ID. (#21046)

This patch makes the order of the registrations returned by
getRegistrations() be sorted by registration ID, which fixes the flaky
test of getregistrations.https.html. Related Github issue is in
w3c/ServiceWorker#1465

Bug: 925740
Change-Id: Iaa5716eec886232df61bd23487fbae5c63413e9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1984900
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Commit-Queue: Wei4 Wang <wei4.wang@intel.com>
Cr-Commit-Position: refs/heads/master@{#732749}

Co-authored-by: WangW_intel <54053982+wangw-1991@users.noreply.github.com>
  • Loading branch information
2 people authored and stephenmcgruer committed Jan 20, 2020
1 parent 2f4e0f9 commit 3b8990e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion service-workers/service-worker/getregistrations.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,19 @@
promise_test(async t => {
const scope1 = 'resources/scope/getregistrations/scope1';
const scope2 = 'resources/scope/getregistrations/scope2';
const scope3 = 'resources/scope/getregistrations/scope12';

const script = 'resources/empty-worker.js';
t.add_cleanup(() => service_worker_unregister(t, scope1));
t.add_cleanup(() => service_worker_unregister(t, scope2));
t.add_cleanup(() => service_worker_unregister(t, scope3));

const registrations = [
await service_worker_unregister_and_register(t, script, scope1),
await service_worker_unregister_and_register(t, script, scope2)
await service_worker_unregister_and_register(t, script, scope2),
await service_worker_unregister_and_register(t, script, scope3),
];

const value = await navigator.serviceWorker.getRegistrations();
assert_array_equals(value, registrations);
}, 'Register multiple times then getRegistrations');
Expand Down

0 comments on commit 3b8990e

Please sign in to comment.