Bug 1217909 P11 Only report errors to documents that are active and not in the bfcache. r=catalinb a=ritu
--- 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,