Commit 55bd5742 authored by Hiroki Nakagawa's avatar Hiroki Nakagawa Committed by Commit Bot

ServiceWorker: Deflake update-with-script-type.https.html

To sheriff: Please re-disable the test if it's still flaky.

In this test file, some tests start re-registering the second service worker
before the first service worker gets activated. In my theory, this sometimes
squashes the second registration job into the first registration job, and
results in test flakiness. This CL makes sure the second register runs after
the first service worker gets activated.

Note that it would be the correct behavior that the second registration job
isn't squashed when the script type is changed. There is a spec issue about
this: https://github.com/w3c/ServiceWorker/issues/1358

Bug: 901317
Change-Id: I7ce379071a35ef9aeb98e4492d651ee6fc4714ec
Reviewed-on: https://chromium-review.googlesource.com/c/1328546Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607494}
parent efa1ac7c
......@@ -396,7 +396,6 @@ crbug.com/591099 virtual/off-main-thread-worker-script-fetch/external/wpt/worker
crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/fetch/api/redirect/redirect-count.any.html [ Pass ]
crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/fetch/api/redirect/redirect-count.any.worker.html [ Pass ]
crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/fetch/api/request/request-keepalive-quota.html?include=slow-2 [ Pass ]
crbug.com/591099 virtual/outofblink-cors-ns/external/wpt/service-workers/service-worker/update-registration-with-type.https.html [ Failure Pass ]
crbug.com/591099 virtual/outofblink-cors-ns/http/tests/fetch/chromium/release-handle-crash.html [ Pass ]
crbug.com/591099 virtual/outofblink-cors-ns/http/tests/security/cors-rfc1918/addressspace-document-appcache.https.html [ Crash Failure ]
crbug.com/591099 virtual/outofblink-cors-ns/http/tests/security/cors-rfc1918/addressspace-document-csp-appcache.https.html [ Crash Failure Pass ]
......@@ -411,7 +410,6 @@ crbug.com/591099 virtual/prefer_compositing_to_lcd_text/ [ Skip ]
crbug.com/591099 virtual/reporting-api/external/wpt/content-security-policy/reporting-api/reporting-api-doesnt-send-reports-without-violation.https.sub.html [ Pass ]
crbug.com/591099 virtual/scroll_customization/ [ Skip ]
crbug.com/591099 virtual/scroll_customization/fast/events/touch/compositor-touch-hit-rects.html [ Failure ]
crbug.com/591099 virtual/service-worker-servicification/external/wpt/service-workers/service-worker/update-registration-with-type.https.html [ Failure Pass ]
crbug.com/591099 virtual/sharedarraybuffer/external/wpt/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.html [ Pass ]
crbug.com/591099 virtual/spv2/paint/invalidation/box/margin.html [ Failure Pass ]
crbug.com/591099 virtual/stable/ [ Skip ]
......
......@@ -5411,12 +5411,6 @@ crbug.com/901489 [ Mac10.13 ] http/tests/security/document-domain-canonicalizes.
crbug.com/901489 [ Mac10.13 ] virtual/outofblink-cors-ns/http/tests/security/document-domain-canonicalizes.html [ Crash Pass ]
crbug.com/901489 [ Mac10.13 ] virtual/outofblink-cors/http/tests/security/document-domain-canonicalizes.html [ Crash Pass ]
#Sheriff 2018-11-05
crbug.com/901317 external/wpt/service-workers/service-worker/update-registration-with-type.https.html [ Failure Pass ]
crbug.com/901317 virtual/outofblink-cors/external/wpt/service-workers/service-worker/update-registration-with-type.https.html [ Failure Pass ]
crbug.com/901317 virtual/service-worker-servicification/external/wpt/service-workers/service-worker/update-registration-with-type.https.html [ Failure Pass ]
crbug.com/901317 virtual/outofblink-cors-ns/external/wpt/service-workers/service-worker/update-registration-with-type.https.html [ Failure Pass ]
#Sheriff 2018-11-06
crbug.com/902632 [ Win Debug ] fast/xmlhttprequest/xmlhttprequest-recursive-sync-event.html [ Crash Pass ]
crbug.com/902645 [ Retina ] transforms/3d/point-mapping/3d-point-mapping-3.html [ Failure Pass ]
......
......@@ -16,16 +16,17 @@ promise_test(async t => {
const script = `resources/update-registration-with-type.py?classic_first=1&key=${key}`;
const scope = 'resources/update-registration-with-type';
await service_worker_unregister(t, scope);
t.add_cleanup(() => service_worker_unregister(t, scope));
// Register with classic script type.
const firstRegistration = await navigator.serviceWorker.register(script, {
scope: scope,
type: 'classic'
});
firstRegistration.installing.postMessage(' ');
let msgEvent = await new Promise(resolve => {
navigator.serviceWorker.onmessage = resolve;
});
const firstWorker = firstRegistration.installing;
await wait_for_state(t, firstWorker, 'activated');
firstWorker.postMessage(' ');
let msgEvent = await new Promise(r => navigator.serviceWorker.onmessage = r);
assert_equals(msgEvent.data, 'A classic script.');
// Re-register with module script type.
......@@ -33,11 +34,12 @@ promise_test(async t => {
scope: scope,
type: 'module'
});
secondRegistration.installing.postMessage(' ');
msgEvent = await new Promise(resolve => {
navigator.serviceWorker.onmessage = resolve;
});
const secondWorker = secondRegistration.installing;
secondWorker.postMessage(' ');
msgEvent = await new Promise(r => navigator.serviceWorker.onmessage = r);
assert_equals(msgEvent.data, 'A module script.');
assert_not_equals(firstWorker, secondWorker);
assert_equals(firstRegistration, secondRegistration);
}, 'Update the registration with a different script type (classic => module).');
......@@ -46,16 +48,17 @@ promise_test(async t => {
const script = `resources/update-registration-with-type.py?classic_first=0&key=${key}`;
const scope = 'resources/update-registration-with-type';
await service_worker_unregister(t, scope);
t.add_cleanup(() => service_worker_unregister(t, scope));
// Register with module script type.
const firstRegistration = await navigator.serviceWorker.register(script, {
scope: scope,
type: 'module'
});
firstRegistration.installing.postMessage(' ');
let msgEvent = await new Promise(resolve => {
navigator.serviceWorker.onmessage = resolve;
});
const firstWorker = firstRegistration.installing;
await wait_for_state(t, firstWorker, 'activated');
firstWorker.postMessage(' ');
let msgEvent = await new Promise(r => navigator.serviceWorker.onmessage = r);
assert_equals(msgEvent.data, 'A module script.');
// Re-register with classic script type.
......@@ -63,11 +66,12 @@ promise_test(async t => {
scope: scope,
type: 'classic'
});
secondRegistration.installing.postMessage(' ');
msgEvent = await new Promise(resolve => {
navigator.serviceWorker.onmessage = resolve;
});
const secondWorker = secondRegistration.installing;
secondWorker.postMessage(' ');
msgEvent = await new Promise(r => navigator.serviceWorker.onmessage = r);
assert_equals(msgEvent.data, 'A classic script.');
assert_not_equals(firstWorker, secondWorker);
assert_equals(firstRegistration, secondRegistration);
}, 'Update the registration with a different script type (module => classic).');
......@@ -84,18 +88,17 @@ promise_test(async t => {
scope: scope,
type: 'classic'
});
await wait_for_state(t, firstRegistration.installing, 'activated');
const firstActiveWorker = firstRegistration.active;
const firstWorker = firstRegistration.installing;
await wait_for_state(t, firstWorker, 'activated');
// Re-register with module script type.
const secondRegistration = await navigator.serviceWorker.register(script, {
scope: scope,
type: 'module'
});
await wait_for_state(t, secondRegistration.installing, 'activated');
const secondActiveWorker = secondRegistration.active;
const secondWorker = secondRegistration.installing;
assert_not_equals(firstActiveWorker, secondActiveWorker);
assert_not_equals(firstWorker, secondWorker);
assert_equals(firstRegistration, secondRegistration);
}, 'Update the registration with a different script type (classic => module) '
+ 'and with a same main script.');
......@@ -111,18 +114,17 @@ promise_test(async t => {
scope: scope,
type: 'module'
});
await wait_for_state(t, firstRegistration.installing, 'activated');
const firstActiveWorker = firstRegistration.active;
const firstWorker = firstRegistration.installing;
await wait_for_state(t, firstWorker, 'activated');
// Re-register with classic script type.
const secondRegistration = await navigator.serviceWorker.register(script, {
scope: scope,
type: 'classic'
});
await wait_for_state(t, secondRegistration.installing, 'activated');
const secondActiveWorker = secondRegistration.active;
const secondWorker = secondRegistration.installing;
assert_not_equals(firstActiveWorker, secondActiveWorker);
assert_not_equals(firstWorker, secondWorker);
assert_equals(firstRegistration, secondRegistration);
}, 'Update the registration with a different script type (module => classic) '
+ 'and with a same main script.');
......@@ -168,6 +170,7 @@ promise_test(async t => {
type: 'classic'
});
assert_not_equals(firstRegistration.installing, null);
await wait_for_state(t, firstRegistration.installing, 'activated');
// Re-register with module script type and expect TypeError.
return promise_rejects(t, new TypeError, navigator.serviceWorker.register(script, {
......@@ -192,6 +195,7 @@ promise_test(async t => {
type: 'module'
});
assert_not_equals(firstRegistration.installing, null);
await wait_for_state(t, firstRegistration.installing, 'activated');
// Re-register with classic script type and expect TypeError.
return promise_rejects(t, new TypeError, navigator.serviceWorker.register(script, {
......
This is a testharness.js-based test.
PASS Update the registration with a different script type (classic => module).
PASS Update the registration with a different script type (module => classic).
PASS Update the registration with a different script type (classic => module) and with a same main script.
PASS Update the registration with a different script type (module => classic) and with a same main script.
PASS Does not update the registration with the same script type and the same main script.
FAIL Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
FAIL Update the registration with a different script type (module => classic) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Update the registration with a different script type (classic => module).
PASS Update the registration with a different script type (module => classic).
PASS Update the registration with a different script type (classic => module) and with a same main script.
PASS Update the registration with a different script type (module => classic) and with a same main script.
PASS Does not update the registration with the same script type and the same main script.
FAIL Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
PASS Update the registration with a different script type (module => classic) and with a same main script. Expect evaluation failed.
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Update the registration with a different script type (classic => module).
PASS Update the registration with a different script type (module => classic).
PASS Update the registration with a different script type (classic => module) and with a same main script.
PASS Update the registration with a different script type (module => classic) and with a same main script.
PASS Does not update the registration with the same script type and the same main script.
FAIL Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
FAIL Update the registration with a different script type (module => classic) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Update the registration with a different script type (classic => module).
PASS Update the registration with a different script type (module => classic).
PASS Update the registration with a different script type (classic => module) and with a same main script.
PASS Update the registration with a different script type (module => classic) and with a same main script.
PASS Does not update the registration with the same script type and the same main script.
FAIL Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
PASS Update the registration with a different script type (module => classic) and with a same main script. Expect evaluation failed.
Harness: the test ran to completion.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment