зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1256428 P17 Rename service worker job classes to remove "2" suffix. r=jdm
This commit is contained in:
Родитель
2fc57fa286
Коммит
807cba86ca
|
@ -14,32 +14,32 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
ServiceWorkerJob2::Type
|
||||
ServiceWorkerJob2::GetType() const
|
||||
ServiceWorkerJob::Type
|
||||
ServiceWorkerJob::GetType() const
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
ServiceWorkerJob2::State
|
||||
ServiceWorkerJob2::GetState() const
|
||||
ServiceWorkerJob::State
|
||||
ServiceWorkerJob::GetState() const
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
|
||||
bool
|
||||
ServiceWorkerJob2::Canceled() const
|
||||
ServiceWorkerJob::Canceled() const
|
||||
{
|
||||
return mCanceled;
|
||||
}
|
||||
|
||||
bool
|
||||
ServiceWorkerJob2::ResultCallbacksInvoked() const
|
||||
ServiceWorkerJob::ResultCallbacksInvoked() const
|
||||
{
|
||||
return mResultCallbacksInvoked;
|
||||
}
|
||||
|
||||
bool
|
||||
ServiceWorkerJob2::IsEquivalentTo(ServiceWorkerJob2* aJob) const
|
||||
ServiceWorkerJob::IsEquivalentTo(ServiceWorkerJob* aJob) const
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -50,7 +50,7 @@ ServiceWorkerJob2::IsEquivalentTo(ServiceWorkerJob2* aJob) const
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::AppendResultCallback(Callback* aCallback)
|
||||
ServiceWorkerJob::AppendResultCallback(Callback* aCallback)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(mState != State::Finished);
|
||||
|
@ -62,7 +62,7 @@ ServiceWorkerJob2::AppendResultCallback(Callback* aCallback)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::StealResultCallbacksFrom(ServiceWorkerJob2* aJob)
|
||||
ServiceWorkerJob::StealResultCallbacksFrom(ServiceWorkerJob* aJob)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -81,7 +81,7 @@ ServiceWorkerJob2::StealResultCallbacksFrom(ServiceWorkerJob2* aJob)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::Start(Callback* aFinalCallback)
|
||||
ServiceWorkerJob::Start(Callback* aFinalCallback)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(!mCanceled);
|
||||
|
@ -95,7 +95,7 @@ ServiceWorkerJob2::Start(Callback* aFinalCallback)
|
|||
mState = State::Started;
|
||||
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
NS_NewRunnableMethod(this, &ServiceWorkerJob2::AsyncExecute);
|
||||
NS_NewRunnableMethod(this, &ServiceWorkerJob::AsyncExecute);
|
||||
|
||||
// We may have to wait for the PBackground actor to be initialized
|
||||
// before proceeding. We should always be able to get a ServiceWorkerManager,
|
||||
|
@ -112,17 +112,17 @@ ServiceWorkerJob2::Start(Callback* aFinalCallback)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::Cancel()
|
||||
ServiceWorkerJob::Cancel()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(!mCanceled);
|
||||
mCanceled = true;
|
||||
}
|
||||
|
||||
ServiceWorkerJob2::ServiceWorkerJob2(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec)
|
||||
ServiceWorkerJob::ServiceWorkerJob(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec)
|
||||
: mType(aType)
|
||||
, mPrincipal(aPrincipal)
|
||||
, mScope(aScope)
|
||||
|
@ -137,7 +137,7 @@ ServiceWorkerJob2::ServiceWorkerJob2(Type aType,
|
|||
// Some job types may have an empty script spec
|
||||
}
|
||||
|
||||
ServiceWorkerJob2::~ServiceWorkerJob2()
|
||||
ServiceWorkerJob::~ServiceWorkerJob()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
// Jobs must finish or never be started. Destroying an actively running
|
||||
|
@ -147,7 +147,7 @@ ServiceWorkerJob2::~ServiceWorkerJob2()
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::InvokeResultCallbacks(ErrorResult& aRv)
|
||||
ServiceWorkerJob::InvokeResultCallbacks(ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(mState == State::Started);
|
||||
|
@ -172,14 +172,14 @@ ServiceWorkerJob2::InvokeResultCallbacks(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::InvokeResultCallbacks(nsresult aRv)
|
||||
ServiceWorkerJob::InvokeResultCallbacks(nsresult aRv)
|
||||
{
|
||||
ErrorResult converted(aRv);
|
||||
InvokeResultCallbacks(converted);
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::Finish(ErrorResult& aRv)
|
||||
ServiceWorkerJob::Finish(ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(mState == State::Started);
|
||||
|
@ -200,7 +200,7 @@ ServiceWorkerJob2::Finish(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
// The final callback may drop the last ref to this object.
|
||||
RefPtr<ServiceWorkerJob2> kungFuDeathGrip = this;
|
||||
RefPtr<ServiceWorkerJob> kungFuDeathGrip = this;
|
||||
|
||||
if (!mResultCallbacksInvoked) {
|
||||
InvokeResultCallbacks(aRv);
|
||||
|
@ -220,7 +220,7 @@ ServiceWorkerJob2::Finish(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJob2::Finish(nsresult aRv)
|
||||
ServiceWorkerJob::Finish(nsresult aRv)
|
||||
{
|
||||
ErrorResult converted(aRv);
|
||||
Finish(converted);
|
||||
|
|
|
@ -20,7 +20,7 @@ class ErrorResult;
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
class ServiceWorkerJob2
|
||||
class ServiceWorkerJob
|
||||
{
|
||||
public:
|
||||
// Implement this interface to receive notification when a job completes.
|
||||
|
@ -31,7 +31,7 @@ public:
|
|||
// will be called. If a job is never executed due to browser shutdown,
|
||||
// then this method will never be called. This method is always called
|
||||
// on the main thread asynchronously after Start() completes.
|
||||
virtual void JobFinished(ServiceWorkerJob2* aJob, ErrorResult& aStatus) = 0;
|
||||
virtual void JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) = 0;
|
||||
|
||||
NS_IMETHOD_(MozExternalRefCountType)
|
||||
AddRef(void) = 0;
|
||||
|
@ -72,7 +72,7 @@ public:
|
|||
ResultCallbacksInvoked() const;
|
||||
|
||||
bool
|
||||
IsEquivalentTo(ServiceWorkerJob2* aJob) const;
|
||||
IsEquivalentTo(ServiceWorkerJob* aJob) const;
|
||||
|
||||
// Add a callback that will be invoked when the job's result is available.
|
||||
// Some job types will invoke this before the job is actually finished.
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
// This takes ownership of any result callbacks associated with the given job
|
||||
// and then appends them to this job's callback list.
|
||||
void
|
||||
StealResultCallbacksFrom(ServiceWorkerJob2* aJob);
|
||||
StealResultCallbacksFrom(ServiceWorkerJob* aJob);
|
||||
|
||||
// Start the job. All work will be performed asynchronously on
|
||||
// the main thread. The Finish() method must be called exactly
|
||||
|
@ -100,12 +100,12 @@ public:
|
|||
Cancel();
|
||||
|
||||
protected:
|
||||
ServiceWorkerJob2(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec);
|
||||
ServiceWorkerJob(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec);
|
||||
|
||||
virtual ~ServiceWorkerJob2();
|
||||
virtual ~ServiceWorkerJob();
|
||||
|
||||
// Invoke the result callbacks immediately. The job must be in the
|
||||
// Started state. The callbacks are cleared after being invoked,
|
||||
|
@ -145,7 +145,7 @@ private:
|
|||
bool mResultCallbacksInvoked;
|
||||
|
||||
public:
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJob2)
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJob)
|
||||
};
|
||||
|
||||
} // namespace workers
|
||||
|
|
|
@ -13,16 +13,16 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
class ServiceWorkerJobQueue2::Callback final : public ServiceWorkerJob2::Callback
|
||||
class ServiceWorkerJobQueue::Callback final : public ServiceWorkerJob::Callback
|
||||
{
|
||||
RefPtr<ServiceWorkerJobQueue2> mQueue;
|
||||
RefPtr<ServiceWorkerJobQueue> mQueue;
|
||||
|
||||
~Callback()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
explicit Callback(ServiceWorkerJobQueue2* aQueue)
|
||||
explicit Callback(ServiceWorkerJobQueue* aQueue)
|
||||
: mQueue(aQueue)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
@ -30,23 +30,23 @@ public:
|
|||
}
|
||||
|
||||
virtual void
|
||||
JobFinished(ServiceWorkerJob2* aJob, ErrorResult& aStatus) override
|
||||
JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) override
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
mQueue->JobFinished(aJob);
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJobQueue2::Callback, override)
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJobQueue::Callback, override)
|
||||
};
|
||||
|
||||
ServiceWorkerJobQueue2::~ServiceWorkerJobQueue2()
|
||||
ServiceWorkerJobQueue::~ServiceWorkerJobQueue()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(mJobList.IsEmpty());
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJobQueue2::JobFinished(ServiceWorkerJob2* aJob)
|
||||
ServiceWorkerJobQueue::JobFinished(ServiceWorkerJob* aJob)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -72,23 +72,23 @@ ServiceWorkerJobQueue2::JobFinished(ServiceWorkerJob2* aJob)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJobQueue2::RunJob()
|
||||
ServiceWorkerJobQueue::RunJob()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(!mJobList.IsEmpty());
|
||||
MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob2::State::Initial);
|
||||
MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob::State::Initial);
|
||||
|
||||
RefPtr<Callback> callback = new Callback(this);
|
||||
mJobList[0]->Start(callback);
|
||||
}
|
||||
|
||||
ServiceWorkerJobQueue2::ServiceWorkerJobQueue2()
|
||||
ServiceWorkerJobQueue::ServiceWorkerJobQueue()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJobQueue2::ScheduleJob(ServiceWorkerJob2* aJob)
|
||||
ServiceWorkerJobQueue::ScheduleJob(ServiceWorkerJob* aJob)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -100,9 +100,9 @@ ServiceWorkerJobQueue2::ScheduleJob(ServiceWorkerJob2* aJob)
|
|||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob2::State::Started);
|
||||
MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob::State::Started);
|
||||
|
||||
RefPtr<ServiceWorkerJob2>& tailJob = mJobList[mJobList.Length() - 1];
|
||||
RefPtr<ServiceWorkerJob>& tailJob = mJobList[mJobList.Length() - 1];
|
||||
if (!tailJob->ResultCallbacksInvoked() && aJob->IsEquivalentTo(tailJob)) {
|
||||
tailJob->StealResultCallbacksFrom(aJob);
|
||||
return;
|
||||
|
@ -112,11 +112,11 @@ ServiceWorkerJobQueue2::ScheduleJob(ServiceWorkerJob2* aJob)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerJobQueue2::CancelAll()
|
||||
ServiceWorkerJobQueue::CancelAll()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
for (RefPtr<ServiceWorkerJob2>& job : mJobList) {
|
||||
for (RefPtr<ServiceWorkerJob>& job : mJobList) {
|
||||
job->Cancel();
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ ServiceWorkerJobQueue2::CancelAll()
|
|||
// run after being canceled. This means throwing away all jobs except
|
||||
// for the job at the front of the list.
|
||||
if (!mJobList.IsEmpty()) {
|
||||
MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob2::State::Started);
|
||||
MOZ_ASSERT(mJobList[0]->GetState() == ServiceWorkerJob::State::Started);
|
||||
mJobList.TruncateLength(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,32 +14,32 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
class ServiceWorkerJob2;
|
||||
class ServiceWorkerJob;
|
||||
|
||||
class ServiceWorkerJobQueue2 final
|
||||
class ServiceWorkerJobQueue final
|
||||
{
|
||||
class Callback;
|
||||
|
||||
nsTArray<RefPtr<ServiceWorkerJob2>> mJobList;
|
||||
nsTArray<RefPtr<ServiceWorkerJob>> mJobList;
|
||||
|
||||
~ServiceWorkerJobQueue2();
|
||||
~ServiceWorkerJobQueue();
|
||||
|
||||
void
|
||||
JobFinished(ServiceWorkerJob2* aJob);
|
||||
JobFinished(ServiceWorkerJob* aJob);
|
||||
|
||||
void
|
||||
RunJob();
|
||||
|
||||
public:
|
||||
ServiceWorkerJobQueue2();
|
||||
ServiceWorkerJobQueue();
|
||||
|
||||
void
|
||||
ScheduleJob(ServiceWorkerJob2* aJob);
|
||||
ScheduleJob(ServiceWorkerJob* aJob);
|
||||
|
||||
void
|
||||
CancelAll();
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJobQueue2)
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerJobQueue)
|
||||
};
|
||||
|
||||
} // namespace workers
|
||||
|
|
|
@ -149,7 +149,7 @@ struct ServiceWorkerManager::RegistrationDataPerPrincipal final
|
|||
nsRefPtrHashtable<nsCStringHashKey, ServiceWorkerRegistrationInfo> mInfos;
|
||||
|
||||
// Maps scopes to job queues.
|
||||
nsRefPtrHashtable<nsCStringHashKey, ServiceWorkerJobQueue2> mJobQueues;
|
||||
nsRefPtrHashtable<nsCStringHashKey, ServiceWorkerJobQueue> mJobQueues;
|
||||
|
||||
// Map scopes to scheduled update timers.
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsITimer> mUpdateTimers;
|
||||
|
@ -475,7 +475,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class ServiceWorkerResolveWindowPromiseOnRegisterCallback final : public ServiceWorkerJob2::Callback
|
||||
class ServiceWorkerResolveWindowPromiseOnRegisterCallback final : public ServiceWorkerJob::Callback
|
||||
{
|
||||
RefPtr<nsPIDOMWindowInner> mWindow;
|
||||
// The promise "returned" by the call to Update up to
|
||||
|
@ -486,7 +486,7 @@ class ServiceWorkerResolveWindowPromiseOnRegisterCallback final : public Service
|
|||
{}
|
||||
|
||||
virtual void
|
||||
JobFinished(ServiceWorkerJob2* aJob, ErrorResult& aStatus) override
|
||||
JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus) override
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -496,9 +496,9 @@ class ServiceWorkerResolveWindowPromiseOnRegisterCallback final : public Service
|
|||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob2::Type::Register);
|
||||
RefPtr<ServiceWorkerRegisterJob2> registerJob =
|
||||
static_cast<ServiceWorkerRegisterJob2*>(aJob);
|
||||
MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob::Type::Register);
|
||||
RefPtr<ServiceWorkerRegisterJob> registerJob =
|
||||
static_cast<ServiceWorkerRegisterJob*>(aJob);
|
||||
RefPtr<ServiceWorkerRegistrationInfo> reg = registerJob->GetRegistration();
|
||||
|
||||
RefPtr<ServiceWorkerRegistrationMainThread> swr =
|
||||
|
@ -868,8 +868,8 @@ ServiceWorkerManager::Register(mozIDOMWindow* aWindow,
|
|||
|
||||
AddRegisteringDocument(cleanedScope, doc);
|
||||
|
||||
RefPtr<ServiceWorkerJobQueue2> queue = GetOrCreateJobQueue(scopeKey,
|
||||
cleanedScope);
|
||||
RefPtr<ServiceWorkerJobQueue> queue = GetOrCreateJobQueue(scopeKey,
|
||||
cleanedScope);
|
||||
|
||||
RefPtr<ServiceWorkerResolveWindowPromiseOnRegisterCallback> cb =
|
||||
new ServiceWorkerResolveWindowPromiseOnRegisterCallback(window, promise);
|
||||
|
@ -885,9 +885,9 @@ ServiceWorkerManager::Register(mozIDOMWindow* aWindow,
|
|||
nsCOMPtr<nsILoadGroup> loadGroup = do_CreateInstance(NS_LOADGROUP_CONTRACTID);
|
||||
MOZ_ALWAYS_SUCCEEDS(loadGroup->SetNotificationCallbacks(ir));
|
||||
|
||||
RefPtr<ServiceWorkerRegisterJob2> job =
|
||||
new ServiceWorkerRegisterJob2(documentPrincipal, cleanedScope, spec,
|
||||
loadGroup);
|
||||
RefPtr<ServiceWorkerRegisterJob> job =
|
||||
new ServiceWorkerRegisterJob(documentPrincipal, cleanedScope, spec,
|
||||
loadGroup);
|
||||
job->AppendResultCallback(cb);
|
||||
queue->ScheduleJob(job);
|
||||
|
||||
|
@ -1491,7 +1491,7 @@ ServiceWorkerManager::GetActiveWorkerInfoForDocument(nsIDocument* aDocument)
|
|||
|
||||
namespace {
|
||||
|
||||
class UnregisterJobCallback final : public ServiceWorkerJob2::Callback
|
||||
class UnregisterJobCallback final : public ServiceWorkerJob::Callback
|
||||
{
|
||||
nsCOMPtr<nsIServiceWorkerUnregisterCallback> mCallback;
|
||||
|
||||
|
@ -1508,7 +1508,7 @@ public:
|
|||
}
|
||||
|
||||
void
|
||||
JobFinished(ServiceWorkerJob2* aJob, ErrorResult& aStatus)
|
||||
JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -1518,9 +1518,9 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob2::Type::Unregister);
|
||||
RefPtr<ServiceWorkerUnregisterJob2> unregisterJob =
|
||||
static_cast<ServiceWorkerUnregisterJob2*>(aJob);
|
||||
MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob::Type::Unregister);
|
||||
RefPtr<ServiceWorkerUnregisterJob> unregisterJob =
|
||||
static_cast<ServiceWorkerUnregisterJob*>(aJob);
|
||||
mCallback->UnregisterSucceeded(unregisterJob->GetResult());
|
||||
}
|
||||
|
||||
|
@ -1559,10 +1559,10 @@ ServiceWorkerManager::Unregister(nsIPrincipal* aPrincipal,
|
|||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 scope(aScope);
|
||||
RefPtr<ServiceWorkerJobQueue2> queue = GetOrCreateJobQueue(scopeKey, scope);
|
||||
RefPtr<ServiceWorkerJobQueue> queue = GetOrCreateJobQueue(scopeKey, scope);
|
||||
|
||||
RefPtr<ServiceWorkerUnregisterJob2> job =
|
||||
new ServiceWorkerUnregisterJob2(aPrincipal, scope, true /* send to parent */);
|
||||
RefPtr<ServiceWorkerUnregisterJob> job =
|
||||
new ServiceWorkerUnregisterJob(aPrincipal, scope, true /* send to parent */);
|
||||
|
||||
if (aCallback) {
|
||||
RefPtr<UnregisterJobCallback> cb = new UnregisterJobCallback(aCallback);
|
||||
|
@ -1599,17 +1599,17 @@ ServiceWorkerManager::NotifyUnregister(nsIPrincipal* aPrincipal,
|
|||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 scope(aScope);
|
||||
RefPtr<ServiceWorkerJobQueue2> queue = GetOrCreateJobQueue(scopeKey, scope);
|
||||
RefPtr<ServiceWorkerJobQueue> queue = GetOrCreateJobQueue(scopeKey, scope);
|
||||
|
||||
RefPtr<ServiceWorkerUnregisterJob2> job =
|
||||
new ServiceWorkerUnregisterJob2(aPrincipal, scope,
|
||||
RefPtr<ServiceWorkerUnregisterJob> job =
|
||||
new ServiceWorkerUnregisterJob(aPrincipal, scope,
|
||||
false /* send to parent */);
|
||||
|
||||
queue->ScheduleJob(job);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<ServiceWorkerJobQueue2>
|
||||
already_AddRefed<ServiceWorkerJobQueue>
|
||||
ServiceWorkerManager::GetOrCreateJobQueue(const nsACString& aKey,
|
||||
const nsACString& aScope)
|
||||
{
|
||||
|
@ -1620,9 +1620,9 @@ ServiceWorkerManager::GetOrCreateJobQueue(const nsACString& aKey,
|
|||
mRegistrationInfos.Put(aKey, data);
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerJobQueue2> queue;
|
||||
RefPtr<ServiceWorkerJobQueue> queue;
|
||||
if (!data->mJobQueues.Get(aScope, getter_AddRefs(queue))) {
|
||||
RefPtr<ServiceWorkerJobQueue2> newQueue = new ServiceWorkerJobQueue2();
|
||||
RefPtr<ServiceWorkerJobQueue> newQueue = new ServiceWorkerJobQueue();
|
||||
queue = newQueue;
|
||||
data->mJobQueues.Put(aScope, newQueue.forget());
|
||||
}
|
||||
|
@ -2897,18 +2897,18 @@ ServiceWorkerManager::SoftUpdate(const PrincipalOriginAttributes& aOriginAttribu
|
|||
// or its equivalent, with client, registration as its argument."
|
||||
// TODO(catalinb): We don't implement the force bypass cache flag.
|
||||
// See: https://github.com/slightlyoff/ServiceWorker/issues/759
|
||||
RefPtr<ServiceWorkerJobQueue2> queue = GetOrCreateJobQueue(scopeKey,
|
||||
aScope);
|
||||
RefPtr<ServiceWorkerJobQueue> queue = GetOrCreateJobQueue(scopeKey,
|
||||
aScope);
|
||||
|
||||
RefPtr<ServiceWorkerUpdateJob2> job =
|
||||
new ServiceWorkerUpdateJob2(principal, registration->mScope,
|
||||
newest->ScriptSpec(), nullptr);
|
||||
RefPtr<ServiceWorkerUpdateJob> job =
|
||||
new ServiceWorkerUpdateJob(principal, registration->mScope,
|
||||
newest->ScriptSpec(), nullptr);
|
||||
queue->ScheduleJob(job);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class UpdateJobCallback final : public ServiceWorkerJob2::Callback
|
||||
class UpdateJobCallback final : public ServiceWorkerJob::Callback
|
||||
{
|
||||
RefPtr<ServiceWorkerUpdateFinishCallback> mCallback;
|
||||
|
||||
|
@ -2925,7 +2925,7 @@ public:
|
|||
}
|
||||
|
||||
void
|
||||
JobFinished(ServiceWorkerJob2* aJob, ErrorResult& aStatus)
|
||||
JobFinished(ServiceWorkerJob* aJob, ErrorResult& aStatus)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aJob);
|
||||
|
@ -2935,9 +2935,9 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob2::Type::Update);
|
||||
RefPtr<ServiceWorkerUpdateJob2> updateJob =
|
||||
static_cast<ServiceWorkerUpdateJob2*>(aJob);
|
||||
MOZ_ASSERT(aJob->GetType() == ServiceWorkerJob::Type::Update);
|
||||
RefPtr<ServiceWorkerUpdateJob> updateJob =
|
||||
static_cast<ServiceWorkerUpdateJob*>(aJob);
|
||||
RefPtr<ServiceWorkerRegistrationInfo> reg = updateJob->GetRegistration();
|
||||
mCallback->UpdateSucceeded(reg);
|
||||
}
|
||||
|
@ -2980,13 +2980,13 @@ ServiceWorkerManager::Update(nsIPrincipal* aPrincipal,
|
|||
return;
|
||||
}
|
||||
|
||||
RefPtr<ServiceWorkerJobQueue2> queue = GetOrCreateJobQueue(scopeKey, aScope);
|
||||
RefPtr<ServiceWorkerJobQueue> queue = GetOrCreateJobQueue(scopeKey, aScope);
|
||||
|
||||
// "Invoke Update algorithm, or its equivalent, with client, registration as
|
||||
// its argument."
|
||||
RefPtr<ServiceWorkerUpdateJob2> job =
|
||||
new ServiceWorkerUpdateJob2(aPrincipal, registration->mScope,
|
||||
newest->ScriptSpec(), nullptr);
|
||||
RefPtr<ServiceWorkerUpdateJob> job =
|
||||
new ServiceWorkerUpdateJob(aPrincipal, registration->mScope,
|
||||
newest->ScriptSpec(), nullptr);
|
||||
|
||||
RefPtr<UpdateJobCallback> cb = new UpdateJobCallback(aCallback);
|
||||
job->AppendResultCallback(cb);
|
||||
|
@ -3441,7 +3441,7 @@ ServiceWorkerManager::ForceUnregister(RegistrationDataPerPrincipal* aRegistratio
|
|||
MOZ_ASSERT(aRegistrationData);
|
||||
MOZ_ASSERT(aRegistration);
|
||||
|
||||
RefPtr<ServiceWorkerJobQueue2> queue;
|
||||
RefPtr<ServiceWorkerJobQueue> queue;
|
||||
aRegistrationData->mJobQueues.Get(aRegistration->mScope, getter_AddRefs(queue));
|
||||
if (queue) {
|
||||
queue->CancelAll();
|
||||
|
@ -3756,7 +3756,7 @@ ServiceWorkerManager::Observe(nsISupports* aSubject,
|
|||
it1.UserData()->mUpdateTimers.Clear();
|
||||
|
||||
for (auto it2 = it1.UserData()->mJobQueues.Iter(); !it2.Done(); it2.Next()) {
|
||||
RefPtr<ServiceWorkerJobQueue2> queue = it2.UserData();
|
||||
RefPtr<ServiceWorkerJobQueue> queue = it2.UserData();
|
||||
queue->CancelAll();
|
||||
}
|
||||
it1.UserData()->mJobQueues.Clear();
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace workers {
|
|||
class ServiceWorker;
|
||||
class ServiceWorkerClientInfo;
|
||||
class ServiceWorkerInfo;
|
||||
class ServiceWorkerJobQueue2;
|
||||
class ServiceWorkerJobQueue;
|
||||
class ServiceWorkerManagerChild;
|
||||
class ServiceWorkerPrivate;
|
||||
|
||||
|
@ -320,10 +320,10 @@ class ServiceWorkerManager final
|
|||
friend class GetReadyPromiseRunnable;
|
||||
friend class GetRegistrationsRunnable;
|
||||
friend class GetRegistrationRunnable;
|
||||
friend class ServiceWorkerJob2;
|
||||
friend class ServiceWorkerJob;
|
||||
friend class ServiceWorkerRegistrationInfo;
|
||||
friend class ServiceWorkerUnregisterJob2;
|
||||
friend class ServiceWorkerUpdateJob2;
|
||||
friend class ServiceWorkerUnregisterJob;
|
||||
friend class ServiceWorkerUpdateJob;
|
||||
friend class UpdateTimerCallback;
|
||||
|
||||
public:
|
||||
|
@ -502,7 +502,7 @@ private:
|
|||
void
|
||||
Init();
|
||||
|
||||
already_AddRefed<ServiceWorkerJobQueue2>
|
||||
already_AddRefed<ServiceWorkerJobQueue>
|
||||
GetOrCreateJobQueue(const nsACString& aOriginSuffix,
|
||||
const nsACString& aScope);
|
||||
|
||||
|
|
|
@ -12,17 +12,17 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
ServiceWorkerRegisterJob2::ServiceWorkerRegisterJob2(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
: ServiceWorkerUpdateJob2(ServiceWorkerJob2::Type::Register,
|
||||
aPrincipal, aScope, aScriptSpec, aLoadGroup)
|
||||
ServiceWorkerRegisterJob::ServiceWorkerRegisterJob(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
: ServiceWorkerUpdateJob(Type::Register, aPrincipal, aScope, aScriptSpec,
|
||||
aLoadGroup)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerRegisterJob2::AsyncExecute()
|
||||
ServiceWorkerRegisterJob::AsyncExecute()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -58,7 +58,7 @@ ServiceWorkerRegisterJob2::AsyncExecute()
|
|||
Update();
|
||||
}
|
||||
|
||||
ServiceWorkerRegisterJob2::~ServiceWorkerRegisterJob2()
|
||||
ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -14,15 +14,15 @@ namespace dom {
|
|||
namespace workers {
|
||||
|
||||
// The register job. This implements the steps in the spec Register algorithm,
|
||||
// but then uses ServiceWorkerUpdateJob2 to implement the Update and Install
|
||||
// but then uses ServiceWorkerUpdateJob to implement the Update and Install
|
||||
// spec algorithms.
|
||||
class ServiceWorkerRegisterJob2 final : public ServiceWorkerUpdateJob2
|
||||
class ServiceWorkerRegisterJob final : public ServiceWorkerUpdateJob
|
||||
{
|
||||
public:
|
||||
ServiceWorkerRegisterJob2(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
ServiceWorkerRegisterJob(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
|
||||
private:
|
||||
// Implement the Register algorithm steps and then call the parent class
|
||||
|
@ -30,7 +30,7 @@ private:
|
|||
virtual void
|
||||
AsyncExecute() override;
|
||||
|
||||
virtual ~ServiceWorkerRegisterJob2();
|
||||
virtual ~ServiceWorkerRegisterJob();
|
||||
};
|
||||
|
||||
} // namespace workers
|
||||
|
|
|
@ -11,27 +11,27 @@ namespace dom {
|
|||
namespace workers {
|
||||
|
||||
|
||||
ServiceWorkerUnregisterJob2::ServiceWorkerUnregisterJob2(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
bool aSendToParent)
|
||||
: ServiceWorkerJob2(Type::Unregister, aPrincipal, aScope, EmptyCString())
|
||||
ServiceWorkerUnregisterJob::ServiceWorkerUnregisterJob(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
bool aSendToParent)
|
||||
: ServiceWorkerJob(Type::Unregister, aPrincipal, aScope, EmptyCString())
|
||||
, mResult(false)
|
||||
, mSendToParent(aSendToParent)
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ServiceWorkerUnregisterJob2::GetResult() const
|
||||
ServiceWorkerUnregisterJob::GetResult() const
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
return mResult;
|
||||
}
|
||||
ServiceWorkerUnregisterJob2::~ServiceWorkerUnregisterJob2()
|
||||
ServiceWorkerUnregisterJob::~ServiceWorkerUnregisterJob()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUnregisterJob2::AsyncExecute()
|
||||
ServiceWorkerUnregisterJob::AsyncExecute()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
|
|
@ -13,18 +13,18 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
class ServiceWorkerUnregisterJob2 final : public ServiceWorkerJob2
|
||||
class ServiceWorkerUnregisterJob final : public ServiceWorkerJob
|
||||
{
|
||||
public:
|
||||
ServiceWorkerUnregisterJob2(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
bool aSendToParent);
|
||||
ServiceWorkerUnregisterJob(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
bool aSendToParent);
|
||||
|
||||
bool
|
||||
GetResult() const;
|
||||
|
||||
private:
|
||||
virtual ~ServiceWorkerUnregisterJob2();
|
||||
virtual ~ServiceWorkerUnregisterJob();
|
||||
|
||||
virtual void
|
||||
AsyncExecute() override;
|
||||
|
|
|
@ -13,16 +13,16 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
namespace workers {
|
||||
|
||||
class ServiceWorkerUpdateJob2::CompareCallback final : public serviceWorkerScriptCache::CompareCallback
|
||||
class ServiceWorkerUpdateJob::CompareCallback final : public serviceWorkerScriptCache::CompareCallback
|
||||
{
|
||||
RefPtr<ServiceWorkerUpdateJob2> mJob;
|
||||
RefPtr<ServiceWorkerUpdateJob> mJob;
|
||||
|
||||
~CompareCallback()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
explicit CompareCallback(ServiceWorkerUpdateJob2* aJob)
|
||||
explicit CompareCallback(ServiceWorkerUpdateJob* aJob)
|
||||
: mJob(aJob)
|
||||
{
|
||||
MOZ_ASSERT(mJob);
|
||||
|
@ -37,16 +37,16 @@ public:
|
|||
mJob->ComparisonResult(aStatus, aInCacheAndEqual, aNewCacheName, aMaxScope);
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerUpdateJob2::CompareCallback, override)
|
||||
NS_INLINE_DECL_REFCOUNTING(ServiceWorkerUpdateJob::CompareCallback, override)
|
||||
};
|
||||
|
||||
class ServiceWorkerUpdateJob2::ContinueUpdateRunnable final : public LifeCycleEventCallback
|
||||
class ServiceWorkerUpdateJob::ContinueUpdateRunnable final : public LifeCycleEventCallback
|
||||
{
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob2> mJob;
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob> mJob;
|
||||
bool mSuccess;
|
||||
|
||||
public:
|
||||
explicit ContinueUpdateRunnable(const nsMainThreadPtrHandle<ServiceWorkerUpdateJob2>& aJob)
|
||||
explicit ContinueUpdateRunnable(const nsMainThreadPtrHandle<ServiceWorkerUpdateJob>& aJob)
|
||||
: mJob(aJob)
|
||||
, mSuccess(false)
|
||||
{
|
||||
|
@ -69,13 +69,13 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class ServiceWorkerUpdateJob2::ContinueInstallRunnable final : public LifeCycleEventCallback
|
||||
class ServiceWorkerUpdateJob::ContinueInstallRunnable final : public LifeCycleEventCallback
|
||||
{
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob2> mJob;
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob> mJob;
|
||||
bool mSuccess;
|
||||
|
||||
public:
|
||||
explicit ContinueInstallRunnable(const nsMainThreadPtrHandle<ServiceWorkerUpdateJob2>& aJob)
|
||||
explicit ContinueInstallRunnable(const nsMainThreadPtrHandle<ServiceWorkerUpdateJob>& aJob)
|
||||
: mJob(aJob)
|
||||
, mSuccess(false)
|
||||
{
|
||||
|
@ -98,39 +98,39 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
ServiceWorkerUpdateJob2::ServiceWorkerUpdateJob2(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
: ServiceWorkerJob2(Type::Update, aPrincipal, aScope, aScriptSpec)
|
||||
ServiceWorkerUpdateJob::ServiceWorkerUpdateJob(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
: ServiceWorkerJob(Type::Update, aPrincipal, aScope, aScriptSpec)
|
||||
, mLoadGroup(aLoadGroup)
|
||||
{
|
||||
}
|
||||
|
||||
already_AddRefed<ServiceWorkerRegistrationInfo>
|
||||
ServiceWorkerUpdateJob2::GetRegistration() const
|
||||
ServiceWorkerUpdateJob::GetRegistration() const
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
RefPtr<ServiceWorkerRegistrationInfo> ref = mRegistration;
|
||||
return ref.forget();
|
||||
}
|
||||
|
||||
ServiceWorkerUpdateJob2::ServiceWorkerUpdateJob2(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
: ServiceWorkerJob2(aType, aPrincipal, aScope, aScriptSpec)
|
||||
ServiceWorkerUpdateJob::ServiceWorkerUpdateJob(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup)
|
||||
: ServiceWorkerJob(aType, aPrincipal, aScope, aScriptSpec)
|
||||
, mLoadGroup(aLoadGroup)
|
||||
{
|
||||
}
|
||||
|
||||
ServiceWorkerUpdateJob2::~ServiceWorkerUpdateJob2()
|
||||
ServiceWorkerUpdateJob::~ServiceWorkerUpdateJob()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::FailUpdateJob(ErrorResult& aRv)
|
||||
ServiceWorkerUpdateJob::FailUpdateJob(ErrorResult& aRv)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(aRv.Failed());
|
||||
|
@ -167,14 +167,14 @@ ServiceWorkerUpdateJob2::FailUpdateJob(ErrorResult& aRv)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::FailUpdateJob(nsresult aRv)
|
||||
ServiceWorkerUpdateJob::FailUpdateJob(nsresult aRv)
|
||||
{
|
||||
ErrorResult rv(aRv);
|
||||
FailUpdateJob(rv);
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::AsyncExecute()
|
||||
ServiceWorkerUpdateJob::AsyncExecute()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
MOZ_ASSERT(GetType() == Type::Update);
|
||||
|
@ -212,7 +212,7 @@ ServiceWorkerUpdateJob2::AsyncExecute()
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::SetRegistration(ServiceWorkerRegistrationInfo* aRegistration)
|
||||
ServiceWorkerUpdateJob::SetRegistration(ServiceWorkerRegistrationInfo* aRegistration)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -222,7 +222,7 @@ ServiceWorkerUpdateJob2::SetRegistration(ServiceWorkerRegistrationInfo* aRegistr
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::Update()
|
||||
ServiceWorkerUpdateJob::Update()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -258,10 +258,10 @@ ServiceWorkerUpdateJob2::Update()
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::ComparisonResult(nsresult aStatus,
|
||||
bool aInCacheAndEqual,
|
||||
const nsAString& aNewCacheName,
|
||||
const nsACString& aMaxScope)
|
||||
ServiceWorkerUpdateJob::ComparisonResult(nsresult aStatus,
|
||||
bool aInCacheAndEqual,
|
||||
const nsAString& aNewCacheName,
|
||||
const nsACString& aMaxScope)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -349,8 +349,8 @@ ServiceWorkerUpdateJob2::ComparisonResult(nsresult aStatus,
|
|||
mRegistration->mScope,
|
||||
mScriptSpec, aNewCacheName);
|
||||
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob2> handle(
|
||||
new nsMainThreadPtrHolder<ServiceWorkerUpdateJob2>(this));
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob> handle(
|
||||
new nsMainThreadPtrHolder<ServiceWorkerUpdateJob>(this));
|
||||
RefPtr<LifeCycleEventCallback> callback = new ContinueUpdateRunnable(handle);
|
||||
|
||||
ServiceWorkerPrivate* workerPrivate = mServiceWorker->WorkerPrivate();
|
||||
|
@ -364,7 +364,7 @@ ServiceWorkerUpdateJob2::ComparisonResult(nsresult aStatus,
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::ContinueUpdateAfterScriptEval(bool aScriptEvaluationResult)
|
||||
ServiceWorkerUpdateJob::ContinueUpdateAfterScriptEval(bool aScriptEvaluationResult)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -387,7 +387,7 @@ ServiceWorkerUpdateJob2::ContinueUpdateAfterScriptEval(bool aScriptEvaluationRes
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::Install()
|
||||
ServiceWorkerUpdateJob::Install()
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
|
@ -421,10 +421,10 @@ ServiceWorkerUpdateJob2::Install()
|
|||
// Call ContinueAfterInstallEvent(false) on main thread if the SW
|
||||
// script fails to load.
|
||||
nsCOMPtr<nsIRunnable> failRunnable = NS_NewRunnableMethodWithArgs<bool>
|
||||
(this, &ServiceWorkerUpdateJob2::ContinueAfterInstallEvent, false);
|
||||
(this, &ServiceWorkerUpdateJob::ContinueAfterInstallEvent, false);
|
||||
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob2> handle(
|
||||
new nsMainThreadPtrHolder<ServiceWorkerUpdateJob2>(this));
|
||||
nsMainThreadPtrHandle<ServiceWorkerUpdateJob> handle(
|
||||
new nsMainThreadPtrHolder<ServiceWorkerUpdateJob>(this));
|
||||
RefPtr<LifeCycleEventCallback> callback = new ContinueInstallRunnable(handle);
|
||||
|
||||
// Send the install event to the worker thread
|
||||
|
@ -438,7 +438,7 @@ ServiceWorkerUpdateJob2::Install()
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerUpdateJob2::ContinueAfterInstallEvent(bool aInstallEventSuccess)
|
||||
ServiceWorkerUpdateJob::ContinueAfterInstallEvent(bool aInstallEventSuccess)
|
||||
{
|
||||
if (Canceled()) {
|
||||
return FailUpdateJob(NS_ERROR_DOM_ABORT_ERR);
|
||||
|
|
|
@ -18,27 +18,27 @@ namespace workers {
|
|||
// as a different job type. This is necessary because the register job
|
||||
// performs largely the same operations as the update job, but has a few
|
||||
// different starting steps.
|
||||
class ServiceWorkerUpdateJob2 : public ServiceWorkerJob2
|
||||
class ServiceWorkerUpdateJob : public ServiceWorkerJob
|
||||
{
|
||||
public:
|
||||
// Construct an update job to be used only for updates.
|
||||
ServiceWorkerUpdateJob2(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
ServiceWorkerUpdateJob(nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
|
||||
already_AddRefed<ServiceWorkerRegistrationInfo>
|
||||
GetRegistration() const;
|
||||
|
||||
protected:
|
||||
// Construct an update job that is overriden as another job type.
|
||||
ServiceWorkerUpdateJob2(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
ServiceWorkerUpdateJob(Type aType,
|
||||
nsIPrincipal* aPrincipal,
|
||||
const nsACString& aScope,
|
||||
const nsACString& aScriptSpec,
|
||||
nsILoadGroup* aLoadGroup);
|
||||
|
||||
virtual ~ServiceWorkerUpdateJob2();
|
||||
virtual ~ServiceWorkerUpdateJob();
|
||||
|
||||
// FailUpdateJob() must be called if an update job needs Finish() with
|
||||
// an error.
|
||||
|
|
Загрузка…
Ссылка в новой задаче