Closed Bug 1049599 Opened 10 years ago Closed 10 years ago

ServiceWorkers handled inconsistently in RuntimeService::CancelWorkersForWindow() and WorkerPrivateParent::CloseSharedWorkersForWindow()

Categories

(Core :: DOM: Workers, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla35

People

(Reporter: bkelly, Assigned: nsm)

References

Details

Attachments

(1 file)

I noticed recently that we have this code in RuntimeService::CancelWorkerForWindow(): if (worker->IsSharedWorker()) { worker->CloseSharedWorkersForWindow(aWindow); } else if (!worker->Cancel(cx)) { JS_ReportPendingException(cx); } But then in WorkerPrivateParent::CloseSharedWorkersForWindow() we have: MOZ_ASSERT(IsSharedWorker() || IsServiceWorker()); It seems to me that either the first one needs: if (worker->IsSharedWorker() || worker->IsServiceWorker()) { worker->CloseSharedWorkersForWindow(aWindow); } Or we need to restrict MOZ_ASSERT in the second case.
Summary: ServiceWorkers handle inconsistently in RuntimeService::CancelWorkersForWindow() and WorkerPrivateParent::CloseSharedWorkersForWindow() → ServiceWorkers handled inconsistently in RuntimeService::CancelWorkersForWindow() and WorkerPrivateParent::CloseSharedWorkersForWindow()
Seems like this could be the source of some crashers in our SW tests as the worker might not get shutdown properly when the document goes away.
Added the IsServiceWorker() check to RuntimeService. This will at least decrease the 'reference count' of the WorkerPrivate in a sane way when client JS is holding on to ServiceWorker instances when the window goes away. I'm not sure if that prevents any crashes though.
Attachment #8477959 - Flags: review?(bent.mozilla)
Assignee: nobody → nsm.nikhil
Status: NEW → ASSIGNED
Attachment #8477959 - Flags: review?(bent.mozilla) → review+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla35
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: