зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1429093 - P2: A test to verify the close event is not allowed to window interaction. r=bkelly
This commit is contained in:
Родитель
a7f36965a3
Коммит
49a4cb64e9
|
@ -27,7 +27,7 @@
|
|||
});
|
||||
|
||||
navigator.serviceWorker.onmessage = function(msg) {
|
||||
testWindow.callback(msg.data.result);
|
||||
testWindow.callback(msg.data);
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -2,18 +2,27 @@
|
|||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
//
|
||||
onnotificationclose = function(e) {
|
||||
self.clients.matchAll().then(function(clients) {
|
||||
if (clients.length === 0) {
|
||||
dump("********************* CLIENTS LIST EMPTY! Test will timeout! ***********************\n");
|
||||
return;
|
||||
}
|
||||
e.waitUntil(async function() {
|
||||
let windowOpened = true;
|
||||
await clients.openWindow("hello.html")
|
||||
.catch(err => {
|
||||
windowOpened = false;
|
||||
});
|
||||
|
||||
clients.forEach(function(client) {
|
||||
client.postMessage({ result: e.notification.data &&
|
||||
e.notification.data['complex'] &&
|
||||
e.notification.data['complex'][0] == "jsval" &&
|
||||
e.notification.data['complex'][1] == 5 });
|
||||
self.clients.matchAll().then(function(clients) {
|
||||
if (clients.length === 0) {
|
||||
dump("*** CLIENTS LIST EMPTY! Test will timeout! ***\n");
|
||||
return;
|
||||
}
|
||||
|
||||
clients.forEach(function(client) {
|
||||
client.postMessage({ result: e.notification.data &&
|
||||
e.notification.data['complex'] &&
|
||||
e.notification.data['complex'][0] == "jsval" &&
|
||||
e.notification.data['complex'][1] == 5,
|
||||
windowOpened: windowOpened});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}());
|
||||
}
|
||||
|
|
|
@ -24,11 +24,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1265841
|
|||
function testFrame(src) {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = src;
|
||||
window.callback = function(result) {
|
||||
window.callback = function(data) {
|
||||
window.callback = null;
|
||||
document.body.removeChild(iframe);
|
||||
iframe = null;
|
||||
ok(result, "Got notificationclose event with correct data.");
|
||||
ok(data.result, "Got notificationclose event with correct data.");
|
||||
ok(!data.windowOpened,
|
||||
"Shouldn't allow to openWindow in notificationclose");
|
||||
MockServices.unregister();
|
||||
registration.unregister().then(function() {
|
||||
SimpleTest.finish();
|
||||
|
|
Загрузка…
Ссылка в новой задаче