From 0bfc8665198b389ca43b45fe7a36a31c7b7d169c Mon Sep 17 00:00:00 2001 From: Catalin Badea Date: Tue, 4 Nov 2014 13:04:00 +0100 Subject: [PATCH] Bug 982726 - Patch 1.5 - Update getServiced test and fix an assert when the registration has been removed. r=baku --- dom/workers/ServiceWorkerManager.cpp | 7 +++- .../serviceworkers/sw_clients/simple.html | 9 ++++-- .../serviceworkers/test_get_serviced.html | 32 +++++++++++++++---- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index 03546c004bea..dcd16209a65f 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -2185,7 +2185,12 @@ ServiceWorkerManager::GetServicedClients(const nsCString& aScope, nsRefPtr domainInfo = GetDomainInfo(aScope); nsRefPtr registration = domainInfo->GetRegistration(aScope); - MOZ_ASSERT(registration); + + if (!registration) { + // The registration was removed, leave the array empty. + return; + } + FilterRegistrationData data(aControlledDocuments, registration); domainInfo->mControlledDocuments.EnumerateRead(EnumControlledDocuments, diff --git a/dom/workers/test/serviceworkers/sw_clients/simple.html b/dom/workers/test/serviceworkers/sw_clients/simple.html index 6b1551928d35..0267b9200adf 100644 --- a/dom/workers/test/serviceworkers/sw_clients/simple.html +++ b/dom/workers/test/serviceworkers/sw_clients/simple.html @@ -15,9 +15,14 @@

 
 
 
diff --git a/dom/workers/test/serviceworkers/test_get_serviced.html b/dom/workers/test/serviceworkers/test_get_serviced.html
index 8c47401a079d..18c0bed426a6 100644
--- a/dom/workers/test/serviceworkers/test_get_serviced.html
+++ b/dom/workers/test/serviceworkers/test_get_serviced.html
@@ -16,12 +16,25 @@