shownotification-without-permission.https.window.js (751B)
1 // META: script=/resources/testdriver.js 2 // META: script=/resources/testdriver-vendor.js 3 // META: script=resources/helpers.js 4 5 "use strict"; 6 7 /** @type {ServiceWorkerRegistration} */ 8 let registration; 9 10 promise_setup(async () => { 11 await trySettingPermission("prompt"); 12 registration = await prepareActiveServiceWorker("noop-sw.js"); 13 await closeAllNotifications(); 14 }); 15 16 promise_test(async t => { 17 t.add_cleanup(closeAllNotifications); 18 19 await promise_rejects_js(t, TypeError, registration.showNotification(""), "Should throw TypeError"); 20 const notifications = await registration.getNotifications(); 21 assert_equals(notifications.length, 0, "Should return zero notification"); 22 }, "showNotificaiton should not be listed with permission=default")