Index: LayoutTests/http/tests/serviceworker/getregistrations.html |
diff --git a/LayoutTests/http/tests/serviceworker/getregistrations.html b/LayoutTests/http/tests/serviceworker/getregistrations.html |
index 6d71f7050a461d752fcac12a06ec679ddd827056..ad9a06d208e500f235039e2a5cebea76a6067e3f 100644 |
--- a/LayoutTests/http/tests/serviceworker/getregistrations.html |
+++ b/LayoutTests/http/tests/serviceworker/getregistrations.html |
@@ -6,6 +6,20 @@ |
<script src="../resources/get-host-info.js"></script> |
<script src="../fetch/resources/fetch-test-helpers.js"></script> |
<script> |
+// Purge the existing registrations for the origin. |
+// getRegistrations() is used in order to avoid adding additional complexity |
+// e.g. adding an internal function. |
+sequential_promise_test(function(t) { |
+ return navigator.serviceWorker.getRegistrations() |
+ .then(function(registrations) { |
+ return registrations.reduce(function(sequence, registration) { |
+ return sequence.then(function() { |
+ return registration.unregister(); |
+ }); |
+ }, Promise.resolve()); |
+ }); |
+ }, 'Purge the existing registrations.'); |
+ |
sequential_promise_test(function(t) { |
return navigator.serviceWorker.getRegistrations() |
.then(function(value) { |