diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp index 151ae629d94b..5ba73c6cb8d7 100644 --- a/dom/console/Console.cpp +++ b/dom/console/Console.cpp @@ -593,7 +593,7 @@ private: innerID = NS_LITERAL_STRING("ServiceWorker"); // Use scope as ID so the webconsole can decide if the message should // show up per tab - id.AssignWithConversion(mWorkerPrivate->WorkerName()); + id.AssignWithConversion(mWorkerPrivate->ServiceWorkerScope()); } else { innerID = NS_LITERAL_STRING("Worker"); } diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index b4baf5e77503..b58dc8f0f339 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -691,7 +691,7 @@ WorkerFetchResolver::FlushConsoleReport() return; } - swm->FlushReportsToAllClients(worker->WorkerName(), mReporter); + swm->FlushReportsToAllClients(worker->ServiceWorkerScope(), mReporter); return; } diff --git a/dom/workers/ServiceWorkerClient.cpp b/dom/workers/ServiceWorkerClient.cpp index b6506ea3d487..80f7eafb5c3c 100644 --- a/dom/workers/ServiceWorkerClient.cpp +++ b/dom/workers/ServiceWorkerClient.cpp @@ -265,7 +265,7 @@ ServiceWorkerClient::PostMessage(JSContext* aCx, JS::Handle aMessage, // At the moment we only expose Client on ServiceWorker globals. MOZ_ASSERT(workerPrivate->IsServiceWorker()); uint32_t serviceWorkerID = workerPrivate->ServiceWorkerID(); - nsCString scope = workerPrivate->WorkerName(); + nsCString scope = workerPrivate->ServiceWorkerScope(); RefPtr runnable = new ServiceWorkerClientPostMessageRunnable(serviceWorkerID, scope, diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp index 6095a116d9b6..793e8e92eddd 100644 --- a/dom/workers/ServiceWorkerEvents.cpp +++ b/dom/workers/ServiceWorkerEvents.cpp @@ -833,7 +833,7 @@ public: WaitUntilHandler(WorkerPrivate* aWorkerPrivate, JSContext* aCx) : mWorkerPrivate(aWorkerPrivate) - , mScope(mWorkerPrivate->WorkerName()) + , mScope(mWorkerPrivate->ServiceWorkerScope()) , mLine(0) , mColumn(0) { diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index 9bbe5e753a55..c77f8661cc94 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -538,7 +538,7 @@ private: RefPtr swm = ServiceWorkerManager::GetInstance(); if (swm) { swm->HandleError(aCx, aWorkerPrivate->GetPrincipal(), - aWorkerPrivate->WorkerName(), + aWorkerPrivate->ServiceWorkerScope(), aWorkerPrivate->ScriptURL(), EmptyString(), EmptyString(), EmptyString(), 0, 0, JSREPORT_ERROR, JSEXN_ERR); @@ -1181,7 +1181,7 @@ private: RefPtr swm = ServiceWorkerManager::GetInstance(); if (swm) { swm->HandleError(aCx, aWorkerPrivate->GetPrincipal(), - aWorkerPrivate->WorkerName(), + aWorkerPrivate->ServiceWorkerScope(), aWorkerPrivate->ScriptURL(), mReport.mMessage, mReport.mFilename, mReport.mLine, mReport.mLineNumber, @@ -6907,7 +6907,7 @@ WorkerPrivate::GetOrCreateGlobalScope(JSContext* aCx) if (IsSharedWorker()) { globalScope = new SharedWorkerGlobalScope(this, WorkerName()); } else if (IsServiceWorker()) { - globalScope = new ServiceWorkerGlobalScope(this, WorkerName()); + globalScope = new ServiceWorkerGlobalScope(this, ServiceWorkerScope()); } else { globalScope = new DedicatedWorkerGlobalScope(this); } diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index 5e243ec1057c..66ae059fa463 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -526,6 +526,13 @@ public: return mLoadInfo.mServiceWorkerID; } + const nsCString& + ServiceWorkerScope() const + { + MOZ_DIAGNOSTIC_ASSERT(IsServiceWorker()); + return mWorkerName; + } + nsIURI* GetBaseURI() const { @@ -835,7 +842,7 @@ public: const nsCString& WorkerName() const { - MOZ_ASSERT(IsServiceWorker() || IsSharedWorker()); + MOZ_ASSERT(IsSharedWorker()); return mWorkerName; }