Index: LayoutTests/http/tests/serviceworker/chromium/service-worker-gc.html |
diff --git a/LayoutTests/http/tests/serviceworker/chromium/service-worker-gc.html b/LayoutTests/http/tests/serviceworker/chromium/service-worker-gc.html |
index 18e09f603fb74b31cb7594bc4af669a5cb0de62f..3b3def52b9aae798c5d6305ab53821fce2c2c57a 100644 |
--- a/LayoutTests/http/tests/serviceworker/chromium/service-worker-gc.html |
+++ b/LayoutTests/http/tests/serviceworker/chromium/service-worker-gc.html |
@@ -3,6 +3,7 @@ |
<script> |
window.jsTestIsAsync = true; |
description('Test that a registered Service Worker with an event handler is not garbage collected prematurely'); |
+var registrationObservation = null; |
var swObservation = null; |
var scope = 'gc'; |
@@ -27,7 +28,14 @@ function unregisterAndRegister(url, scope) { |
}); |
} |
-function onRegister(sw) { |
+function onRegister(registration) { |
+ registrationObservation = internals.observeGC(registration); |
+ registration.addEventListener('updatefound', (function() { |
+ onUpdate(registration.installing); |
+ })); |
+} |
+ |
+function onUpdate(sw) { |
swObservation = internals.observeGC(sw); |
sw.addEventListener('statechange', onStateChange); |
} |
@@ -48,6 +56,7 @@ function unregister() { |
// The worker has an event handler that can still receive the state change |
// to 'redundant', so it shouldn't be collected yet. |
gc(); |
+ shouldBeFalse('registrationObservation.wasCollected'); |
shouldBeFalse('swObservation.wasCollected'); |
navigator.serviceWorker.unregister(scope).catch(function(error) { |
testFailed('Could not unregister worker: ' + error); |
@@ -58,7 +67,8 @@ function unregister() { |
function finish() |
{ |
gc(); |
- shouldBeTrue('swObservation.wasCollected'); |
+ shouldBeFalse('registrationObservation.wasCollected'); |
+ shouldBeFalse('swObservation.wasCollected'); |
falken
2014/08/14 10:16:36
This test has gotten pretty silly :( It really ma
nhiroki
2014/08/14 13:22:07
Acknowledged.
|
finishJSTest(); |
} |
</script> |