Consider the following code:
// Precondition: `registration`is a valid ServiceWorkerRegistration object with
// a valid "active" worker with no pending events
registration.unregister()
.then(function() {
registration.active.postMessage('');
});