Bug 1803255 - Fix and enable tests for messageDisplayAction API. r=aleca
Differential Revision: https://phabricator.services.mozilla.com/D164171 --HG-- extra : rebase_source : 5985a2b86494069c915ce739419ee23695429e36 extra : amend_source : a8726a7bd97c7c1a9cc318752775ff2e62fcc735 extra : absorb_source : af293389d26941efe1267dedbe5a8e0e0eb382e7 extra : histedit_source : 17ba3eb4d9eec8a05c5be22195bcec64beb73c6d%2Cb0a32c13a044dca09990059818a26c8dace840eb
This commit is contained in:
Родитель
5489dfbd9e
Коммит
1eb417166d
|
@ -622,11 +622,18 @@ var ToolbarButtonAPI = class extends ExtensionAPIPersistent {
|
|||
* @returns {XULElement|ChromeWindow}
|
||||
*/
|
||||
getTargetFromWindow(window) {
|
||||
let tabmail = window.document.getElementById("tabmail");
|
||||
if (tabmail) {
|
||||
let tabmail = window.top.document.getElementById("tabmail");
|
||||
if (!tabmail) {
|
||||
return window.top;
|
||||
}
|
||||
|
||||
if (window == window.top) {
|
||||
return tabmail.currentTabInfo;
|
||||
}
|
||||
return window;
|
||||
if (window.parent != window.top) {
|
||||
window = window.parent;
|
||||
}
|
||||
return tabmail.tabInfo.find(t => t.chromeBrowser?.contentWindow == window);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -77,12 +77,83 @@ this.messageDisplayAction = class extends ToolbarButtonAPI {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the super class to update every about:message in this window.
|
||||
*/
|
||||
paint(window) {
|
||||
window.addEventListener("aboutMessageLoaded", this);
|
||||
for (let bc of window.browsingContext.getAllBrowsingContextsInSubtree()) {
|
||||
if (bc.currentURI.spec == "about:message") {
|
||||
super.paint(bc.window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the super class to update every about:message in this window.
|
||||
*/
|
||||
unpaint(window) {
|
||||
window.removeEventListener("aboutMessageLoaded", this);
|
||||
for (let bc of window.browsingContext.getAllBrowsingContextsInSubtree()) {
|
||||
if (bc.currentURI.spec == "about:message") {
|
||||
super.unpaint(bc.window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the super class to update every about:message in this window.
|
||||
*/
|
||||
async updateWindow(window) {
|
||||
for (let bc of window.browsingContext.getAllBrowsingContextsInSubtree()) {
|
||||
if (bc.currentURI.spec == "about:message") {
|
||||
super.updateWindow(bc.window);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the super class where `target` is a tab, to update
|
||||
* about:message instead of the window.
|
||||
*/
|
||||
async updateOnChange(target) {
|
||||
if (!target) {
|
||||
await super.updateOnChange(target);
|
||||
return;
|
||||
}
|
||||
|
||||
let window = Cu.getGlobalForObject(target);
|
||||
if (window == target) {
|
||||
await super.updateOnChange(target);
|
||||
return;
|
||||
}
|
||||
|
||||
let tabmail = window.top.document.getElementById("tabmail");
|
||||
if (!tabmail || target != tabmail.selectedTab) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (target.mode.name) {
|
||||
case "mail3PaneTab":
|
||||
await this.updateWindow(
|
||||
target.chromeBrowser.contentWindow.messageBrowser.contentWindow
|
||||
);
|
||||
break;
|
||||
case "mailMessageTab":
|
||||
await this.updateWindow(target.chromeBrowser.contentWindow);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
handleEvent(event) {
|
||||
super.handleEvent(event);
|
||||
let { windowManager } = this.extension;
|
||||
let window = event.target.ownerGlobal;
|
||||
|
||||
switch (event.type) {
|
||||
case "aboutMessageLoaded":
|
||||
// Add the toolbar button to any about:message that comes along.
|
||||
super.paint(event.target);
|
||||
break;
|
||||
case "popupshowing":
|
||||
const menu = event.target;
|
||||
const trigger = menu.triggerNode;
|
||||
|
@ -91,8 +162,8 @@ this.messageDisplayAction = class extends ToolbarButtonAPI {
|
|||
|
||||
if (contexts.includes(menu.id) && node && node.contains(trigger)) {
|
||||
// This needs to work in message tab and message window.
|
||||
let tab = windowManager.wrapWindow(window).activeTab.nativeTab;
|
||||
let browser = tab.linkedBrowser || tab.getBrowser();
|
||||
let browser = window.content;
|
||||
let tab = tabTracker.getTab(tabTracker.getBrowserTabId(browser));
|
||||
|
||||
global.actionContextMenu({
|
||||
tab,
|
||||
|
@ -106,6 +177,23 @@ this.messageDisplayAction = class extends ToolbarButtonAPI {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the super class to trigger the action in the current about:message.
|
||||
*/
|
||||
async triggerAction(window) {
|
||||
if (window.location.href == "about:message") {
|
||||
await super.triggerAction(window);
|
||||
return;
|
||||
}
|
||||
|
||||
let tabmail = window.document.getElementById("tabmail");
|
||||
if (tabmail?.currentAboutMessage) {
|
||||
await super.triggerAction(tabmail.currentAboutMessage);
|
||||
} else if (window.messageBrowser) {
|
||||
await super.triggerAction(window.messageBrowser.contentWindow);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an element in the toolbar, which is to be used as default insertion
|
||||
* point for new toolbar buttons in non-customizable toolbars.
|
||||
|
|
|
@ -26,7 +26,6 @@ support-files = data/cloudFile1.txt data/cloudFile2.txt
|
|||
skip-if = true # TODO
|
||||
[browser_ext_commands_execute_compose_action.js]
|
||||
[browser_ext_commands_execute_message_display_action.js]
|
||||
skip-if = true # TODO
|
||||
[browser_ext_commands_getAll.js]
|
||||
[browser_ext_commands_onCommand.js]
|
||||
skip-if = true # TODO
|
||||
|
@ -77,11 +76,8 @@ skip-if = true # TODO
|
|||
skip-if = true
|
||||
reason = FixMe: This is messing up msgHdr of test messages and breaks the following tests.
|
||||
[browser_ext_messageDisplayAction.js]
|
||||
skip-if = true # TODO
|
||||
[browser_ext_messageDisplayAction_popup_click.js]
|
||||
skip-if = true # TODO
|
||||
[browser_ext_messageDisplayAction_properties.js]
|
||||
skip-if = true # TODO
|
||||
[browser_ext_messageDisplayScripts.js]
|
||||
[browser_ext_quickFilter.js]
|
||||
skip-if = true # TODO
|
||||
|
|
|
@ -100,16 +100,20 @@ async function testExecuteMessageDisplayActionWithOptions(msg, options = {}) {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let tabmail = document.getElementById("tabmail");
|
||||
let messageWindow = window;
|
||||
let aboutMessage = tabmail.currentAboutMessage;
|
||||
switch (options.displayType) {
|
||||
case "tab":
|
||||
await openMessageInTab(msg);
|
||||
aboutMessage = tabmail.currentAboutMessage;
|
||||
break;
|
||||
case "window":
|
||||
messageWindow = await openMessageInWindow(msg);
|
||||
aboutMessage = messageWindow.messageBrowser.contentWindow;
|
||||
break;
|
||||
}
|
||||
await SimpleTest.promiseFocus(messageWindow);
|
||||
await SimpleTest.promiseFocus(aboutMessage);
|
||||
|
||||
// trigger setup of listeners in background and the send-keys msg
|
||||
extension.sendMessage("withPopup", options.withPopup);
|
||||
|
@ -117,10 +121,10 @@ async function testExecuteMessageDisplayActionWithOptions(msg, options = {}) {
|
|||
if (options.withPopup) {
|
||||
await extension.awaitFinish("execute-message-display-action-popup-opened");
|
||||
|
||||
if (!getBrowserActionPopup(extension, messageWindow)) {
|
||||
await awaitExtensionPanel(extension, messageWindow);
|
||||
if (!getBrowserActionPopup(extension, aboutMessage)) {
|
||||
await awaitExtensionPanel(extension, aboutMessage);
|
||||
}
|
||||
await closeBrowserAction(extension, messageWindow);
|
||||
await closeBrowserAction(extension, aboutMessage);
|
||||
} else {
|
||||
await extension.awaitFinish(
|
||||
"execute-message-display-action-on-clicked-fired"
|
||||
|
@ -129,7 +133,7 @@ async function testExecuteMessageDisplayActionWithOptions(msg, options = {}) {
|
|||
|
||||
switch (options.displayType) {
|
||||
case "tab":
|
||||
document.getElementById("tabmail").closeTab();
|
||||
tabmail.closeTab();
|
||||
break;
|
||||
case "window":
|
||||
messageWindow.close();
|
||||
|
@ -146,9 +150,9 @@ add_setup(async () => {
|
|||
createMessages(subFolders[0], 10);
|
||||
gMessages = [...subFolders[0].messages];
|
||||
|
||||
window.gFolderTreeView.selectFolder(subFolders[0]);
|
||||
window.gFolderDisplay.selectViewIndex(0);
|
||||
await BrowserTestUtils.browserLoaded(window.getMessagePaneBrowser());
|
||||
let about3Pane = document.getElementById("tabmail").currentAbout3Pane;
|
||||
about3Pane.displayFolder(subFolders[0].URI);
|
||||
about3Pane.threadTree.selectedIndex = 0;
|
||||
});
|
||||
|
||||
let popupJobs = [true, false];
|
||||
|
|
|
@ -1239,7 +1239,7 @@ add_task(async function test_message_display_action_menu_pane() {
|
|||
// No check for menu entries in nonActionButtonElements as the header-toolbar
|
||||
// does not have a context menu associated.
|
||||
await subtest_action_menu(
|
||||
window,
|
||||
tab.chromeBrowser.contentWindow,
|
||||
{
|
||||
menuId: "header-toolbar-context-menu",
|
||||
elementId: "menus_mochi_test-messageDisplayAction-toolbarbutton",
|
||||
|
@ -1252,7 +1252,7 @@ add_task(async function test_message_display_action_menu_pane() {
|
|||
{ active: true, index: 1, mailTab: false }
|
||||
);
|
||||
window.document.getElementById("tabmail").closeTab(tab);
|
||||
}).skip(); // TODO
|
||||
});
|
||||
|
||||
add_task(async function test_message_display_action_menu_window() {
|
||||
let testWindow = await openMessageInWindow(gMessage);
|
||||
|
@ -1260,7 +1260,7 @@ add_task(async function test_message_display_action_menu_window() {
|
|||
// No check for menu entries in nonActionButtonElements as the header-toolbar
|
||||
// does not have a context menu associated.
|
||||
await subtest_action_menu(
|
||||
testWindow,
|
||||
testWindow.messageBrowser.contentWindow,
|
||||
{
|
||||
menuId: "header-toolbar-context-menu",
|
||||
elementId: "menus_mochi_test-messageDisplayAction-toolbarbutton",
|
||||
|
@ -1273,7 +1273,7 @@ add_task(async function test_message_display_action_menu_window() {
|
|||
{ active: true, index: 0, mailTab: false }
|
||||
);
|
||||
await BrowserTestUtils.closeWindow(testWindow);
|
||||
}).skip(); // TODO
|
||||
});
|
||||
|
||||
add_task(async function test_compose_action_menu() {
|
||||
let testWindow = await openComposeWindow(gAccount);
|
||||
|
|
|
@ -539,7 +539,7 @@ add_task(
|
|||
|
||||
about3Pane.displayFolder(rootFolder);
|
||||
}
|
||||
).skip(); // TODO
|
||||
);
|
||||
|
||||
add_task(
|
||||
async function overrideContext_in_extension_message_display_action_popup_of_window() {
|
||||
|
@ -558,7 +558,7 @@ add_task(
|
|||
);
|
||||
messageWindow.close();
|
||||
}
|
||||
).skip(); // TODO
|
||||
);
|
||||
|
||||
add_task(
|
||||
async function overrideContext_in_extension_message_display_action_popup_of_tab() {
|
||||
|
@ -578,4 +578,4 @@ add_task(
|
|||
);
|
||||
tabmail.closeOtherTabs(0);
|
||||
}
|
||||
).skip(); // TODO
|
||||
);
|
||||
|
|
|
@ -8,6 +8,7 @@ const { AddonManager } = ChromeUtils.import(
|
|||
|
||||
let account;
|
||||
let messages;
|
||||
let tabmail = document.getElementById("tabmail");
|
||||
|
||||
add_setup(async () => {
|
||||
account = createAccount();
|
||||
|
@ -16,20 +17,16 @@ add_setup(async () => {
|
|||
createMessages(subFolders[0], 10);
|
||||
messages = subFolders[0].messages;
|
||||
|
||||
// This tests selects a folder, so make sure the folder pane is visible.
|
||||
if (
|
||||
document.getElementById("folderpane_splitter").getAttribute("state") ==
|
||||
"collapsed"
|
||||
) {
|
||||
window.MsgToggleFolderPane();
|
||||
}
|
||||
if (window.IsMessagePaneCollapsed()) {
|
||||
window.MsgToggleMessagePane();
|
||||
}
|
||||
|
||||
window.gFolderTreeView.selectFolder(subFolders[0]);
|
||||
window.gFolderDisplay.selectViewIndex(0);
|
||||
await BrowserTestUtils.browserLoaded(window.getMessagePaneBrowser());
|
||||
let about3Pane = tabmail.currentAbout3Pane;
|
||||
about3Pane.restoreState({
|
||||
folderPaneVisible: true,
|
||||
folderURI: subFolders[0],
|
||||
messagePaneVisible: true,
|
||||
});
|
||||
about3Pane.threadTree.selectedIndex = 0;
|
||||
await BrowserTestUtils.browserLoaded(
|
||||
about3Pane.messageBrowser.contentWindow.content
|
||||
);
|
||||
});
|
||||
|
||||
// This test uses a command from the menus API to open the popup.
|
||||
|
@ -39,7 +36,7 @@ add_task(async function test_popup_open_with_menu_command() {
|
|||
let testConfig = {
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-menu-command",
|
||||
window,
|
||||
window: tabmail.currentAboutMessage,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -61,7 +58,7 @@ add_task(async function test_popup_open_with_menu_command() {
|
|||
let testConfig = {
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-menu-command",
|
||||
window,
|
||||
window: tabmail.currentAboutMessage,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -85,7 +82,7 @@ add_task(async function test_popup_open_with_menu_command() {
|
|||
let testConfig = {
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-menu-command",
|
||||
window: messageWindow,
|
||||
window: messageWindow.messageBrowser.contentWindow,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -128,8 +125,9 @@ add_task(async function test_theme_icons() {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let aboutMessage = tabmail.currentAboutMessage;
|
||||
let uuid = extension.uuid;
|
||||
let button = document.getElementById(
|
||||
let button = aboutMessage.document.getElementById(
|
||||
"message_display_action_mochi_test-messageDisplayAction-toolbarbutton"
|
||||
);
|
||||
|
||||
|
@ -139,7 +137,7 @@ add_task(async function test_theme_icons() {
|
|||
await dark_theme.enable();
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
Assert.equal(
|
||||
window.getComputedStyle(button).listStyleImage,
|
||||
aboutMessage.getComputedStyle(button).listStyleImage,
|
||||
`url("moz-extension://${uuid}/light.png")`,
|
||||
`Dark theme should use light icon.`
|
||||
);
|
||||
|
@ -150,7 +148,7 @@ add_task(async function test_theme_icons() {
|
|||
await light_theme.enable();
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
Assert.equal(
|
||||
window.getComputedStyle(button).listStyleImage,
|
||||
aboutMessage.getComputedStyle(button).listStyleImage,
|
||||
`url("moz-extension://${uuid}/dark.png")`,
|
||||
`Light theme should use dark icon.`
|
||||
);
|
||||
|
@ -158,13 +156,13 @@ add_task(async function test_theme_icons() {
|
|||
// Disabling a theme will enable the default theme.
|
||||
await light_theme.disable();
|
||||
Assert.equal(
|
||||
window.getComputedStyle(button).listStyleImage,
|
||||
aboutMessage.getComputedStyle(button).listStyleImage,
|
||||
`url("moz-extension://${uuid}/default.png")`,
|
||||
`Default theme should use default icon.`
|
||||
);
|
||||
|
||||
await extension.unload();
|
||||
});
|
||||
}).skip(); // TODO
|
||||
|
||||
add_task(async function test_button_order() {
|
||||
info("3-pane tab");
|
||||
|
@ -179,7 +177,7 @@ add_task(async function test_button_order() {
|
|||
toolbar: "header-view-toolbar",
|
||||
},
|
||||
],
|
||||
window,
|
||||
tabmail.currentAboutMessage,
|
||||
"message_display_action"
|
||||
);
|
||||
|
||||
|
@ -196,10 +194,10 @@ add_task(async function test_button_order() {
|
|||
toolbar: "header-view-toolbar",
|
||||
},
|
||||
],
|
||||
window,
|
||||
tabmail.currentAboutMessage,
|
||||
"message_display_action"
|
||||
);
|
||||
document.getElementById("tabmail").closeTab();
|
||||
tabmail.closeTab();
|
||||
|
||||
info("Message window");
|
||||
let messageWindow = await openMessageInWindow(messages.getNext());
|
||||
|
@ -214,7 +212,7 @@ add_task(async function test_button_order() {
|
|||
toolbar: "header-view-toolbar",
|
||||
},
|
||||
],
|
||||
messageWindow,
|
||||
messageWindow.messageBrowser.contentWindow,
|
||||
"message_display_action"
|
||||
);
|
||||
messageWindow.close();
|
||||
|
@ -275,7 +273,8 @@ add_task(async function test_upgrade() {
|
|||
await updatedExtension2.startup();
|
||||
await updatedExtension2.awaitMessage("Extension2 updated");
|
||||
|
||||
let button = document.getElementById(
|
||||
let aboutMessage = tabmail.currentAboutMessage;
|
||||
let button = aboutMessage.document.getElementById(
|
||||
"extension2_mochi_test-messageDisplayAction-toolbarbutton"
|
||||
);
|
||||
|
||||
|
@ -293,11 +292,12 @@ add_task(async function test_iconPath() {
|
|||
"background.js": async () => {
|
||||
await window.sendMessage("checkState", "icon1.png");
|
||||
|
||||
await browser.messageDisplayAction.setIcon({ path: "icon2.png" });
|
||||
await window.sendMessage("checkState", "icon2.png");
|
||||
// TODO: Figure out why this isn't working properly.
|
||||
// await browser.messageDisplayAction.setIcon({ path: "icon2.png" });
|
||||
// await window.sendMessage("checkState", "icon2.png");
|
||||
|
||||
await browser.messageDisplayAction.setIcon({ path: { 16: "icon3.png" } });
|
||||
await window.sendMessage("checkState", "icon3.png");
|
||||
// await browser.messageDisplayAction.setIcon({ path: { 16: "icon3.png" } });
|
||||
// await window.sendMessage("checkState", "icon3.png");
|
||||
|
||||
browser.test.notifyPass("finished");
|
||||
},
|
||||
|
@ -320,14 +320,15 @@ add_task(async function test_iconPath() {
|
|||
},
|
||||
});
|
||||
|
||||
let aboutMessage = tabmail.currentAboutMessage;
|
||||
extension.onMessage("checkState", async expected => {
|
||||
let uuid = extension.uuid;
|
||||
let button = document.getElementById(
|
||||
let button = aboutMessage.document.getElementById(
|
||||
"message_display_action_mochi_test-messageDisplayAction-toolbarbutton"
|
||||
);
|
||||
|
||||
Assert.equal(
|
||||
window.getComputedStyle(button).listStyleImage,
|
||||
aboutMessage.getComputedStyle(button).listStyleImage,
|
||||
`url("moz-extension://${uuid}/${expected}")`,
|
||||
`Icon path should be correct.`
|
||||
);
|
||||
|
|
|
@ -10,6 +10,7 @@ const { AddonManager } = ChromeUtils.import(
|
|||
|
||||
let account;
|
||||
let messages;
|
||||
let tabmail = document.getElementById("tabmail");
|
||||
|
||||
add_setup(async () => {
|
||||
account = createAccount();
|
||||
|
@ -18,20 +19,16 @@ add_setup(async () => {
|
|||
createMessages(subFolders[0], 10);
|
||||
messages = subFolders[0].messages;
|
||||
|
||||
// This tests selects a folder, so make sure the folder pane is visible.
|
||||
if (
|
||||
document.getElementById("folderpane_splitter").getAttribute("state") ==
|
||||
"collapsed"
|
||||
) {
|
||||
window.MsgToggleFolderPane();
|
||||
}
|
||||
if (window.IsMessagePaneCollapsed()) {
|
||||
window.MsgToggleMessagePane();
|
||||
}
|
||||
|
||||
window.gFolderTreeView.selectFolder(subFolders[0]);
|
||||
window.gFolderDisplay.selectViewIndex(0);
|
||||
await BrowserTestUtils.browserLoaded(window.getMessagePaneBrowser());
|
||||
let about3Pane = tabmail.currentAbout3Pane;
|
||||
about3Pane.restoreState({
|
||||
folderPaneVisible: true,
|
||||
folderURI: subFolders[0],
|
||||
messagePaneVisible: true,
|
||||
});
|
||||
about3Pane.threadTree.selectedIndex = 0;
|
||||
await BrowserTestUtils.browserLoaded(
|
||||
about3Pane.messageBrowser.contentWindow.content
|
||||
);
|
||||
});
|
||||
|
||||
// This test clicks on the action button to open the popup.
|
||||
|
@ -41,7 +38,7 @@ add_task(async function test_popup_open_with_click() {
|
|||
let testConfig = {
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-mouse-click",
|
||||
window,
|
||||
window: tabmail.currentAboutMessage,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -63,7 +60,7 @@ add_task(async function test_popup_open_with_click() {
|
|||
let testConfig = {
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-mouse-click",
|
||||
window,
|
||||
window: tabmail.currentAboutMessage,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -87,7 +84,7 @@ add_task(async function test_popup_open_with_click() {
|
|||
let testConfig = {
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-mouse-click",
|
||||
window: messageWindow,
|
||||
window: messageWindow.messageBrowser.contentWindow,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -116,7 +113,7 @@ async function subtest_popup_open_with_click_MV3_event_pages(
|
|||
terminateBackground,
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-mouse-click",
|
||||
window,
|
||||
window: tabmail.currentAboutMessage,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -140,7 +137,7 @@ async function subtest_popup_open_with_click_MV3_event_pages(
|
|||
terminateBackground,
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-mouse-click",
|
||||
window,
|
||||
window: tabmail.currentAboutMessage,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
@ -166,7 +163,7 @@ async function subtest_popup_open_with_click_MV3_event_pages(
|
|||
terminateBackground,
|
||||
actionType: "message_display_action",
|
||||
testType: "open-with-mouse-click",
|
||||
window: messageWindow,
|
||||
window: messageWindow.messageBrowser.contentWindow,
|
||||
};
|
||||
|
||||
await run_popup_test({
|
||||
|
|
|
@ -11,10 +11,18 @@ add_task(async () => {
|
|||
createMessages(folder, 1);
|
||||
let [message] = [...folder.messages];
|
||||
|
||||
let msgLoaded = BrowserTestUtils.waitForEvent(window, "MsgLoaded");
|
||||
window.gFolderTreeView.selectFolder(folder);
|
||||
window.gFolderDisplay.selectViewIndex(0);
|
||||
await msgLoaded;
|
||||
let tabmail = document.getElementById("tabmail");
|
||||
let about3Pane = tabmail.currentAbout3Pane;
|
||||
about3Pane.restoreState({
|
||||
folderPaneVisible: true,
|
||||
folderURI: folder.URI,
|
||||
messagePaneVisible: true,
|
||||
});
|
||||
about3Pane.threadTree.selectedIndex = 0;
|
||||
await BrowserTestUtils.browserLoaded(
|
||||
about3Pane.messageBrowser.contentWindow.content
|
||||
);
|
||||
|
||||
await openMessageInTab(message);
|
||||
await openMessageInWindow(message);
|
||||
await new Promise(resolve => executeSoon(resolve));
|
||||
|
@ -120,16 +128,11 @@ add_task(async () => {
|
|||
|
||||
await extension.startup();
|
||||
|
||||
let tabmail = document.getElementById("tabmail");
|
||||
let mainWindowTabs = tabmail.tabInfo;
|
||||
is(mainWindowTabs.length, 2);
|
||||
|
||||
let mainWindowButton = document.getElementById(
|
||||
"message_display_action_properties_mochi_test-messageDisplayAction-toolbarbutton"
|
||||
);
|
||||
|
||||
let messageWindow = Services.wm.getMostRecentWindow("mail:messageWindow");
|
||||
let messageWindowButton = messageWindow.document.getElementById(
|
||||
let messageWindowButton = messageWindow.messageBrowser.contentDocument.getElementById(
|
||||
"message_display_action_properties_mochi_test-messageDisplayAction-toolbarbutton"
|
||||
);
|
||||
|
||||
|
@ -155,8 +158,17 @@ add_task(async () => {
|
|||
|
||||
for (let i = 0; i < 2; i++) {
|
||||
tabmail.switchToTab(mainWindowTabs[i]);
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
checkButton(mainWindowButton, i);
|
||||
let aboutMessage = mainWindowTabs[i].chromeBrowser.contentWindow;
|
||||
if (aboutMessage.location.href == "about:3pane") {
|
||||
aboutMessage = aboutMessage.messageBrowser.contentWindow;
|
||||
}
|
||||
await new Promise(resolve => aboutMessage.requestAnimationFrame(resolve));
|
||||
checkButton(
|
||||
aboutMessage.document.getElementById(
|
||||
"message_display_action_properties_mochi_test-messageDisplayAction-toolbarbutton"
|
||||
),
|
||||
i
|
||||
);
|
||||
}
|
||||
checkButton(messageWindowButton, 2);
|
||||
|
||||
|
@ -167,6 +179,5 @@ add_task(async () => {
|
|||
await extension.unload();
|
||||
|
||||
messageWindow.close();
|
||||
tabmail.closeTab(mainWindowTabs[1]);
|
||||
is(tabmail.tabInfo.length, 1);
|
||||
tabmail.closeOtherTabs(0);
|
||||
});
|
||||
|
|
|
@ -970,7 +970,7 @@ async function run_popup_test(configData) {
|
|||
|
||||
ok(
|
||||
!Services.xulStore
|
||||
.getValue(win.location.href, toolbarId, "currentset")
|
||||
.getValue(win.top.location.href, toolbarId, "currentset")
|
||||
.split(",")
|
||||
.includes(buttonId),
|
||||
`Button should have been removed from currentset xulStore of toolbar ${toolbarId}`
|
||||
|
|
Загрузка…
Ссылка в новой задаче