зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1543940 - Update tests to use toolbox.topDoc to query context-menu elements r=ochameau
Depends on D27695 Differential Revision: https://phabricator.services.mozilla.com/D27696 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
92f2dbb1c8
Коммит
8aa6f3861d
|
@ -15,7 +15,7 @@ add_task(async function() {
|
||||||
|
|
||||||
const { document, tab, window } = await openAboutDebugging();
|
const { document, tab, window } = await openAboutDebugging();
|
||||||
await selectThisFirefoxPage(document, window.AboutDebugging.store);
|
await selectThisFirefoxPage(document, window.AboutDebugging.store);
|
||||||
const { devtoolsDocument, devtoolsTab, devtoolsWindow } =
|
const { devtoolsTab, devtoolsWindow } =
|
||||||
await openAboutDevtoolsToolbox(document, tab, window);
|
await openAboutDevtoolsToolbox(document, tab, window);
|
||||||
|
|
||||||
info("Select inspector tool");
|
info("Select inspector tool");
|
||||||
|
@ -29,7 +29,7 @@ add_task(async function() {
|
||||||
markupDocument.ownerGlobal);
|
markupDocument.ownerGlobal);
|
||||||
|
|
||||||
info("Check whether proper context menu of markup view will be shown");
|
info("Check whether proper context menu of markup view will be shown");
|
||||||
await waitUntil(() => devtoolsDocument.querySelector("#node-menu-edithtml"));
|
await waitUntil(() => toolbox.topDoc.querySelector("#node-menu-edithtml"));
|
||||||
ok(true, "Context menu of markup view should be shown");
|
ok(true, "Context menu of markup view should be shown");
|
||||||
|
|
||||||
await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
|
await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
|
||||||
|
|
|
@ -82,13 +82,13 @@ async function testMenuPopup(toolbox) {
|
||||||
|
|
||||||
menu.popup(0, 0, toolbox.doc);
|
menu.popup(0, 0, toolbox.doc);
|
||||||
|
|
||||||
ok(toolbox.doc.querySelector("#menu-popup"), "A popup is in the DOM");
|
ok(toolbox.topDoc.querySelector("#menu-popup"), "A popup is in the DOM");
|
||||||
|
|
||||||
const menuSeparators =
|
const menuSeparators =
|
||||||
toolbox.doc.querySelectorAll("#menu-popup > menuseparator");
|
toolbox.topDoc.querySelectorAll("#menu-popup > menuseparator");
|
||||||
is(menuSeparators.length, 1, "A separator is in the menu");
|
is(menuSeparators.length, 1, "A separator is in the menu");
|
||||||
|
|
||||||
const menuItems = toolbox.doc.querySelectorAll("#menu-popup > menuitem");
|
const menuItems = toolbox.topDoc.querySelectorAll("#menu-popup > menuitem");
|
||||||
is(menuItems.length, MENU_ITEMS.length, "Correct number of menuitems");
|
is(menuItems.length, MENU_ITEMS.length, "Correct number of menuitems");
|
||||||
|
|
||||||
is(menuItems[0].id, MENU_ITEMS[0].id, "Correct id for menuitem");
|
is(menuItems[0].id, MENU_ITEMS[0].id, "Correct id for menuitem");
|
||||||
|
@ -109,11 +109,11 @@ async function testMenuPopup(toolbox) {
|
||||||
|
|
||||||
await once(menu, "open");
|
await once(menu, "open");
|
||||||
const closed = once(menu, "close");
|
const closed = once(menu, "close");
|
||||||
EventUtils.synthesizeMouseAtCenter(menuItems[0], {}, toolbox.win);
|
EventUtils.synthesizeMouseAtCenter(menuItems[0], {}, toolbox.topWindow);
|
||||||
await closed;
|
await closed;
|
||||||
ok(clickFired, "Click has fired");
|
ok(clickFired, "Click has fired");
|
||||||
|
|
||||||
ok(!toolbox.doc.querySelector("#menu-popup"), "Popup removed from the DOM");
|
ok(!toolbox.topDoc.querySelector("#menu-popup"), "Popup removed from the DOM");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function testSubmenu(toolbox) {
|
async function testSubmenu(toolbox) {
|
||||||
|
@ -144,11 +144,11 @@ async function testSubmenu(toolbox) {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
menu.popup(0, 0, toolbox.doc);
|
menu.popup(0, 0, toolbox.doc);
|
||||||
ok(toolbox.doc.querySelector("#menu-popup"), "A popup is in the DOM");
|
ok(toolbox.topDoc.querySelector("#menu-popup"), "A popup is in the DOM");
|
||||||
is(toolbox.doc.querySelectorAll("#menu-popup > menuitem").length, 0,
|
is(toolbox.topDoc.querySelectorAll("#menu-popup > menuitem").length, 0,
|
||||||
"No menuitem children");
|
"No menuitem children");
|
||||||
|
|
||||||
const menus = toolbox.doc.querySelectorAll("#menu-popup > menu");
|
const menus = toolbox.topDoc.querySelectorAll("#menu-popup > menu");
|
||||||
is(menus.length, 2, "Correct number of menus");
|
is(menus.length, 2, "Correct number of menus");
|
||||||
ok(!menus[0].hasAttribute("label"), "No label: should be set by localization");
|
ok(!menus[0].hasAttribute("label"), "No label: should be set by localization");
|
||||||
ok(!menus[0].hasAttribute("disabled"), "Correct disabled state");
|
ok(!menus[0].hasAttribute("disabled"), "Correct disabled state");
|
||||||
|
@ -180,7 +180,7 @@ async function testSubmenu(toolbox) {
|
||||||
await shown;
|
await shown;
|
||||||
|
|
||||||
info("Clicking the submenu item");
|
info("Clicking the submenu item");
|
||||||
EventUtils.synthesizeMouseAtCenter(subMenuItems[0], {}, toolbox.win);
|
EventUtils.synthesizeMouseAtCenter(subMenuItems[0], {}, toolbox.topWindow);
|
||||||
|
|
||||||
await closed;
|
await closed;
|
||||||
ok(clickFired, "Click has fired");
|
ok(clickFired, "Click has fired");
|
||||||
|
|
|
@ -33,7 +33,7 @@ add_task(async function checkMenuEntryStates() {
|
||||||
synthesizeContextMenuEvent(inspector.searchBox);
|
synthesizeContextMenuEvent(inspector.searchBox);
|
||||||
await onContextMenuPopup;
|
await onContextMenuPopup;
|
||||||
|
|
||||||
const textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
const textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(textboxContextMenu, "The textbox context menu is loaded in the toolbox");
|
ok(textboxContextMenu, "The textbox context menu is loaded in the toolbox");
|
||||||
|
|
||||||
const cmdUndo = textboxContextMenu.querySelector("#editmenu-undo");
|
const cmdUndo = textboxContextMenu.querySelector("#editmenu-undo");
|
||||||
|
@ -84,7 +84,7 @@ add_task(async function automaticallyBindTexbox() {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function checkNonTextInput(input, toolbox) {
|
async function checkNonTextInput(input, toolbox) {
|
||||||
let textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
let textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(!textboxContextMenu, "The menu is closed");
|
ok(!textboxContextMenu, "The menu is closed");
|
||||||
|
|
||||||
info("Simulating context click on the non text input and expecting no menu to open");
|
info("Simulating context click on the non text input and expecting no menu to open");
|
||||||
|
@ -95,12 +95,12 @@ async function checkNonTextInput(input, toolbox) {
|
||||||
info("Waiting for event");
|
info("Waiting for event");
|
||||||
await eventBubbledUp;
|
await eventBubbledUp;
|
||||||
|
|
||||||
textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(!textboxContextMenu, "The menu is still closed");
|
ok(!textboxContextMenu, "The menu is still closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkTextBox(textBox, toolbox) {
|
async function checkTextBox(textBox, toolbox) {
|
||||||
let textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
let textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(!textboxContextMenu, "The menu is closed");
|
ok(!textboxContextMenu, "The menu is closed");
|
||||||
|
|
||||||
info("Simulating context click on the textbox and expecting the menu to open");
|
info("Simulating context click on the textbox and expecting the menu to open");
|
||||||
|
@ -108,7 +108,7 @@ async function checkTextBox(textBox, toolbox) {
|
||||||
synthesizeContextMenuEvent(textBox);
|
synthesizeContextMenuEvent(textBox);
|
||||||
await onContextMenu;
|
await onContextMenu;
|
||||||
|
|
||||||
textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(textboxContextMenu, "The menu is now visible");
|
ok(textboxContextMenu, "The menu is now visible");
|
||||||
|
|
||||||
info("Closing the menu");
|
info("Closing the menu");
|
||||||
|
@ -116,6 +116,6 @@ async function checkTextBox(textBox, toolbox) {
|
||||||
EventUtils.sendKey("ESCAPE", toolbox.win);
|
EventUtils.sendKey("ESCAPE", toolbox.win);
|
||||||
await onContextMenuHidden;
|
await onContextMenuHidden;
|
||||||
|
|
||||||
textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(!textboxContextMenu, "The menu is closed again");
|
ok(!textboxContextMenu, "The menu is closed again");
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ add_task(async function() {
|
||||||
|
|
||||||
for (const menu of menuList) {
|
for (const menu of menuList) {
|
||||||
const { buttonBounds, menuType, menuBounds, arrowBounds } =
|
const { buttonBounds, menuType, menuBounds, arrowBounds } =
|
||||||
await getButtonAndMenuInfo(toolbox.doc, menu);
|
await getButtonAndMenuInfo(toolbox, menu);
|
||||||
|
|
||||||
switch (menuType) {
|
switch (menuType) {
|
||||||
case "native":
|
case "native":
|
||||||
|
@ -116,7 +116,8 @@ add_task(async function() {
|
||||||
* - arrowBounds {DOMRect|null} Bounds of the arrow. Only set when
|
* - arrowBounds {DOMRect|null} Bounds of the arrow. Only set when
|
||||||
* menuType is "doorhanger", null otherwise.
|
* menuType is "doorhanger", null otherwise.
|
||||||
*/
|
*/
|
||||||
async function getButtonAndMenuInfo(doc, menuButton) {
|
async function getButtonAndMenuInfo(toolbox, menuButton) {
|
||||||
|
const { doc, topDoc } = toolbox;
|
||||||
info("Show popup menu with click event.");
|
info("Show popup menu with click event.");
|
||||||
EventUtils.sendMouseEvent(
|
EventUtils.sendMouseEvent(
|
||||||
{
|
{
|
||||||
|
@ -135,7 +136,7 @@ async function getButtonAndMenuInfo(doc, menuButton) {
|
||||||
await waitUntil(() => menuPopup.classList.contains("tooltip-visible"));
|
await waitUntil(() => menuPopup.classList.contains("tooltip-visible"));
|
||||||
} else {
|
} else {
|
||||||
menuType = "native";
|
menuType = "native";
|
||||||
const popupset = doc.querySelector("popupset");
|
const popupset = topDoc.querySelector("popupset");
|
||||||
await waitUntil(() => {
|
await waitUntil(() => {
|
||||||
menuPopup = popupset.querySelector("menupopup[menu-api=\"true\"]");
|
menuPopup = popupset.querySelector("menupopup[menu-api=\"true\"]");
|
||||||
return !!menuPopup && menuPopup.state === "open";
|
return !!menuPopup && menuPopup.state === "open";
|
||||||
|
|
|
@ -3260,6 +3260,13 @@ Toolbox.prototype = {
|
||||||
menu.popup(x, y, this.doc);
|
menu.popup(x, y, this.doc);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the current textbox context menu, if available.
|
||||||
|
*/
|
||||||
|
getTextBoxContextMenu: function() {
|
||||||
|
return this.topDoc.getElementById("toolbox-menu");
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connects to the Gecko Profiler when the developer tools are open. This is
|
* Connects to the Gecko Profiler when the developer tools are open. This is
|
||||||
* necessary because of the WebConsole's `profile` and `profileEnd` methods.
|
* necessary because of the WebConsole's `profile` and `profileEnd` methods.
|
||||||
|
|
|
@ -29,7 +29,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchField);
|
synthesizeContextMenuEvent(searchField);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
let searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
let searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(searchContextMenu,
|
ok(searchContextMenu,
|
||||||
"The search filter context menu is loaded in the computed view");
|
"The search filter context menu is loaded in the computed view");
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchField);
|
synthesizeContextMenuEvent(searchField);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
cmdCopy = searchContextMenu.querySelector("#editmenu-copy");
|
cmdCopy = searchContextMenu.querySelector("#editmenu-copy");
|
||||||
await waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
|
await waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchField);
|
synthesizeContextMenuEvent(searchField);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
cmdUndo = searchContextMenu.querySelector("#editmenu-undo");
|
cmdUndo = searchContextMenu.querySelector("#editmenu-undo");
|
||||||
cmdDelete = searchContextMenu.querySelector("#editmenu-delete");
|
cmdDelete = searchContextMenu.querySelector("#editmenu-delete");
|
||||||
cmdSelectAll = searchContextMenu.querySelector("#editmenu-selectAll");
|
cmdSelectAll = searchContextMenu.querySelector("#editmenu-selectAll");
|
||||||
|
|
|
@ -28,7 +28,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchField);
|
synthesizeContextMenuEvent(searchField);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
let searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
let searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(searchContextMenu,
|
ok(searchContextMenu,
|
||||||
"The search filter context menu is loaded in the rule view");
|
"The search filter context menu is loaded in the rule view");
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchField);
|
synthesizeContextMenuEvent(searchField);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
cmdCopy = searchContextMenu.querySelector("#editmenu-copy");
|
cmdCopy = searchContextMenu.querySelector("#editmenu-copy");
|
||||||
await waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
|
await waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchField);
|
synthesizeContextMenuEvent(searchField);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
cmdUndo = searchContextMenu.querySelector("#editmenu-undo");
|
cmdUndo = searchContextMenu.querySelector("#editmenu-undo");
|
||||||
cmdDelete = searchContextMenu.querySelector("#editmenu-delete");
|
cmdDelete = searchContextMenu.querySelector("#editmenu-delete");
|
||||||
cmdSelectAll = searchContextMenu.querySelector("#editmenu-selectAll");
|
cmdSelectAll = searchContextMenu.querySelector("#editmenu-selectAll");
|
||||||
|
|
|
@ -25,7 +25,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchBox);
|
synthesizeContextMenuEvent(searchBox);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
let searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
let searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(searchContextMenu,
|
ok(searchContextMenu,
|
||||||
"The search filter context menu is loaded in the computed view");
|
"The search filter context menu is loaded in the computed view");
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchBox);
|
synthesizeContextMenuEvent(searchBox);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
cmdCopy = searchContextMenu.querySelector("#editmenu-copy");
|
cmdCopy = searchContextMenu.querySelector("#editmenu-copy");
|
||||||
await waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
|
await waitForClipboardPromise(() => cmdCopy.click(), TEST_INPUT);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ add_task(async function() {
|
||||||
synthesizeContextMenuEvent(searchBox);
|
synthesizeContextMenuEvent(searchBox);
|
||||||
await onContextMenuOpen;
|
await onContextMenuOpen;
|
||||||
|
|
||||||
searchContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
searchContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
cmdUndo = searchContextMenu.querySelector("#editmenu-undo");
|
cmdUndo = searchContextMenu.querySelector("#editmenu-undo");
|
||||||
cmdDelete = searchContextMenu.querySelector("#editmenu-delete");
|
cmdDelete = searchContextMenu.querySelector("#editmenu-delete");
|
||||||
cmdSelectAll = searchContextMenu.querySelector("#editmenu-selectAll");
|
cmdSelectAll = searchContextMenu.querySelector("#editmenu-selectAll");
|
||||||
|
|
|
@ -81,7 +81,7 @@ add_task(async function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
async function checkTextBox(textBox, toolbox) {
|
async function checkTextBox(textBox, toolbox) {
|
||||||
let textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
let textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(!textboxContextMenu, "The menu is closed");
|
ok(!textboxContextMenu, "The menu is closed");
|
||||||
|
|
||||||
info("Simulating context click on the textbox and expecting the menu to open");
|
info("Simulating context click on the textbox and expecting the menu to open");
|
||||||
|
@ -89,7 +89,7 @@ async function checkTextBox(textBox, toolbox) {
|
||||||
synthesizeContextMenuEvent(textBox);
|
synthesizeContextMenuEvent(textBox);
|
||||||
await onContextMenu;
|
await onContextMenu;
|
||||||
|
|
||||||
textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(textboxContextMenu, "The menu is now visible");
|
ok(textboxContextMenu, "The menu is now visible");
|
||||||
|
|
||||||
info("Closing the menu");
|
info("Closing the menu");
|
||||||
|
@ -97,6 +97,6 @@ async function checkTextBox(textBox, toolbox) {
|
||||||
EventUtils.sendKey("ESCAPE", toolbox.win);
|
EventUtils.sendKey("ESCAPE", toolbox.win);
|
||||||
await onContextMenuHidden;
|
await onContextMenuHidden;
|
||||||
|
|
||||||
textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
ok(!textboxContextMenu, "The menu is closed again");
|
ok(!textboxContextMenu, "The menu is closed again");
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ async function checkContextMenuOnSearchbox(inspector, toolbox) {
|
||||||
synthesizeContextMenuEvent(searchbox);
|
synthesizeContextMenuEvent(searchbox);
|
||||||
await onContextMenu;
|
await onContextMenu;
|
||||||
|
|
||||||
const textboxContextMenu = toolbox.doc.getElementById("toolbox-menu");
|
const textboxContextMenu = toolbox.getTextBoxContextMenu();
|
||||||
info("Wait until menu items are rendered");
|
info("Wait until menu items are rendered");
|
||||||
const pasteElement = textboxContextMenu.querySelector("#editmenu-paste");
|
const pasteElement = textboxContextMenu.querySelector("#editmenu-paste");
|
||||||
await waitUntil(() => !!pasteElement.getAttribute("label"));
|
await waitUntil(() => !!pasteElement.getAttribute("label"));
|
||||||
|
|
|
@ -11,11 +11,10 @@ add_task(async function() {
|
||||||
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, windowRequire, parent } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const {
|
const {
|
||||||
getSelectedRequest,
|
getSelectedRequest,
|
||||||
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
|
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
|
||||||
const parentDocument = parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ add_task(async function() {
|
||||||
info("Captured normal request");
|
info("Captured normal request");
|
||||||
// Mark as blocked
|
// Mark as blocked
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||||
const contextBlock = parentDocument.querySelector("#request-list-context-block-url");
|
const contextBlock = getContextMenuItem(monitor, "request-list-context-block-url");
|
||||||
contextBlock.click();
|
contextBlock.click();
|
||||||
info("Set request to blocked");
|
info("Set request to blocked");
|
||||||
}
|
}
|
||||||
|
@ -64,7 +63,7 @@ add_task(async function() {
|
||||||
// Mark as unblocked
|
// Mark as unblocked
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||||
const contextUnblock =
|
const contextUnblock =
|
||||||
parentDocument.querySelector("#request-list-context-unblock-url");
|
getContextMenuItem(monitor, "request-list-context-unblock-url");
|
||||||
contextUnblock.click();
|
contextUnblock.click();
|
||||||
info("Set request to unblocked");
|
info("Set request to unblocked");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ add_task(async function() {
|
||||||
const { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
const { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, parent, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -51,8 +51,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelector(`#requests-list-${column}-button`));
|
document.querySelector(`#requests-list-${column}-button`));
|
||||||
|
|
||||||
const menuItem =
|
const menuItem = getContextMenuItem(monitor, `request-list-header-${column}-toggle`);
|
||||||
parent.document.querySelector(`#request-list-header-${column}-toggle`);
|
|
||||||
ok(menuItem.disabled, "Last visible column menu item should be disabled.");
|
ok(menuItem.disabled, "Last visible column menu item should be disabled.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ add_task(async function() {
|
||||||
const { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
const { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, parent, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
|
const { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs");
|
||||||
|
|
||||||
const prefBefore = Prefs.visibleColumns;
|
const prefBefore = Prefs.visibleColumns;
|
||||||
|
@ -29,7 +29,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelector("#requests-list-contentSize-button"));
|
document.querySelector("#requests-list-contentSize-button"));
|
||||||
|
|
||||||
parent.document.querySelector("#request-list-header-reset-columns").click();
|
getContextMenuItem(monitor, "request-list-header-reset-columns").click();
|
||||||
await onRequestsFinished;
|
await onRequestsFinished;
|
||||||
|
|
||||||
ok(JSON.stringify(prefBefore) === JSON.stringify(Prefs.visibleColumns),
|
ok(JSON.stringify(prefBefore) === JSON.stringify(Prefs.visibleColumns),
|
||||||
|
|
|
@ -10,7 +10,7 @@ add_task(async function() {
|
||||||
const { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
const { monitor, tab } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, parent, connector, windowRequire } = monitor.panelWin;
|
const { document, store, connector, windowRequire } = monitor.panelWin;
|
||||||
const { requestData } = connector;
|
const { requestData } = connector;
|
||||||
const {
|
const {
|
||||||
getSortedRequests,
|
getSortedRequests,
|
||||||
|
@ -34,28 +34,28 @@ add_task(async function() {
|
||||||
let columns = store.getState().ui.columns;
|
let columns = store.getState().ui.columns;
|
||||||
for (const column in columns) {
|
for (const column in columns) {
|
||||||
if (columns[column]) {
|
if (columns[column]) {
|
||||||
await testVisibleColumnContextMenuItem(column, document, parent);
|
await testVisibleColumnContextMenuItem(column, document, monitor);
|
||||||
testColumnsAlignment(headers, requestsContainer);
|
testColumnsAlignment(headers, requestsContainer);
|
||||||
await testHiddenColumnContextMenuItem(column, document, parent);
|
await testHiddenColumnContextMenuItem(column, document, monitor);
|
||||||
} else {
|
} else {
|
||||||
await testHiddenColumnContextMenuItem(column, document, parent);
|
await testHiddenColumnContextMenuItem(column, document, monitor);
|
||||||
testColumnsAlignment(headers, requestsContainer);
|
testColumnsAlignment(headers, requestsContainer);
|
||||||
await testVisibleColumnContextMenuItem(column, document, parent);
|
await testVisibleColumnContextMenuItem(column, document, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
columns = store.getState().ui.columns;
|
columns = store.getState().ui.columns;
|
||||||
for (const column in columns) {
|
for (const column in columns) {
|
||||||
if (columns[column]) {
|
if (columns[column]) {
|
||||||
await testVisibleColumnContextMenuItem(column, document, parent);
|
await testVisibleColumnContextMenuItem(column, document, monitor);
|
||||||
// Right click on the white-space for the context menu to appear
|
// Right click on the white-space for the context menu to appear
|
||||||
// and toggle column visibility
|
// and toggle column visibility
|
||||||
await testWhiteSpaceContextMenuItem(column, document, parent);
|
await testWhiteSpaceContextMenuItem(column, document, monitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function testWhiteSpaceContextMenuItem(column, document, parent) {
|
async function testWhiteSpaceContextMenuItem(column, document, monitor) {
|
||||||
ok(!document.querySelector(`#requests-list-${column}-button`),
|
ok(!document.querySelector(`#requests-list-${column}-button`),
|
||||||
`Column ${column} should be hidden`);
|
`Column ${column} should be hidden`);
|
||||||
|
|
||||||
|
@ -65,10 +65,10 @@ async function testWhiteSpaceContextMenuItem(column, document, parent) {
|
||||||
|
|
||||||
// Wait for next tick to do stuff async and force repaint.
|
// Wait for next tick to do stuff async and force repaint.
|
||||||
await waitForTick();
|
await waitForTick();
|
||||||
await toggleAndCheckColumnVisibility(column, document, parent);
|
await toggleAndCheckColumnVisibility(column, document, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function testVisibleColumnContextMenuItem(column, document, parent) {
|
async function testVisibleColumnContextMenuItem(column, document, monitor) {
|
||||||
ok(document.querySelector(`#requests-list-${column}-button`),
|
ok(document.querySelector(`#requests-list-${column}-button`),
|
||||||
`Column ${column} should be visible`);
|
`Column ${column} should be visible`);
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ async function testVisibleColumnContextMenuItem(column, document, parent) {
|
||||||
|
|
||||||
await waitForTick();
|
await waitForTick();
|
||||||
|
|
||||||
const menuItem = parent.document.querySelector(`#request-list-header-${column}-toggle`);
|
const menuItem = getContextMenuItem(monitor, `request-list-header-${column}-toggle`);
|
||||||
|
|
||||||
is(menuItem.getAttribute("type"), "checkbox",
|
is(menuItem.getAttribute("type"), "checkbox",
|
||||||
`${column} menu item should have type="checkbox" attribute`);
|
`${column} menu item should have type="checkbox" attribute`);
|
||||||
|
@ -97,7 +97,7 @@ async function testVisibleColumnContextMenuItem(column, document, parent) {
|
||||||
`Column ${column} should be hidden`);
|
`Column ${column} should be hidden`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function testHiddenColumnContextMenuItem(column, document, parent) {
|
async function testHiddenColumnContextMenuItem(column, document, monitor) {
|
||||||
ok(!document.querySelector(`#requests-list-${column}-button`),
|
ok(!document.querySelector(`#requests-list-${column}-button`),
|
||||||
`Column ${column} should be hidden`);
|
`Column ${column} should be hidden`);
|
||||||
|
|
||||||
|
@ -107,11 +107,11 @@ async function testHiddenColumnContextMenuItem(column, document, parent) {
|
||||||
document.querySelector("#requests-list-waterfall-button"));
|
document.querySelector("#requests-list-waterfall-button"));
|
||||||
|
|
||||||
await waitForTick();
|
await waitForTick();
|
||||||
await toggleAndCheckColumnVisibility(column, document, parent);
|
await toggleAndCheckColumnVisibility(column, document, monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toggleAndCheckColumnVisibility(column, document, parent) {
|
async function toggleAndCheckColumnVisibility(column, document, monitor) {
|
||||||
const menuItem = parent.document.querySelector(`#request-list-header-${column}-toggle`);
|
const menuItem = getContextMenuItem(monitor, `request-list-header-${column}-toggle`);
|
||||||
|
|
||||||
is(menuItem.getAttribute("type"), "checkbox",
|
is(menuItem.getAttribute("type"), "checkbox",
|
||||||
`${column} menu item should have type="checkbox" attribute`);
|
`${column} menu item should have type="checkbox" attribute`);
|
||||||
|
|
|
@ -133,8 +133,8 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[0]);
|
document.querySelectorAll(".request-list-item")[0]);
|
||||||
|
|
||||||
/* Ensure that the copy as cURL option is always visible */
|
/* Ensure that the copy as cURL option is always visible */
|
||||||
const copyUrlParamsNode = monitor.panelWin.parent.document
|
const copyUrlParamsNode = getContextMenuItem(monitor,
|
||||||
.querySelector("#request-list-context-copy-as-curl");
|
"request-list-context-copy-as-curl");
|
||||||
is(!!copyUrlParamsNode, true,
|
is(!!copyUrlParamsNode, true,
|
||||||
"The \"Copy as cURL\" context menu item should not be hidden.");
|
"The \"Copy as cURL\" context menu item should not be hidden.");
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[0]);
|
document.querySelectorAll(".request-list-item")[0]);
|
||||||
|
|
||||||
/* Ensure that the copy as fetch option is always visible */
|
/* Ensure that the copy as fetch option is always visible */
|
||||||
const copyAsFetchNode = monitor.panelWin.parent.document
|
const copyAsFetchNode = getContextMenuItem(monitor,
|
||||||
.querySelector("#request-list-context-copy-as-fetch");
|
"request-list-context-copy-as-fetch");
|
||||||
is(!!copyAsFetchNode, true,
|
is(!!copyAsFetchNode, true,
|
||||||
"The \"Copy as Fetch\" context menu item should not be hidden.");
|
"The \"Copy as Fetch\" context menu item should not be hidden.");
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@ add_task(async function() {
|
||||||
].join("\n");
|
].join("\n");
|
||||||
|
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-request-headers").click();
|
||||||
.querySelector("#request-list-context-copy-request-headers").click();
|
|
||||||
}, function validate(result) {
|
}, function validate(result) {
|
||||||
// Sometimes, a "Cookie" header is left over from other tests. Remove it:
|
// Sometimes, a "Cookie" header is left over from other tests. Remove it:
|
||||||
result = String(result).replace(/Cookie: [^\n]+\n/, "");
|
result = String(result).replace(/Cookie: [^\n]+\n/, "");
|
||||||
|
@ -70,8 +69,7 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[0]);
|
document.querySelectorAll(".request-list-item")[0]);
|
||||||
|
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "response-list-context-copy-response-headers").click();
|
||||||
.querySelector("#response-list-context-copy-response-headers").click();
|
|
||||||
}, function validate(result) {
|
}, function validate(result) {
|
||||||
// Fake the "Last-Modified" and "Date" headers because they will vary:
|
// Fake the "Last-Modified" and "Date" headers because they will vary:
|
||||||
result = String(result)
|
result = String(result)
|
||||||
|
|
|
@ -22,8 +22,7 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[5]);
|
document.querySelectorAll(".request-list-item")[5]);
|
||||||
|
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-image-as-data-uri").click();
|
||||||
.querySelector("#request-list-context-copy-image-as-data-uri").click();
|
|
||||||
}, TEST_IMAGE_DATA_URI);
|
}, TEST_IMAGE_DATA_URI);
|
||||||
|
|
||||||
ok(true, "Clipboard contains the currently selected image as data uri.");
|
ok(true, "Clipboard contains the currently selected image as data uri.");
|
||||||
|
|
|
@ -66,8 +66,8 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
const copyUrlParamsNode = monitor.panelWin.parent.document
|
const copyUrlParamsNode = getContextMenuItem(monitor,
|
||||||
.querySelector("#request-list-context-copy-url-params");
|
"request-list-context-copy-url-params");
|
||||||
is(!!copyUrlParamsNode, !hidden,
|
is(!!copyUrlParamsNode, !hidden,
|
||||||
"The \"Copy URL Parameters\" context menu item should" + (hidden ? " " : " not ") +
|
"The \"Copy URL Parameters\" context menu item should" + (hidden ? " " : " not ") +
|
||||||
"be hidden.");
|
"be hidden.");
|
||||||
|
@ -79,8 +79,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-url-params").click();
|
||||||
.querySelector("#request-list-context-copy-url-params").click();
|
|
||||||
}, queryString);
|
}, queryString);
|
||||||
ok(true, "The url query string copied from the selected item is correct.");
|
ok(true, "The url query string copied from the selected item is correct.");
|
||||||
}
|
}
|
||||||
|
@ -90,8 +89,8 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
const copyPostDataNode = monitor.panelWin.parent.document
|
const copyPostDataNode = getContextMenuItem(monitor,
|
||||||
.querySelector("#request-list-context-copy-post-data");
|
"request-list-context-copy-post-data");
|
||||||
is(!!copyPostDataNode, !hidden,
|
is(!!copyPostDataNode, !hidden,
|
||||||
"The \"Copy POST Data\" context menu item should" + (hidden ? " " : " not ") +
|
"The \"Copy POST Data\" context menu item should" + (hidden ? " " : " not ") +
|
||||||
"be hidden.");
|
"be hidden.");
|
||||||
|
@ -102,8 +101,8 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
const copyPostDataNode = monitor.panelWin.parent.document
|
const copyPostDataNode = getContextMenuItem(monitor,
|
||||||
.querySelector("#request-list-context-copy-post-data");
|
"request-list-context-copy-post-data");
|
||||||
is(copyPostDataNode.attributes.label.value, "Copy " + method + " Data",
|
is(copyPostDataNode.attributes.label.value, "Copy " + method + " Data",
|
||||||
"The \"Copy Data\" context menu item should have label - Copy " + method + " Data");
|
"The \"Copy Data\" context menu item should have label - Copy " + method + " Data");
|
||||||
}
|
}
|
||||||
|
@ -122,8 +121,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[index]);
|
document.querySelectorAll(".request-list-item")[index]);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-post-data").click();
|
||||||
.querySelector("#request-list-context-copy-post-data").click();
|
|
||||||
}, postData);
|
}, postData);
|
||||||
ok(true, "The post data string copied from the selected item is correct.");
|
ok(true, "The post data string copied from the selected item is correct.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,8 +24,7 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[3]);
|
document.querySelectorAll(".request-list-item")[3]);
|
||||||
|
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-response").click();
|
||||||
.querySelector("#request-list-context-copy-response").click();
|
|
||||||
}, EXPECTED_RESULT);
|
}, EXPECTED_RESULT);
|
||||||
|
|
||||||
await teardown(monitor);
|
await teardown(monitor);
|
||||||
|
|
|
@ -27,8 +27,7 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[0]);
|
document.querySelectorAll(".request-list-item")[0]);
|
||||||
|
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-image-as-data-uri").click();
|
||||||
.querySelector("#request-list-context-copy-image-as-data-uri").click();
|
|
||||||
}, function check(text) {
|
}, function check(text) {
|
||||||
return text.startsWith("data:") && !/undefined/.test(text);
|
return text.startsWith("data:") && !/undefined/.test(text);
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,8 +27,7 @@ add_task(async function() {
|
||||||
const requestItem = getSortedRequests(store.getState()).get(0);
|
const requestItem = getSortedRequests(store.getState()).get(0);
|
||||||
|
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-copy-url").click();
|
||||||
.querySelector("#request-list-context-copy-url").click();
|
|
||||||
}, requestItem.url);
|
}, requestItem.url);
|
||||||
|
|
||||||
await teardown(monitor);
|
await teardown(monitor);
|
||||||
|
|
|
@ -11,11 +11,10 @@ add_task(async function() {
|
||||||
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, windowRequire, parent } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const {
|
const {
|
||||||
getSelectedRequest,
|
getSelectedRequest,
|
||||||
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
|
} = windowRequire("devtools/client/netmonitor/src/selectors/index");
|
||||||
const parentDocument = parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -31,7 +30,7 @@ add_task(async function() {
|
||||||
await waitForHeaders;
|
await waitForHeaders;
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||||
const firstRequestState = getSelectedRequest(store.getState());
|
const firstRequestState = getSelectedRequest(store.getState());
|
||||||
const contextResend = parentDocument.querySelector("#request-list-context-resend");
|
const contextResend = getContextMenuItem(monitor, "request-list-context-resend");
|
||||||
contextResend.click();
|
contextResend.click();
|
||||||
|
|
||||||
// Waits for "Edit & Resend" panel to appear > New request "Cancel"
|
// Waits for "Edit & Resend" panel to appear > New request "Cancel"
|
||||||
|
|
|
@ -15,8 +15,7 @@ add_task(async function() {
|
||||||
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
const { tab, monitor } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, windowRequire, parent } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const parentDocument = parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -34,7 +33,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||||
|
|
||||||
// Open "New Request" form
|
// Open "New Request" form
|
||||||
const contextResend = parentDocument.querySelector("#request-list-context-resend");
|
const contextResend = getContextMenuItem(monitor, "request-list-context-resend");
|
||||||
contextResend.click();
|
contextResend.click();
|
||||||
await waitUntil(() => document.querySelector("#custom-headers-value"));
|
await waitUntil(() => document.querySelector("#custom-headers-value"));
|
||||||
const headersTextarea = document.querySelector("#custom-headers-value");
|
const headersTextarea = document.querySelector("#custom-headers-value");
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
const { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
||||||
|
|
||||||
const { document, store, windowRequire, parent } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const parentDocument = parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -32,7 +31,7 @@ add_task(async function() {
|
||||||
|
|
||||||
// Open context menu and execute "Edit & Resend".
|
// Open context menu and execute "Edit & Resend".
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequestItem);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequestItem);
|
||||||
parentDocument.querySelector("#request-list-context-resend").click();
|
getContextMenuItem(monitor, "request-list-context-resend").click();
|
||||||
|
|
||||||
// Click Resend
|
// Click Resend
|
||||||
await waitUntil(() => document.querySelector("#custom-request-send-button"));
|
await waitUntil(() => document.querySelector("#custom-request-send-button"));
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
const { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
||||||
|
|
||||||
const { document, store, windowRequire, parent } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const parentDocument = parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ add_task(async function() {
|
||||||
|
|
||||||
// Context Menu > "Edit & Resend"
|
// Context Menu > "Edit & Resend"
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequest);
|
||||||
parentDocument.querySelector("#request-list-context-resend").click();
|
getContextMenuItem(monitor, "request-list-context-resend").click();
|
||||||
|
|
||||||
// Waits for "Edit & Resend" panel to appear > New request "Send"
|
// Waits for "Edit & Resend" panel to appear > New request "Send"
|
||||||
document.querySelector("#custom-request-send-button").click();
|
document.querySelector("#custom-request-send-button").click();
|
||||||
|
|
|
@ -12,7 +12,6 @@ add_task(async function() {
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const contextMenuDoc = monitor.panelWin.parent.document;
|
|
||||||
// Avoid async processing
|
// Avoid async processing
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
@ -20,15 +19,15 @@ add_task(async function() {
|
||||||
// Execute requests.
|
// Execute requests.
|
||||||
await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||||
|
|
||||||
wait = waitForDOM(contextMenuDoc, "#request-list-context-open-in-debugger");
|
|
||||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||||
document.querySelectorAll(".request-list-item")[2]);
|
document.querySelectorAll(".request-list-item")[2]);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[2]);
|
document.querySelectorAll(".request-list-item")[2]);
|
||||||
await wait;
|
await waitUntil(() =>
|
||||||
|
getContextMenuItem(monitor, "request-list-context-open-in-debugger"));
|
||||||
|
|
||||||
const onDebuggerReady = toolbox.once("jsdebugger-ready");
|
const onDebuggerReady = toolbox.once("jsdebugger-ready");
|
||||||
contextMenuDoc.querySelector("#request-list-context-open-in-debugger").click();
|
getContextMenuItem(monitor, "request-list-context-open-in-debugger").click();
|
||||||
await onDebuggerReady;
|
await onDebuggerReady;
|
||||||
|
|
||||||
ok(true, "Debugger has been open");
|
ok(true, "Debugger has been open");
|
||||||
|
|
|
@ -12,7 +12,6 @@ add_task(async function() {
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const contextMenuDoc = monitor.panelWin.parent.document;
|
|
||||||
// Avoid async processing
|
// Avoid async processing
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
@ -20,16 +19,15 @@ add_task(async function() {
|
||||||
// Execute requests.
|
// Execute requests.
|
||||||
await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS);
|
||||||
|
|
||||||
wait = waitForDOM(contextMenuDoc, "#request-list-context-open-in-style-editor");
|
|
||||||
EventUtils.sendMouseEvent({ type: "mousedown" },
|
EventUtils.sendMouseEvent({ type: "mousedown" },
|
||||||
document.querySelectorAll(".request-list-item")[1]);
|
document.querySelectorAll(".request-list-item")[1]);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelectorAll(".request-list-item")[1]);
|
document.querySelectorAll(".request-list-item")[1]);
|
||||||
await wait;
|
await waitUntil(() =>
|
||||||
|
getContextMenuItem(monitor, "request-list-context-open-in-style-editor"));
|
||||||
|
|
||||||
const onStyleEditorReady = toolbox.once("styleeditor-ready");
|
const onStyleEditorReady = toolbox.once("styleeditor-ready");
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-open-in-style-editor").click();
|
||||||
.querySelector("#request-list-context-open-in-style-editor").click();
|
|
||||||
await onStyleEditorReady;
|
await onStyleEditorReady;
|
||||||
|
|
||||||
ok(true, "Style Editor has been open");
|
ok(true, "Style Editor has been open");
|
||||||
|
|
|
@ -12,7 +12,6 @@ add_task(async function() {
|
||||||
info("Starting test...");
|
info("Starting test...");
|
||||||
|
|
||||||
const { document, store, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const contextMenuDoc = monitor.panelWin.parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
let newTab;
|
let newTab;
|
||||||
|
|
||||||
|
@ -46,16 +45,15 @@ add_task(async function() {
|
||||||
|
|
||||||
// OpenLastRequestInTab by ContextMenu
|
// OpenLastRequestInTab by ContextMenu
|
||||||
async function openLastRequestInTab() {
|
async function openLastRequestInTab() {
|
||||||
const wait = waitForDOM(contextMenuDoc, "#request-list-context-newtab");
|
|
||||||
const requestItems = document.querySelectorAll(".request-list-item");
|
const requestItems = document.querySelectorAll(".request-list-item");
|
||||||
const lastRequest = requestItems[requestItems.length - 1];
|
const lastRequest = requestItems[requestItems.length - 1];
|
||||||
EventUtils.sendMouseEvent({ type: "mousedown" }, lastRequest);
|
EventUtils.sendMouseEvent({ type: "mousedown" }, lastRequest);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, lastRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, lastRequest);
|
||||||
await wait;
|
await waitUntil(() =>
|
||||||
|
getContextMenuItem(monitor, "request-list-context-newtab"));
|
||||||
|
|
||||||
const onTabOpen = once(gBrowser.tabContainer, "TabOpen", false);
|
const onTabOpen = once(gBrowser.tabContainer, "TabOpen", false);
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "request-list-context-newtab").click();
|
||||||
.querySelector("#request-list-context-newtab").click();
|
|
||||||
await onTabOpen;
|
await onTabOpen;
|
||||||
info("A new tab has been opened");
|
info("A new tab has been opened");
|
||||||
|
|
||||||
|
|
|
@ -33,16 +33,14 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
objectRow);
|
objectRow);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "properties-view-context-menu-copy").click();
|
||||||
.querySelector("#properties-view-context-menu-copy").click();
|
|
||||||
}, `{"obj":{"type":"string"}}`);
|
}, `{"obj":{"type":"string"}}`);
|
||||||
|
|
||||||
/* Test for copy all */
|
/* Test for copy all */
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
objectRow);
|
objectRow);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "properties-view-context-menu-copyall").click();
|
||||||
.querySelector("#properties-view-context-menu-copyall").click();
|
|
||||||
}, `{"JSON":{"obj":{"type":"string"}},` +
|
}, `{"JSON":{"obj":{"type":"string"}},` +
|
||||||
`"Response payload":{"EDITOR_CONFIG":{"text":` +
|
`"Response payload":{"EDITOR_CONFIG":{"text":` +
|
||||||
`"{\\"obj\\": {\\"type\\": \\"string\\" }}","mode":"application/json"}}}`);
|
`"{\\"obj\\": {\\"type\\": \\"string\\" }}","mode":"application/json"}}}`);
|
||||||
|
@ -51,8 +49,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
stringRow);
|
stringRow);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "properties-view-context-menu-copy").click();
|
||||||
.querySelector("#properties-view-context-menu-copy").click();
|
|
||||||
}, "type: string");
|
}, "type: string");
|
||||||
|
|
||||||
await teardown(monitor);
|
await teardown(monitor);
|
||||||
|
@ -100,8 +97,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
cur);
|
cur);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "properties-view-context-menu-copy").click();
|
||||||
.querySelector("#properties-view-context-menu-copy").click();
|
|
||||||
}, JSON.stringify(expectedResponseCookies[i]));
|
}, JSON.stringify(expectedResponseCookies[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +107,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
cur);
|
cur);
|
||||||
await waitForClipboardPromise(function setup() {
|
await waitForClipboardPromise(function setup() {
|
||||||
monitor.panelWin.parent.document
|
getContextMenuItem(monitor, "properties-view-context-menu-copy").click();
|
||||||
.querySelector("#properties-view-context-menu-copy").click();
|
|
||||||
}, expectedRequestCookies[i]);
|
}, expectedRequestCookies[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
const { tab, monitor } = await initNetMonitor(POST_RAW_URL);
|
||||||
|
|
||||||
const { document, store, windowRequire, parent } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const parentDocument = parent.document;
|
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
store.dispatch(Actions.batchEnable(false));
|
store.dispatch(Actions.batchEnable(false));
|
||||||
|
|
||||||
|
@ -29,7 +28,7 @@ add_task(async function() {
|
||||||
|
|
||||||
// Context Menu > "Resend"
|
// Context Menu > "Resend"
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||||
parentDocument.querySelector("#request-list-context-resend-only").click();
|
getContextMenuItem(monitor, "request-list-context-resend-only").click();
|
||||||
|
|
||||||
// Selects request that was resent
|
// Selects request that was resent
|
||||||
const selectedRequest = getSelectedRequest(store.getState());
|
const selectedRequest = getSelectedRequest(store.getState());
|
||||||
|
|
|
@ -17,7 +17,7 @@ add_task(async function() {
|
||||||
// of the heavy dom manipulation associated with sorting.
|
// of the heavy dom manipulation associated with sorting.
|
||||||
requestLongerTimeout(2);
|
requestLongerTimeout(2);
|
||||||
|
|
||||||
const { parent, document, store, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
const Actions = windowRequire("devtools/client/netmonitor/src/actions/index");
|
||||||
const {
|
const {
|
||||||
getDisplayedRequests,
|
getDisplayedRequests,
|
||||||
|
@ -69,7 +69,7 @@ add_task(async function() {
|
||||||
info("Testing sort reset using context menu 'Reset Sorting'");
|
info("Testing sort reset using context menu 'Reset Sorting'");
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelector("#requests-list-contentSize-button"));
|
document.querySelector("#requests-list-contentSize-button"));
|
||||||
parent.document.querySelector("#request-list-header-reset-sorting").click();
|
getContextMenuItem(monitor, "request-list-header-reset-sorting").click();
|
||||||
testHeaders();
|
testHeaders();
|
||||||
await testContents([0, 2, 4, 3, 1]);
|
await testContents([0, 2, 4, 3, 1]);
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ add_task(async function() {
|
||||||
info("Testing sort reset using context menu 'Reset Columns'");
|
info("Testing sort reset using context menu 'Reset Columns'");
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelector("#requests-list-contentSize-button"));
|
document.querySelector("#requests-list-contentSize-button"));
|
||||||
parent.document.querySelector("#request-list-header-reset-columns").click();
|
getContextMenuItem(monitor, "request-list-header-reset-columns").click();
|
||||||
testHeaders();
|
testHeaders();
|
||||||
// add columns because verifyRequestItemTarget expects some extra columns
|
// add columns because verifyRequestItemTarget expects some extra columns
|
||||||
showColumn(monitor, "protocol");
|
showColumn(monitor, "protocol");
|
||||||
|
|
|
@ -39,7 +39,7 @@ add_task(async function() {
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest);
|
||||||
|
|
||||||
// Open "New Request" form and resend.
|
// Open "New Request" form and resend.
|
||||||
monitor.panelWin.parent.document.querySelector("#request-list-context-resend").click();
|
getContextMenuItem(monitor, "request-list-context-resend").click();
|
||||||
await waitUntil(() => document.querySelector("#custom-request-send-button"));
|
await waitUntil(() => document.querySelector("#custom-request-send-button"));
|
||||||
document.querySelector("#custom-request-send-button").click();
|
document.querySelector("#custom-request-send-button").click();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ const ALL_CHANNELS = Ci.nsITelemetry.DATASET_ALL_CHANNELS;
|
||||||
* Test the throttle_change telemetry event.
|
* Test the throttle_change telemetry event.
|
||||||
*/
|
*/
|
||||||
add_task(async function() {
|
add_task(async function() {
|
||||||
const { monitor } = await initNetMonitor(SIMPLE_URL);
|
const { monitor, toolbox } = await initNetMonitor(SIMPLE_URL);
|
||||||
info("Starting test... ");
|
info("Starting test... ");
|
||||||
|
|
||||||
const { document, store, windowRequire } = monitor.panelWin;
|
const { document, store, windowRequire } = monitor.panelWin;
|
||||||
|
@ -26,7 +26,10 @@ add_task(async function() {
|
||||||
ok(!snapshot.parent, "No events have been logged for the main process");
|
ok(!snapshot.parent, "No events have been logged for the main process");
|
||||||
|
|
||||||
document.getElementById("network-throttling-menu").click();
|
document.getElementById("network-throttling-menu").click();
|
||||||
monitor.panelWin.parent.document.querySelector("menuitem[label='GPRS']").click();
|
// Throttling menu items cannot be retrieved by id so we can't use getContextMenuItem
|
||||||
|
// here. Instead use querySelector on the toolbox top document, where the context menu
|
||||||
|
// will be rendered.
|
||||||
|
toolbox.topWindow.document.querySelector("menuitem[label='GPRS']").click();
|
||||||
await waitFor(monitor.panelWin.api, EVENTS.THROTTLING_CHANGED);
|
await waitFor(monitor.panelWin.api, EVENTS.THROTTLING_CHANGED);
|
||||||
|
|
||||||
// Verify existence of the telemetry event.
|
// Verify existence of the telemetry event.
|
||||||
|
|
|
@ -53,8 +53,8 @@ add_task(async function() {
|
||||||
document.querySelectorAll(".request-list-item")[0]);
|
document.querySelectorAll(".request-list-item")[0]);
|
||||||
|
|
||||||
/* Ensure that the use as fetch option is always visible */
|
/* Ensure that the use as fetch option is always visible */
|
||||||
const useAsFetchNode = monitor.panelWin.parent.document
|
const useAsFetchNode = getContextMenuItem(monitor,
|
||||||
.querySelector("#request-list-context-use-as-fetch");
|
"request-list-context-use-as-fetch");
|
||||||
is(!!useAsFetchNode, true,
|
is(!!useAsFetchNode, true,
|
||||||
"The \"Use as Fetch\" context menu item should not be hidden.");
|
"The \"Use as Fetch\" context menu item should not be hidden.");
|
||||||
|
|
||||||
|
|
|
@ -730,14 +730,14 @@ function testColumnsAlignment(headers, requestList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hideColumn(monitor, column) {
|
async function hideColumn(monitor, column) {
|
||||||
const { document, parent } = monitor.panelWin;
|
const { document } = monitor.panelWin;
|
||||||
|
|
||||||
info(`Clicking context-menu item for ${column}`);
|
info(`Clicking context-menu item for ${column}`);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelector(".requests-list-headers"));
|
document.querySelector(".requests-list-headers"));
|
||||||
|
|
||||||
const onHeaderRemoved = waitForDOM(document, `#requests-list-${column}-button`, 0);
|
const onHeaderRemoved = waitForDOM(document, `#requests-list-${column}-button`, 0);
|
||||||
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();
|
getContextMenuItem(monitor, `request-list-header-${column}-toggle`).click();
|
||||||
await onHeaderRemoved;
|
await onHeaderRemoved;
|
||||||
|
|
||||||
ok(!document.querySelector(`#requests-list-${column}-button`),
|
ok(!document.querySelector(`#requests-list-${column}-button`),
|
||||||
|
@ -745,14 +745,14 @@ async function hideColumn(monitor, column) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function showColumn(monitor, column) {
|
async function showColumn(monitor, column) {
|
||||||
const { document, parent } = monitor.panelWin;
|
const { document } = monitor.panelWin;
|
||||||
|
|
||||||
info(`Clicking context-menu item for ${column}`);
|
info(`Clicking context-menu item for ${column}`);
|
||||||
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
EventUtils.sendMouseEvent({ type: "contextmenu" },
|
||||||
document.querySelector(".requests-list-headers"));
|
document.querySelector(".requests-list-headers"));
|
||||||
|
|
||||||
const onHeaderAdded = waitForDOM(document, `#requests-list-${column}-button`, 1);
|
const onHeaderAdded = waitForDOM(document, `#requests-list-${column}-button`, 1);
|
||||||
parent.document.querySelector(`#request-list-header-${column}-toggle`).click();
|
getContextMenuItem(monitor, `request-list-header-${column}-toggle`).click();
|
||||||
await onHeaderAdded;
|
await onHeaderAdded;
|
||||||
|
|
||||||
ok(document.querySelector(`#requests-list-${column}-button`),
|
ok(document.querySelector(`#requests-list-${column}-button`),
|
||||||
|
@ -867,3 +867,12 @@ function queryTelemetryEvents(query) {
|
||||||
// Return the `extra` field (which is event[5]e).
|
// Return the `extra` field (which is event[5]e).
|
||||||
return filtersChangedEvents.map(event => event[5]);
|
return filtersChangedEvents.map(event => event[5]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve the context menu element corresponding to the provided id, for the provided
|
||||||
|
* netmonitor instance.
|
||||||
|
*/
|
||||||
|
function getContextMenuItem(monitor, id) {
|
||||||
|
const Menu = require("devtools/client/framework/menu");
|
||||||
|
return Menu.getMenuElementById(id, monitor.panelWin.document);
|
||||||
|
}
|
||||||
|
|
|
@ -32,12 +32,6 @@ class NetworkThrottlingMenu extends PureComponent {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static get defaultProps() {
|
|
||||||
return {
|
|
||||||
useTopLevelWindow: false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.onShowThrottlingMenu = this.onShowThrottlingMenu.bind(this);
|
this.onShowThrottlingMenu = this.onShowThrottlingMenu.bind(this);
|
||||||
|
@ -68,7 +62,7 @@ class NetworkThrottlingMenu extends PureComponent {
|
||||||
click: () => onChangeNetworkThrottling(false, ""),
|
click: () => onChangeNetworkThrottling(false, ""),
|
||||||
});
|
});
|
||||||
|
|
||||||
showMenu(menuItems, { button: event.target, useTopLevelWindow });
|
showMenu(menuItems, { button: event.target });
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -32,5 +32,5 @@ async function openTextBoxContextMenu(toolbox, element) {
|
||||||
const onConsoleMenuOpened = toolbox.once("menu-open");
|
const onConsoleMenuOpened = toolbox.once("menu-open");
|
||||||
synthesizeContextMenuEvent(element);
|
synthesizeContextMenuEvent(element);
|
||||||
await onConsoleMenuOpened;
|
await onConsoleMenuOpened;
|
||||||
return toolbox.doc.getElementById("toolbox-menu");
|
return toolbox.getTextBoxContextMenu();
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,8 +297,7 @@ async function openContextMenu(hud, element) {
|
||||||
const onConsoleMenuOpened = hud.ui.wrapper.once("menu-open");
|
const onConsoleMenuOpened = hud.ui.wrapper.once("menu-open");
|
||||||
synthesizeContextMenuEvent(element);
|
synthesizeContextMenuEvent(element);
|
||||||
await onConsoleMenuOpened;
|
await onConsoleMenuOpened;
|
||||||
const doc = hud.chromeWindow.document;
|
return _getContextMenu(hud);
|
||||||
return doc.getElementById("webconsole-menu");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -310,8 +309,7 @@ async function openContextMenu(hud, element) {
|
||||||
* @return promise
|
* @return promise
|
||||||
*/
|
*/
|
||||||
function hideContextMenu(hud) {
|
function hideContextMenu(hud) {
|
||||||
const doc = hud.chromeWindow.document;
|
const popup = _getContextMenu(hud);
|
||||||
const popup = doc.getElementById("webconsole-menu");
|
|
||||||
if (!popup) {
|
if (!popup) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -321,6 +319,12 @@ function hideContextMenu(hud) {
|
||||||
return onPopupHidden;
|
return onPopupHidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _getContextMenu(hud) {
|
||||||
|
const toolbox = gDevTools.getToolbox(hud.target);
|
||||||
|
const doc = toolbox ? toolbox.topWindow.document : hud.chromeWindow.document;
|
||||||
|
return doc.getElementById("webconsole-menu");
|
||||||
|
}
|
||||||
|
|
||||||
function loadDocument(url, browser = gBrowser.selectedBrowser) {
|
function loadDocument(url, browser = gBrowser.selectedBrowser) {
|
||||||
BrowserTestUtils.loadURI(browser, url);
|
BrowserTestUtils.loadURI(browser, url);
|
||||||
return BrowserTestUtils.browserLoaded(browser);
|
return BrowserTestUtils.browserLoaded(browser);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче