
                        function() {
                            registration.unregister();
                        });

                    return new Promise(
                        function(resolve) {
                            registration.addEventListener("updatefound",
                                function() {
                                    resolve(registration.installing);
                                });
                        });
                })
            .then(
                