From c10f1ac2e6300f08de21002fa93977534bf8b15f Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 18 Mar 2015 14:16:00 +0100 Subject: [PATCH] Bug 1144876 - Stop spamming stderr with a warning every time that we encounter a document that is not controlled by a service worker; r=nsm --- dom/workers/ServiceWorkerManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index 347db83201f4..2503caac6d74 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -2361,7 +2361,10 @@ ServiceWorkerManager::IsControlled(nsIDocument* aDoc, bool* aIsControlled) MOZ_ASSERT(aIsControlled); nsRefPtr registration; nsresult rv = GetDocumentRegistration(aDoc, getter_AddRefs(registration)); - NS_ENSURE_SUCCESS(rv, rv); + if (NS_WARN_IF(NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE)) { + // It's OK to ignore the case where we don't have a registration. + return rv; + } *aIsControlled = !!registration; return NS_OK; } @@ -2372,7 +2375,7 @@ ServiceWorkerManager::GetDocumentRegistration(nsIDocument* aDoc, { nsRefPtr registration; if (!mControlledDocuments.Get(aDoc, getter_AddRefs(registration))) { - return NS_ERROR_FAILURE; + return NS_ERROR_NOT_AVAILABLE; } // If the document is controlled, the current worker MUST be non-null.