close_test.js (596B)
1 /* eslint-disable mozilla/no-comparison-or-assignment-inside-ok */ 2 3 function ok(v, msg) { 4 client.postMessage({ status: "ok", result: !!v, message: msg }); 5 } 6 7 var client; 8 onmessage = function (e) { 9 if (e.data.message == "start") { 10 self.clients.matchAll().then(function (clients) { 11 client = clients[0]; 12 try { 13 close(); 14 ok(false, "close() should throw"); 15 } catch (ex) { 16 ok( 17 ex.name === "InvalidAccessError", 18 "close() should throw InvalidAccessError" 19 ); 20 } 21 client.postMessage({ status: "done" }); 22 }); 23 } 24 };