Bug 1350433 Expose WorkerPrivate::ServiceWorkerScope() instead of using WorkerName() all over the place. r=asuth

This commit is contained in:
Ben Kelly 2017-03-24 19:56:48 -04:00
Родитель 15cb86a93f
Коммит a68b3b11fd
6 изменённых файлов: 15 добавлений и 8 удалений

Просмотреть файл

@ -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");
}

Просмотреть файл

@ -691,7 +691,7 @@ WorkerFetchResolver::FlushConsoleReport()
return;
}
swm->FlushReportsToAllClients(worker->WorkerName(), mReporter);
swm->FlushReportsToAllClients(worker->ServiceWorkerScope(), mReporter);
return;
}

Просмотреть файл

@ -265,7 +265,7 @@ ServiceWorkerClient::PostMessage(JSContext* aCx, JS::Handle<JS::Value> 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<ServiceWorkerClientPostMessageRunnable> runnable =
new ServiceWorkerClientPostMessageRunnable(serviceWorkerID, scope,

Просмотреть файл

@ -833,7 +833,7 @@ public:
WaitUntilHandler(WorkerPrivate* aWorkerPrivate, JSContext* aCx)
: mWorkerPrivate(aWorkerPrivate)
, mScope(mWorkerPrivate->WorkerName())
, mScope(mWorkerPrivate->ServiceWorkerScope())
, mLine(0)
, mColumn(0)
{

Просмотреть файл

@ -538,7 +538,7 @@ private:
RefPtr<ServiceWorkerManager> 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<ServiceWorkerManager> 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);
}

Просмотреть файл

@ -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;
}