diff --git a/custom/tests.yaml b/custom/tests.yaml index 047a75633..3fbaa511f 100644 --- a/custom/tests.yaml +++ b/custom/tests.yaml @@ -2352,12 +2352,17 @@ api: return {result: false, message: 'navigator.ink.requestPresenter() is not defined'}; } var promise = navigator.ink.requestPresenter(); + InputDeviceInfo: + __base: <%api.MediaDeviceInfo:instance%> InstallEvent: __base: |- - if (!('InstallEvent' in self)) { - return {result: false, message: 'InstallEvent is not defined'}; - } - var instance = new InstallEvent('install'); + // During the installation of the service worker, we set an "installEvent" global variable so that we may easily reuse it here: + // var installEvent = null; + // self.addEventListener('install', function (event) { + // installEvent = event; + // }); + + var instance = installEvent; InterventionReportBody: __base: |- // XXX Obtaining an instance of this interface is much like triggering an event. diff --git a/static/resources/serviceworker.js b/static/resources/serviceworker.js index 00cd457e8..487861d0f 100644 --- a/static/resources/serviceworker.js +++ b/static/resources/serviceworker.js @@ -10,7 +10,10 @@ self.importScripts('harness.js'); +var installEvent = null; + self.addEventListener('install', function (event) { + installEvent = event; var promiseChain = caches.open('test-cache').then(function (openCache) { return openCache.put(new Request(''), new Response('')); });