Closed
Bug 1131882
Opened 10 years ago
Closed 10 years ago
navigator.serviceWorker.controller does not track underlying state
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla39
Tracking | Status | |
---|---|---|
firefox39 | --- | fixed |
People
(Reporter: nsm, Assigned: nsm)
References
Details
Attachments
(1 file, 1 obsolete file)
33.27 KB,
patch
|
Details | Diff | Splinter Review |
ServiceWorkerRegistration objects track the intenral ServiceWorkerState and update their ServiceWorkers accordingly and also fire events on them. .controller does not.
Assignee | ||
Comment 1•10 years ago
|
||
This allows controller to track state too, and provides better encapsulation.
1) Move SW setup to SWM. RuntimeService now only creates the underlying SharedWorker.
2) Require a SWInfo to create a SW. The SW holds a refptr to the info.
Attachment #8565235 -
Flags: review?(amarchesini)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
Comment 2•10 years ago
|
||
Comment on attachment 8565235 [details] [diff] [review]
Associate ServiceWorkers with underlying ServiceWorkerInfo
Review of attachment 8565235 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/workers/ServiceWorker.cpp
@@ +78,5 @@
>
> void
> +ServiceWorker::GetScriptURL(nsString& aURL) const
> +{
> + aURL = NS_ConvertUTF8toUTF16(mInfo->ScriptSpec());
ConvertUTF8toUTF16(mInfo->ScriptSpec(), aURL);
@@ +109,5 @@
> + nsCOMPtr<nsIRunnable> r =
> + NS_NewRunnableMethodWithArg<ServiceWorkerState>(this,
> + &ServiceWorker::DispatchStateChange,
> + aState);
> + NS_DispatchToMainThread(r);
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DipsatchToMainThread(r)));
::: dom/workers/ServiceWorker.h
@@ +17,5 @@
>
> class Promise;
>
> namespace workers {
>
class ServiceWorkerManager; <- this is needed for the friend stmt.
::: dom/workers/ServiceWorkerManager.cpp
@@ +630,5 @@
> NS_DispatchToMainThread(upr);
>
> nsRefPtr<ServiceWorker> serviceWorker;
> nsresult rv =
> + swm->CreateServiceWorker(mRegistration->mInstallingWorker,
this is changed in my latest patch. can you rebase this patch on top of mine?
@@ +2446,5 @@
> + for (uint32_t i = 0; i < mInstances.Length(); ++i) {
> + mInstances[i]->QueueStateChangeEvent(mState);
> + }
> +}
> +
extra line :)
::: dom/workers/ServiceWorkerManager.h
@@ +215,5 @@
> const ServiceWorkerRegistrationInfo* mRegistration;
> nsCString mScriptSpec;
> ServiceWorkerState mState;
> + // There is a high chance of there being at least one ServiceWorker
> + // associated with this all the time.
Write that we have a raw pointer because the unregister is called on the DTOR.
@@ +264,5 @@
> // Only used to set initial state when loading from disk!
> void
> SetActivateStateUncheckedWithoutEvent(ServiceWorkerState aState)
> {
> mState = aState;
Would be nice to assert this.. some how.
Attachment #8565235 -
Flags: review?(amarchesini) → review+
Comment 3•10 years ago
|
||
I tried including this in the build, but it needs to be rebased since persistent registrations landed.
Assignee | ||
Comment 4•10 years ago
|
||
Assignee | ||
Comment 5•10 years ago
|
||
Ben, updated patch.
Assignee | ||
Updated•10 years ago
|
Attachment #8565235 -
Attachment is obsolete: true
Comment 6•10 years ago
|
||
Sorry, I already did the builds. I'll include this in the next build if it hasn't landed yet.
Assignee | ||
Comment 7•10 years ago
|
||
Assignee | ||
Comment 8•10 years ago
|
||
Comment 9•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•