Bug 1217909 P11 Only report errors to documents that are active and not in the bfcache. r=catalinb a=ritu
authorBen Kelly <ben@wanderview.com>
Wed, 18 Nov 2015 13:07:43 -0800
changeset 305553 17adb01573b33188fdcf4290405dbbbf0e815e8d
parent 305552 f2ea3b911f120940aa5efa0a97e200140f51bda2
child 305554 b2f5153b4455aa8954e2446977195993c544b697
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 P11 Only report errors to documents that are active and not in the bfcache. r=catalinb a=ritu
dom/workers/ServiceWorkerManager.cpp
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -2312,17 +2312,17 @@ ServiceWorkerManager::ReportToAllClients
   for (auto iter = mControlledDocuments.Iter(); !iter.Done(); iter.Next()) {
     ServiceWorkerRegistrationInfo* reg = iter.UserData();
     MOZ_ASSERT(reg);
     if (!reg->mScope.Equals(aScope)) {
       continue;
     }
 
     nsCOMPtr<nsIDocument> doc = do_QueryInterface(iter.Key());
-    if (!doc || !doc->GetWindow()) {
+    if (!doc || !doc->IsCurrentActiveDocument() || !doc->GetWindow()) {
       continue;
     }
 
     windows.AppendElement(doc->InnerWindowID());
 
     nsContentUtils::ReportToConsoleNonLocalized(aMessage,
                                                 aFlags,
                                                 NS_LITERAL_CSTRING("Service Workers"),
@@ -2339,16 +2339,20 @@ ServiceWorkerManager::ReportToAllClients
   if (regList) {
     for (int32_t i = regList->Length() - 1; i >= 0; --i) {
       nsCOMPtr<nsIDocument> doc = do_QueryReferent(regList->ElementAt(i));
       if (!doc) {
         regList->RemoveElementAt(i);
         continue;
       }
 
+      if (!doc->IsCurrentActiveDocument()) {
+        continue;
+      }
+
       uint64_t innerWindowId = doc->InnerWindowID();
       if (windows.Contains(innerWindowId)) {
         continue;
       }
 
       windows.AppendElement(innerWindowId);
 
       nsContentUtils::ReportToConsoleNonLocalized(aMessage,