gecko-dev/dom/serviceworkers/PServiceWorkerRegistration.ipdl
Blake Kaplan 13fc0d95f9 Bug 1510809 - Fire updatefound correctly for SWC.register r=asuth
Currently, we are required to fire updatefound in three cases:

  * When a "soft" update finds an update.
  * When a call to ServiceWorkerRegistration.update finds an update.
  * When ServiceWorkerContainer.register registers a ServiceWorker.

In the first case, there are no requirements on the timing of the event. For
the second two cases, however, the promise returned by update or register
needs to resolve before updatefound is dispatched. We hack around the first
case by explicitly counting the calls to update and only dispatching
updatefound when the final promise resolves. In the case of SWC.register, the
ServiceWorkerRegistration object might not even exist when it notices that we
need to fire updatefound, which suggests that we need some code to tell it
when to fire the event; except that in the soft update case, there is no
obvious place to do so. So, the easiest way to resolve this is to have the
parent process tell the ServiceWorkerRegistration when to fire updatefound
itself. This way, we don't rely on any tricky timing and everything is
consistent with itself.

Differential Revision: https://phabricator.services.mozilla.com/D13368

--HG--
extra : moz-landing-system : lando
2018-11-29 23:06:32 +00:00

31 lines
758 B
Plaintext

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBackground;
include IPCServiceWorkerRegistrationDescriptor;
namespace mozilla {
namespace dom {
protocol PServiceWorkerRegistration
{
manager PBackground;
parent:
async Teardown();
async Unregister() returns (bool aSuccess, CopyableErrorResult aRv);
async Update() returns (IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult aResult);
child:
async __delete__();
async UpdateState(IPCServiceWorkerRegistrationDescriptor aDescriptor);
async FireUpdateFound();
};
} // namespace dom
} // namespace mozilla