mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 12:50:09 +00:00
Bug 1370967 - close containing popup when clicking a non-popup browser action, r=mixedpuppy
MozReview-Commit-ID: HkdV5FUPnDV --HG-- extra : rebase_source : a7e339dda5c75af0f0e1b910794f350dfdd8fdab
This commit is contained in:
parent
4826f32d87
commit
16ce5f8d00
@ -206,6 +206,8 @@ this.browserAction = class extends ExtensionAPI {
|
||||
// with the fewest complications.
|
||||
event.preventDefault();
|
||||
this.emit("click", tabbrowser.selectedBrowser);
|
||||
// Ensure we close any popups this node was in:
|
||||
CustomizableUI.hidePanelForNode(event.target);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
@ -68,7 +68,8 @@ async function testInArea(area) {
|
||||
},
|
||||
() => {
|
||||
browser.test.log(`Call triggerAction, expect popup "a" again. Leave popup open.`);
|
||||
sendClick({expectEvent: false, expectPopup: "a", closePopup: false}, "trigger-action");
|
||||
sendClick({expectEvent: false, expectPopup: "a",
|
||||
closePopup: false, containingPopupShouldClose: false}, "trigger-action");
|
||||
},
|
||||
() => {
|
||||
browser.test.log(`Call triggerAction again. Expect remaining popup closed.`);
|
||||
@ -109,7 +110,8 @@ async function testInArea(area) {
|
||||
() => {
|
||||
browser.test.log(`Set popup to "a" and click browser action. Expect popup "a", and leave open.`);
|
||||
browser.browserAction.setPopup({popup: "/popup-a.html"});
|
||||
sendClick({expectEvent: false, expectPopup: "a", closePopup: false});
|
||||
sendClick({expectEvent: false, expectPopup: "a", closePopup: false,
|
||||
containingPopupShouldClose: false});
|
||||
},
|
||||
() => {
|
||||
browser.test.log(`Tell popup "a" to call window.close(). Expect popup closed.`);
|
||||
@ -118,12 +120,17 @@ async function testInArea(area) {
|
||||
];
|
||||
|
||||
let expect = {};
|
||||
sendClick = ({expectEvent, expectPopup, runNextTest, waitUntilClosed, closePopup}, message = "send-click") => {
|
||||
sendClick = ({expectEvent, expectPopup, runNextTest, waitUntilClosed,
|
||||
closePopup, containingPopupShouldClose = true},
|
||||
message = "send-click") => {
|
||||
if (closePopup == undefined) {
|
||||
closePopup = !expectEvent;
|
||||
}
|
||||
|
||||
expect = {event: expectEvent, popup: expectPopup, runNextTest, waitUntilClosed, closePopup};
|
||||
expect = {
|
||||
event: expectEvent, popup: expectPopup, runNextTest,
|
||||
waitUntilClosed, closePopup, containingPopupShouldClose
|
||||
};
|
||||
browser.test.sendMessage(message);
|
||||
};
|
||||
|
||||
@ -216,6 +223,14 @@ async function testInArea(area) {
|
||||
await closeBrowserAction(extension);
|
||||
}
|
||||
|
||||
if (area == getCustomizableUIPanelID() && expecting.containingPopupShouldClose) {
|
||||
let {node} = getBrowserActionWidget(extension).forWindow(window);
|
||||
let panel = node.closest("panel");
|
||||
info(`State of panel ${panel.id} is: ${panel.state}`);
|
||||
ok(!["open", "showing"].includes(panel.state),
|
||||
"Panel containing the action should be closed");
|
||||
}
|
||||
|
||||
info("Starting next test");
|
||||
extension.sendMessage("next-test");
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user