Bug 1445780: Part 2 - Remove CPOW usage in WebExtension tests. r=aswan

MozReview-Commit-ID: I27tO3K1E9r

--HG--
extra : rebase_source : 254a5d1482d0594269aaadae225499e83703c8ba
This commit is contained in:
Kris Maglione 2018-03-14 15:08:52 -07:00
parent ef176184cb
commit 62cdcecdd3
5 changed files with 8 additions and 13 deletions

View File

@ -79,7 +79,6 @@ skip-if = (os == 'win' && !debug) # bug 1352668
[browser_ext_contextMenus_radioGroups.js]
[browser_ext_contextMenus_uninstall.js]
[browser_ext_contextMenus_urlPatterns.js]
uses-unsafe-cpows = true
[browser_ext_currentWindow.js]
[browser_ext_devtools_inspectedWindow.js]
[browser_ext_devtools_inspectedWindow_eval_bindings.js]
@ -101,10 +100,8 @@ skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_ext_incognito_popup.js]
[browser_ext_lastError.js]
[browser_ext_menus.js]
uses-unsafe-cpows = true
[browser_ext_menus_event_order.js]
[browser_ext_menus_events.js]
uses-unsafe-cpows = true
[browser_ext_menus_refresh.js]
[browser_ext_omnibox.js]
skip-if = debug && (os == 'linux' || os == 'mac') # Bug 1417052

View File

@ -256,7 +256,7 @@ add_task(async function() {
await confirmContextMenuItems(contextMenu, expected);
await closeContextMenu();
contextMenu = await openContextMenuInFrame("frame");
contextMenu = await openContextMenuInFrame("#frame");
expected = [
["documentUrlPatterns-patternMatches-contextAll", true],
["documentUrlPatterns-patternMatches-contextFrame", true],

View File

@ -250,9 +250,9 @@ add_task(async function test_onclick_frameid() {
await extension.startup();
await extension.awaitMessage("ready");
async function click(selectorOrId) {
const func = (selectorOrId == "body") ? openContextMenu : openContextMenuInFrame;
const menu = await func(selectorOrId);
async function click(selector) {
const func = selector === "body" ? openContextMenu : openContextMenuInFrame;
const menu = await func(selector);
const items = menu.getElementsByAttribute("label", "modify");
await closeExtensionContextMenu(items[0]);
return extension.awaitMessage("click");
@ -260,7 +260,7 @@ add_task(async function test_onclick_frameid() {
let info = await click("body");
is(info.frameId, 0, "top level click");
info = await click("frame");
info = await click("#frame");
isnot(info.frameId, undefined, "frame click, frameId is not undefined");
isnot(info.frameId, 0, "frame click, frameId probably okay");

View File

@ -357,7 +357,7 @@ add_task(async function test_show_hide_frame() {
let {contentWindow} = content.document.getElementById("frame");
return WebNavigationFrames.getFrameId(contentWindow);
});
await openContextMenuInFrame("frame");
await openContextMenuInFrame("#frame");
},
async doCloseMenu() {
await closeExtensionContextMenu();

View File

@ -289,12 +289,10 @@ async function openContextMenuInSidebar(selector = "body") {
return contentAreaContextMenu;
}
async function openContextMenuInFrame(frameId) {
async function openContextMenuInFrame(frameSelector) {
let contentAreaContextMenu = document.getElementById("contentAreaContextMenu");
let popupShownPromise = BrowserTestUtils.waitForEvent(contentAreaContextMenu, "popupshown");
let doc = gBrowser.selectedBrowser.contentDocumentAsCPOW;
let frame = doc.getElementById(frameId);
EventUtils.synthesizeMouseAtCenter(frame.contentDocument.body, {type: "contextmenu"}, frame.contentWindow);
await BrowserTestUtils.synthesizeMouseAtCenter([frameSelector, "body"], {type: "contextmenu"}, gBrowser.selectedBrowser);
await popupShownPromise;
return contentAreaContextMenu;
}