Closed Bug 1112136 Opened 10 years ago Closed 8 years ago

hide ServiceWorker APIs when in private browsing mode

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bkelly, Assigned: ehsan.akhgari)

References

Details

One of the outcomes of the various principal work was that ServiceWorkers should not be usable from a private browsing session.  To allow feature detection to work we should hide the SW API when in private browsing mode.
What do you think we should do with the other SW APIs in private browsing mode?  In bug 1112134 you felt hiding was the wrong solution.

The SW registration is persistent of course, so that's why it matters here.

Perhaps its easier just not to persist the registration in this case?
Flags: needinfo?(ehsan)
Non-persistent registrations are not very useful though.

Can we just make ServiceWorkerContainer.register() return a Promise which will never get resolved?  The same scenario would happen if, for example, the user doesn't grant permission when we prompt them during the register() call, so those cases would be indistinguishable from the viewpoint of the Web author.
Flags: needinfo?(ehsan)
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #2)
> Non-persistent registrations are not very useful though.
> 
> Can we just make ServiceWorkerContainer.register() return a Promise which
> will never get resolved?  The same scenario would happen if, for example,
> the user doesn't grant permission when we prompt them during the register()
> call, so those cases would be indistinguishable from the viewpoint of the
> Web author.

The spec never mentions prompting the user, but leaving a Promise unresolved seems an ugly approach. Rejecting the promise with SecurityError or PermissionDeniedError may be better.
You're right, rejection is definitely better.
I guess it should block v2. Please, change it if it is not the case. Thanks!
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
We fixed this at some point in another bug.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.