Bug 1702327 - Fix browser_ProcessHangNotifications.js r=jaws

Differential Revision: https://phabricator.services.mozilla.com/D110617
This commit is contained in:
Mark Striemer 2021-04-06 04:26:30 +00:00
Родитель e955cb7060
Коммит 888a65b0e0
2 изменённых файлов: 16 добавлений и 11 удалений

Просмотреть файл

@ -154,7 +154,9 @@ add_task(async function terminateScriptTest() {
Services.obs.notifyObservers(hangReport, "process-hang-report");
let notification = await promise;
let buttons = notification.currentNotification.getElementsByTagName("button");
let buttons = notification.currentNotification.buttonContainer.getElementsByTagName(
"button"
);
is(buttons.length, buttonCount, "proper number of buttons");
// Click the "Stop" button, we should get a terminate script callback
@ -177,13 +179,10 @@ add_task(async function waitForScriptTest() {
Services.obs.notifyObservers(hangReport, "process-hang-report");
let notification = await promise;
let buttons = notification.currentNotification.getElementsByTagName("button");
is(buttons.length, buttonCount, "proper number of buttons");
let toolbarbuttons = notification.currentNotification.getElementsByTagName(
"toolbarbutton"
let buttons = notification.currentNotification.buttonContainer.getElementsByTagName(
"button"
);
is(toolbarbuttons.length, 1, "proper number of toolbarbuttons");
let closeButton = toolbarbuttons[0];
is(buttons.length, buttonCount, "proper number of buttons");
await pushPrefs(["browser.hangNotification.waitPeriod", 1000]);
@ -205,8 +204,8 @@ add_task(async function waitForScriptTest() {
}
});
// Click the "Wait" button this time, we shouldn't get a callback at all.
closeButton.click();
// Click the "Close" button this time, we shouldn't get a callback at all.
notification.currentNotification.closeButton.click();
// send another hang pulse, we should not get a notification here
Services.obs.notifyObservers(hangReport, "process-hang-report");
@ -255,7 +254,9 @@ add_task(async function terminatePluginTest() {
Services.obs.notifyObservers(hangReport, "process-hang-report");
let notification = await promise;
let buttons = notification.currentNotification.getElementsByTagName("button");
let buttons = notification.currentNotification.buttonContainer.getElementsByTagName(
"button"
);
// Plugin hangs only ever show 1 button in the notification - even in
// DevEdition.
is(buttons.length, 1, "proper number of buttons");

Просмотреть файл

@ -261,7 +261,7 @@
if (aChild.eventCallback) {
aChild.eventCallback("removed");
}
this.stack.removeChild(aChild);
aChild.remove();
// make sure focus doesn't get lost (workaround for bug 570835)
if (!Services.focus.getFocusedElementForWindow(window, false, {})) {
@ -421,6 +421,7 @@
["messageText", ".messageText"],
["spacer", "spacer"],
["buttonContainer", ".messageDetails"],
["closeButton", ".messageCloseButton"],
]) {
this[propertyName] = this.querySelector(selector);
}
@ -595,6 +596,9 @@
}
close() {
if (!this.parentNode) {
return;
}
this.closest(
".notificationbox-stack"
)._notificationBox.removeNotification(this);