Bug 1217909 P10 Remove stale nsTArray when the last registering document for a scope is removed. r=catalinb a=ritu
authorBen Kelly <ben@wanderview.com>
Wed, 18 Nov 2015 13:07:42 -0800
changeset 305552 f2ea3b911f120940aa5efa0a97e200140f51bda2
parent 305551 ebc34c6eaf98308657d2b3765a7aaf92bd2ec338
child 305553 17adb01573b33188fdcf4290405dbbbf0e815e8d
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscatalinb, ritu
bugs1217909
milestone44.0a2
Bug 1217909 P10 Remove stale nsTArray when the last registering document for a scope is removed. r=catalinb a=ritu
dom/workers/ServiceWorkerManager.cpp
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -2355,16 +2355,22 @@ ServiceWorkerManager::ReportToAllClients
                                                   aFlags,
                                                   NS_LITERAL_CSTRING("Service Workers"),
                                                   doc,
                                                   uri,
                                                   aLine,
                                                   aLineNumber,
                                                   aColumnNumber);
     }
+
+    if (regList->IsEmpty()) {
+      regList = nullptr;
+      nsAutoPtr<WeakDocumentList> doomed;
+      mRegisteringDocuments.RemoveAndForget(aScope, doomed);
+    }
   }
 
   InterceptionList* intList = mNavigationInterceptions.Get(aScope);
   if (intList) {
     nsIConsoleService* consoleService = nullptr;
     for (uint32_t i = 0; i < intList->Length(); ++i) {
       nsCOMPtr<nsIInterceptedChannel> channel = intList->ElementAt(i);