Closed Bug 1231218 Opened 9 years ago Closed 6 years ago

remove child process pointers like nsIDocument from ServiceWorkerManager

Categories

(Core :: DOM: Service Workers, defect, P2)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: bkelly, Assigned: bkelly)

References

(Blocks 1 open bug)

Details

(Whiteboard: [e10s-multi:M3], SW-MUST)

Currently service worker manager directly references nsIDocument in many places.  This needs to be abstracted to a client interface so we can deal with clients in a remote process.  It also lets us handle clients that are not documents, like workers.
Assignee: nobody → ehsan
Assignee: ehsan → amarchesini
Whiteboard: [e10s-multi:M1]
Whiteboard: [e10s-multi:M1] → [e10s-multi:M3]
I'm going to do this as a follow-on to my Client infrastructure work.
Assignee: amarchesini → bkelly
Depends on: 1293277
Status: NEW → ASSIGNED
Note to self:  Test document.open() behavior on a page that is controlled by a service worker.  The spec suggests we should stop being controlled.  We probably get this for free by controlling documents, but it could be easily regressed if we shift to controlling nsGlobalWindow.
Bug 1293277 is close to completion.  I plan to start this next.  My current thought is to find all uses of nsIDocument and replace them with ClientHandle.

I expect to have to implement two new features in ClientHandle:

1. A console reporting mechanism that sends the message to the ClientSource to report.  This is necessary for the various "ReportToAll*()" methods in SWM.  At first I thought perhaps I could just expose the windowId and report locally, but that doesn't work for all clients.  For example, a SharedWorker ClientSource probably will want to send the console report to all owning document windows, etc.

2. A callback or MozPromise mechanism to find out when a ClientHandle's IPC is detached.  This will allow the ServiceWorkerManager to know when all the controlled clients are gone and the active worker can move to redundant.

Note, even after this change we will still have ServiceWorkerManager in the child processes.  These changes are not sufficient to move the parent process.  To complete the move we will still need:

a. IPC-backed implementations of DOM objects like ServiceWorker, ServiceWorkerRegistration, and ServiceWorkerContainer.
b. Necko integration that supports parent-side SWM in some way.  Ideally this is interception in the parent, but we may have to do an IPC mechanism at first.
I think I'm going to treat this as a meta-bug.
Depends on: 1425316
Depends on: 1425965
Depends on: 1425975
Depends on: 1426253
Morphing this into a meta more about removing more child process interface pointers from ServiceWorkerManager.
Summary: replace nsIDocument in service worker manager with a client interface → remove child process pointers like nsIDocument from ServiceWorkerManager
Depends on: 1231211
Priority: -- → P2
Whiteboard: [e10s-multi:M3] → [e10s-multi:M3], SW-MUST
Assignee: ben → nobody
Status: ASSIGNED → NEW
This is all but done. There are two more references to nsIDocument/nsPIDOMWindow in ServiceWorkerManager. I'll file a bug to remove them and mark this fixed.
Assignee: nobody → ben
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.