diff --git a/accessible/tests/browser/events/browser_test_focus_urlbar.js b/accessible/tests/browser/events/browser_test_focus_urlbar.js index dac286955796..874a0e239bd5 100644 --- a/accessible/tests/browser/events/browser_test_focus_urlbar.js +++ b/accessible/tests/browser/events/browser_test_focus_urlbar.js @@ -280,7 +280,7 @@ async function runTests() { nsIAccessibleEvent.EVENT_MENUPOPUP_START, isEventForMenuPopup ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, gURLBar.querySelector("moz-input-box") ); diff --git a/browser/base/content/test/backforward/browser_longpress_session_history_menu.js b/browser/base/content/test/backforward/browser_longpress_session_history_menu.js index 33636ae5857f..d3ccd6ccdc0e 100644 --- a/browser/base/content/test/backforward/browser_longpress_session_history_menu.js +++ b/browser/base/content/test/backforward/browser_longpress_session_history_menu.js @@ -57,7 +57,10 @@ add_task(async function restore_history_entry_by_middle_click() { "SSTabRestored" ); - EventUtils.sendMouseEvent({ type: "click", button: 1 }, historyMenuItem); + await EventUtils.sendMouseEvent( + { type: "click", button: 1 }, + historyMenuItem + ); info("Waiting for history menu to be hidden"); await popupHiddenPromise; diff --git a/browser/components/downloads/test/browser/browser_downloads_panel_block.js b/browser/components/downloads/test/browser/browser_downloads_panel_block.js index e1d513ffef5f..7e0678205c26 100644 --- a/browser/components/downloads/test/browser/browser_downloads_panel_block.js +++ b/browser/components/downloads/test/browser/browser_downloads_panel_block.js @@ -22,7 +22,7 @@ add_task(async function mainTest() { // Open the panel and click the item to show the subview. let viewPromise = promiseViewShown(DownloadsBlockedSubview.subview); - EventUtils.sendMouseEvent({ type: "click" }, item); + await EventUtils.sendMouseEvent({ type: "click" }, item); await viewPromise; // Items are listed in newest-to-oldest order, so e.g. the first item's @@ -39,7 +39,7 @@ add_task(async function mainTest() { // Show the subview again. viewPromise = promiseViewShown(DownloadsBlockedSubview.subview); - EventUtils.sendMouseEvent({ type: "click" }, item); + await EventUtils.sendMouseEvent({ type: "click" }, item); await viewPromise; // Click the Open button. The download should be unblocked and then opened, @@ -64,7 +64,7 @@ add_task(async function mainTest() { await openPanel(); viewPromise = promiseViewShown(DownloadsBlockedSubview.subview); - EventUtils.sendMouseEvent({ type: "click" }, item); + await EventUtils.sendMouseEvent({ type: "click" }, item); await viewPromise; // Click the Remove button. The panel should close and the item should be diff --git a/browser/components/downloads/test/browser/browser_overflow_anchor.js b/browser/components/downloads/test/browser/browser_overflow_anchor.js index e92046775a02..e07140c7a271 100644 --- a/browser/components/downloads/test/browser/browser_overflow_anchor.js +++ b/browser/components/downloads/test/browser/browser_overflow_anchor.js @@ -33,7 +33,10 @@ add_task(async function test_overflow_anchor() { await gCustomizeMode.addToPanel(button.node); let promise = promisePanelOpened(); - EventUtils.sendMouseEvent({ type: "mousedown", button: 0 }, button.node); + await EventUtils.sendMouseEvent( + { type: "mousedown", button: 0 }, + button.node + ); info("waiting for panel to open"); await promise; @@ -52,7 +55,10 @@ add_task(async function test_overflow_anchor() { // Now try opening the panel again. promise = promisePanelOpened(); - EventUtils.sendMouseEvent({ type: "mousedown", button: 0 }, button.node); + await EventUtils.sendMouseEvent( + { type: "mousedown", button: 0 }, + button.node + ); await promise; let downloadsAnchor = button.node.badgeStack; diff --git a/browser/components/sessionstore/test/browser_frame_history.js b/browser/components/sessionstore/test/browser_frame_history.js index 8ebfb931e27d..e61edb64507d 100644 --- a/browser/components/sessionstore/test/browser_frame_history.js +++ b/browser/components/sessionstore/test/browser_frame_history.js @@ -31,7 +31,7 @@ add_task(async function() { // We're going to click on the first link, so listen for another load event info("Clicking on link 1, 1 load should take place"); let promise = waitForLoadsInBrowser(tab.linkedBrowser, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, links[0], browser_b.contentWindow @@ -40,7 +40,7 @@ add_task(async function() { info("Clicking on link 2, 1 load should take place"); promise = waitForLoadsInBrowser(tab.linkedBrowser, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, links[1], browser_b.contentWindow @@ -93,7 +93,7 @@ add_task(async function() { // We're going to click on the first link, so listen for another load event info("iframe: Clicking on link 1, 1 load should take place"); let promise = waitForLoadsInBrowser(tab.linkedBrowser, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, links[0], browser_b.contentWindow @@ -102,7 +102,7 @@ add_task(async function() { info("iframe: Clicking on link 2, 1 load should take place"); promise = waitForLoadsInBrowser(tab.linkedBrowser, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, links[1], browser_b.contentWindow @@ -175,7 +175,7 @@ add_task(async function() { // We're going to click on the first link, so listen for another load event info("dynamic: Clicking on link 1, 1 load should take place"); let promise = waitForLoadsInBrowser(tab.linkedBrowser, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, links[0], browser_b.contentWindow @@ -184,7 +184,7 @@ add_task(async function() { info("dynamic: Clicking on link 2, 1 load should take place"); promise = waitForLoadsInBrowser(tab.linkedBrowser, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, links[1], browser_b.contentWindow diff --git a/devtools/client/accessibility/test/browser/browser_accessibility_mutations.js b/devtools/client/accessibility/test/browser/browser_accessibility_mutations.js index 4c564747f93d..e948c088e032 100644 --- a/devtools/client/accessibility/test/browser/browser_accessibility_mutations.js +++ b/devtools/client/accessibility/test/browser/browser_accessibility_mutations.js @@ -130,7 +130,7 @@ const testsTopLevel = [ setup: async ({ doc }) => { await toggleRow(doc, 0); await toggleRow(doc, 1); - selectRow(doc, 3); + await selectRow(doc, 3); }, expected: { tree: [documentRow, ...subtree], @@ -154,7 +154,9 @@ const testsTopLevel = [ }, { desc: "Select third row in the tree.", - setup: ({ doc }) => selectRow(doc, 1), + setup: async ({ doc }) => { + await selectRow(doc, 1); + }, expected: { sidebar: newHeaderSidebar, }, @@ -169,7 +171,7 @@ const testsOOP = [ await toggleRow(doc, 1); await toggleRow(doc, 2); await toggleRow(doc, 3); - selectRow(doc, 5); + await selectRow(doc, 5); }, expected: { tree: [documentRowOOP, ...subtreeOOP], @@ -193,7 +195,9 @@ const testsOOP = [ }, { desc: "Select third row in the tree.", - setup: ({ doc }) => selectRow(doc, 1), + setup: async ({ doc }) => { + await selectRow(doc, 1); + }, expected: { sidebar: newHeaderSidebar, }, diff --git a/devtools/client/accessibility/test/browser/browser_accessibility_relation_navigation.js b/devtools/client/accessibility/test/browser/browser_accessibility_relation_navigation.js index 34ae44cdb911..f667acbc4dd0 100644 --- a/devtools/client/accessibility/test/browser/browser_accessibility_relation_navigation.js +++ b/devtools/client/accessibility/test/browser/browser_accessibility_relation_navigation.js @@ -48,7 +48,7 @@ const tests = [ }, { desc: "Expand first tree node.", - setup: ({ doc }) => toggleRow(doc, 0), + setup: async ({ doc }) => toggleRow(doc, 0), expected: { tree: [ { @@ -68,7 +68,9 @@ const tests = [ }, { desc: "Select second tree node.", - setup: ({ doc }) => selectRow(doc, 1), + setup: async ({ doc }) => { + await selectRow(doc, 1); + }, expected: { sidebar: { name: "Top level header", @@ -98,7 +100,7 @@ const tests = [ // keys. mustHaveAccessibleRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, relations.querySelector(".arrow"), win @@ -113,7 +115,7 @@ const tests = [ // activated. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, containingDocRelation.querySelector(".open-accessibility-inspector"), win diff --git a/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_dom_nodes.js b/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_dom_nodes.js index 5cbf52f31ecb..d1101c599771 100644 --- a/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_dom_nodes.js +++ b/devtools/client/accessibility/test/browser/browser_accessibility_sidebar_dom_nodes.js @@ -25,7 +25,7 @@ addA11YPanelTask( async ({ toolbox, doc }) => { info("Select an item having an actual associated DOM node"); await toggleRow(doc, 0); - selectRow(doc, 1); + await selectRow(doc, 1); await BrowserTestUtils.waitForCondition( () => getPropertyValue(doc, "name") === `"Hello"`, diff --git a/devtools/client/accessibility/test/browser/browser_accessibility_tree_audit_long.js b/devtools/client/accessibility/test/browser/browser_accessibility_tree_audit_long.js index a8e295c50498..3c7ebb8a2e6e 100644 --- a/devtools/client/accessibility/test/browser/browser_accessibility_tree_audit_long.js +++ b/devtools/client/accessibility/test/browser/browser_accessibility_tree_audit_long.js @@ -74,7 +74,7 @@ const tests = [ { desc: "Select a row that is guaranteed to have to be scrolled into view.", setup: async ({ doc }) => { - selectRow(doc, 0); + await selectRow(doc, 0); EventUtils.synthesizeKey("VK_END", {}, doc.defaultView); }, expected: { diff --git a/devtools/client/accessibility/test/browser/browser_accessibility_tree_nagivation.js b/devtools/client/accessibility/test/browser/browser_accessibility_tree_nagivation.js index 5d32fd520216..a3a679c44bb2 100644 --- a/devtools/client/accessibility/test/browser/browser_accessibility_tree_nagivation.js +++ b/devtools/client/accessibility/test/browser/browser_accessibility_tree_nagivation.js @@ -103,7 +103,9 @@ const tests = [ }, { desc: "Select third tree node.", - setup: ({ doc }) => selectRow(doc, 2), + setup: async ({ doc }) => { + await selectRow(doc, 2); + }, expected: { sidebar: { name: "Top level header", diff --git a/devtools/client/accessibility/test/browser/head.js b/devtools/client/accessibility/test/browser/head.js index bec861d69548..f575e4bb60e4 100644 --- a/devtools/client/accessibility/test/browser/head.js +++ b/devtools/client/accessibility/test/browser/head.js @@ -117,7 +117,7 @@ async function addTestTab(url) { const enableButton = doc.getElementById("accessibility-enable-button"); // If enable button is not found, asume the tool is already enabled. if (enableButton) { - EventUtils.sendMouseEvent({ type: "click" }, enableButton, win); + await EventUtils.sendMouseEvent({ type: "click" }, enableButton, win); } await waitUntilState( @@ -517,7 +517,7 @@ async function selectProperty(doc, id) { let node; await focusAccessibleProperties(doc); - await BrowserTestUtils.waitForCondition(() => { + await BrowserTestUtils.waitForCondition(async () => { node = doc.getElementById(`${id}`); if (node) { if (selected) { @@ -529,7 +529,7 @@ async function selectProperty(doc, id) { // keys. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent({ type: "click" }, node, win); + await EventUtils.sendMouseEvent({ type: "click" }, node, win); AccessibilityUtils.resetEnv(); selected = true; } else { @@ -548,13 +548,13 @@ async function selectProperty(doc, id) { * @param {document} doc panel documnent. * @param {Number} rowNumber number of the row/tree node to be selected. */ -function selectRow(doc, rowNumber) { +async function selectRow(doc, rowNumber) { info(`Selecting row ${rowNumber}.`); AccessibilityUtils.setEnv({ // Keyboard navigation is handled on the container level using arrow keys. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, doc.querySelectorAll(".treeRow")[rowNumber], doc.defaultView @@ -580,7 +580,7 @@ async function toggleRow(doc, rowNumber) { // TreeView component and handle keyboard navigation using the arrow keys. mustHaveAccessibleRule: false, }); - EventUtils.sendMouseEvent({ type: "click" }, twisty, win); + await EventUtils.sendMouseEvent({ type: "click" }, twisty, win); AccessibilityUtils.resetEnv(); await BrowserTestUtils.waitForCondition( () => diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js b/devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js index 8b825b75951f..cb5be5cfa298 100644 --- a/devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js +++ b/devtools/client/debugger/test/mochitest/browser_dbg-search-file-paused.js @@ -34,7 +34,7 @@ add_task(async function() { info("Switching files via frame click"); const frames = findAllElements(dbg, "frames"); - pressMouseDown(dbg, frames[1]) + await pressMouseDown(dbg, frames[1]) // Ensure that the debug line is in view, and not the first "bar" instance, // which the user would have to scroll down for @@ -47,7 +47,7 @@ add_task(async function() { el.value = ""; type(dbg, "func"); await waitForSearchState(dbg); - pressMouseDown(dbg, frames[0]); + await pressMouseDown(dbg, frames[0]); await waitFor(() => cm.state.search.query === "func"); // Ensure there is a match for the new term @@ -66,6 +66,6 @@ function getFocusedEl(dbg) { return doc.activeElement; } -function pressMouseDown(dbg, node) { - EventUtils.sendMouseEvent({ type: "mousedown" }, node, dbg.win); +async function pressMouseDown(dbg, node) { + await EventUtils.sendMouseEvent({ type: "mousedown" }, node, dbg.win); } diff --git a/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js b/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js index 99e1d864e689..cbb3243d69d2 100644 --- a/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js +++ b/devtools/client/framework/test/browser_toolbox_options_multiple_tabs.js @@ -75,7 +75,7 @@ async function toggleTool({ doc, panelWin, checkbox, tab }, toolId) { const onToggleTool = gDevTools.once( `tool-${prevChecked ? "unregistered" : "registered"}` ); - EventUtils.sendMouseEvent({ type: "click" }, checkbox, panelWin); + await EventUtils.sendMouseEvent({ type: "click" }, checkbox, panelWin); const id = await onToggleTool; is(id, toolId, `Correct event for ${toolId} was fired`); diff --git a/devtools/client/framework/test/browser_toolbox_zoom_popup.js b/devtools/client/framework/test/browser_toolbox_zoom_popup.js index f3aad95f79d6..dab4b4dc87d5 100644 --- a/devtools/client/framework/test/browser_toolbox_zoom_popup.js +++ b/devtools/client/framework/test/browser_toolbox_zoom_popup.js @@ -136,7 +136,7 @@ async function getButtonAndMenuInfo(toolbox, menuButton) { // Users can use arrow keys to navigate between and select tabs. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", screenX: 1, diff --git a/devtools/client/inspector/grids/test/browser_grids_grid-list-element-rep.js b/devtools/client/inspector/grids/test/browser_grids_grid-list-element-rep.js index f440bd033512..5b046c66a2bc 100644 --- a/devtools/client/inspector/grids/test/browser_grids_grid-list-element-rep.js +++ b/devtools/client/inspector/grids/test/browser_grids_grid-list-element-rep.js @@ -57,7 +57,11 @@ add_task(async function() { ); const onSelection = inspector.selection.once("new-node-front"); - EventUtils.sendMouseEvent({ type: "click" }, elementRep, doc.defaultView); + await EventUtils.sendMouseEvent( + { type: "click" }, + elementRep, + doc.defaultView + ); await onSelection; is( diff --git a/devtools/client/inspector/markup/test/browser_markup_pagesize_01.js b/devtools/client/inspector/markup/test/browser_markup_pagesize_01.js index bace791ebcfe..8dd950c1f0d5 100644 --- a/devtools/client/inspector/markup/test/browser_markup_pagesize_01.js +++ b/devtools/client/inspector/markup/test/browser_markup_pagesize_01.js @@ -87,5 +87,5 @@ async function clickShowMoreNodes(inspector) { const container = await getContainerForSelector("body", inspector); const button = container.elt.querySelector("button"); const win = button.ownerDocument.defaultView; - EventUtils.sendMouseEvent({ type: "click" }, button, win); + await EventUtils.sendMouseEvent({ type: "click" }, button, win); } diff --git a/devtools/client/inspector/markup/test/browser_markup_pagesize_02.js b/devtools/client/inspector/markup/test/browser_markup_pagesize_02.js index c8ca3cd2262e..99467f5985f2 100644 --- a/devtools/client/inspector/markup/test/browser_markup_pagesize_02.js +++ b/devtools/client/inspector/markup/test/browser_markup_pagesize_02.js @@ -33,7 +33,7 @@ async function showAllNodes(inspector) { ok(button, "All nodes button is here"); const win = button.ownerDocument.defaultView; - EventUtils.sendMouseEvent({ type: "click" }, button, win); + await EventUtils.sendMouseEvent({ type: "click" }, button, win); await inspector.markup._waitForChildren(); } diff --git a/devtools/client/inspector/markup/test/browser_markup_scrollable_badge_click.js b/devtools/client/inspector/markup/test/browser_markup_scrollable_badge_click.js index 1a788a83f27c..151166fad90c 100644 --- a/devtools/client/inspector/markup/test/browser_markup_scrollable_badge_click.js +++ b/devtools/client/inspector/markup/test/browser_markup_scrollable_badge_click.js @@ -94,7 +94,7 @@ add_task(async function() { checkTelemetry("devtools.markup.scrollable.badge.clicked", "", 2, "scalar"); info("Double-click on the scrollable badge"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "dblclick" }, container.editor._scrollableBadge ); diff --git a/devtools/client/inspector/markup/test/browser_markup_shadowdom_maxchildren.js b/devtools/client/inspector/markup/test/browser_markup_shadowdom_maxchildren.js index 1775b3b7b92a..144c669863a1 100644 --- a/devtools/client/inspector/markup/test/browser_markup_shadowdom_maxchildren.js +++ b/devtools/client/inspector/markup/test/browser_markup_shadowdom_maxchildren.js @@ -100,7 +100,7 @@ add_task(async function() { !!moreNodesLink, "A 'more nodes' button is displayed in the host container" ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, moreNodesLink.querySelector("button") ); diff --git a/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_07.js b/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_07.js index 7e98d3b3c964..f00a6f4766a6 100644 --- a/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_07.js +++ b/devtools/client/inspector/rules/test/browser_rules_shapes-toggle_07.js @@ -30,7 +30,7 @@ add_task(async function() { info("Toggling ON the CSS shapes highlighter with transform mode on."); let onHighlighterShown = highlighters.once("shapes-highlighter-shown"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", metaKey: true, ctrlKey: true }, shapesToggle, view.styleWindow @@ -49,7 +49,11 @@ add_task(async function() { info("Toggling OFF the CSS shapes highlighter from the rule-view."); const onHighlighterHidden = highlighters.once("shapes-highlighter-hidden"); - EventUtils.sendMouseEvent({ type: "click" }, shapesToggle, view.styleWindow); + await EventUtils.sendMouseEvent( + { type: "click" }, + shapesToggle, + view.styleWindow + ); await onHighlighterHidden; info("Checking the CSS shapes highlighter is not shown."); @@ -60,7 +64,11 @@ add_task(async function() { info("Toggling ON the CSS shapes highlighter with transform mode off."); onHighlighterShown = highlighters.once("shapes-highlighter-shown"); - EventUtils.sendMouseEvent({ type: "click" }, shapesToggle, view.styleWindow); + await EventUtils.sendMouseEvent( + { type: "click" }, + shapesToggle, + view.styleWindow + ); await onHighlighterShown; info( @@ -80,7 +88,7 @@ add_task(async function() { "Clicking shapes toggle to turn on transform mode while highlighter is shown." ); onHighlighterShown = highlighters.once("shapes-highlighter-shown"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", metaKey: true, ctrlKey: true }, shapesToggle, view.styleWindow diff --git a/devtools/client/inspector/test/head.js b/devtools/client/inspector/test/head.js index 3c7a5721f741..2c7adc8ed607 100644 --- a/devtools/client/inspector/test/head.js +++ b/devtools/client/inspector/test/head.js @@ -1144,7 +1144,7 @@ async function toggleShapesHighlighter( if (show) { const onHighlighterShown = highlighters.once("shapes-highlighter-shown"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", metaKey, ctrlKey }, shapesToggle, view.styleWindow @@ -1152,7 +1152,7 @@ async function toggleShapesHighlighter( await onHighlighterShown; } else { const onHighlighterHidden = highlighters.once("shapes-highlighter-hidden"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", metaKey, ctrlKey }, shapesToggle, view.styleWindow diff --git a/devtools/client/netmonitor/test/browser_net-ws-filter-freetext.js b/devtools/client/netmonitor/test/browser_net-ws-filter-freetext.js index 282372ac9270..feaccb70a4e2 100644 --- a/devtools/client/netmonitor/test/browser_net-ws-filter-freetext.js +++ b/devtools/client/netmonitor/test/browser_net-ws-filter-freetext.js @@ -43,10 +43,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -78,7 +78,7 @@ add_task(async function() { is(filteredFrames.length, 2, "There should be two frames"); // Select the second request and check that the filter input is cleared - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); // Wait till the text filter is applied. There should be two frames rendered await waitUntil( () => diff --git a/devtools/client/netmonitor/test/browser_net_accessibility-02.js b/devtools/client/netmonitor/test/browser_net_accessibility-02.js index 8cbc33750215..2d0f0256d4d8 100644 --- a/devtools/client/netmonitor/test/browser_net_accessibility-02.js +++ b/devtools/client/netmonitor/test/browser_net_accessibility-02.js @@ -127,7 +127,7 @@ add_task(async function() { EventUtils.sendKey("DOWN", window); check(19, true); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelector(".request-list-item") ); diff --git a/devtools/client/netmonitor/test/browser_net_basic-search.js b/devtools/client/netmonitor/test/browser_net_basic-search.js index 72c51acb25ec..9f0e49dc6980 100644 --- a/devtools/client/netmonitor/test/browser_net_basic-search.js +++ b/devtools/client/netmonitor/test/browser_net_basic-search.js @@ -59,7 +59,7 @@ add_task(async function() { // Accessibility is handled on the container level. mustHaveAccessibleRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".search-panel-content .treeRow .treeIcon") ); diff --git a/devtools/client/netmonitor/test/browser_net_block-context.js b/devtools/client/netmonitor/test/browser_net_block-context.js index fc247c69bb64..e410a0b79fc4 100644 --- a/devtools/client/netmonitor/test/browser_net_block-context.js +++ b/devtools/client/netmonitor/test/browser_net_block-context.js @@ -91,7 +91,7 @@ async function waitForBlockingAction(store, action) { async function openMenuAndClick(monitor, store, document, itemSelector) { info(`Right clicking on white-space in the header to get the context menu`); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector(".request-blocking-contents") ); diff --git a/devtools/client/netmonitor/test/browser_net_block-draganddrop.js b/devtools/client/netmonitor/test/browser_net_block-draganddrop.js index 0dfe1f467b30..3cc7c4ff103f 100644 --- a/devtools/client/netmonitor/test/browser_net_block-draganddrop.js +++ b/devtools/client/netmonitor/test/browser_net_block-draganddrop.js @@ -72,7 +72,7 @@ add_task(async function() { const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview") ); - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); await waitForHeaders; normalRequestState = getSelectedRequest(store.getState()); normalRequestSize = firstRequest.querySelector(".requests-list-transferred") @@ -140,7 +140,7 @@ add_task(async function() { blockedRequestSize = firstRequest.querySelector( ".requests-list-transferred" ).textContent; - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); blockedRequestState = getSelectedRequest(store.getState()); info("Captured blocked request"); } diff --git a/devtools/client/netmonitor/test/browser_net_block-pattern.js b/devtools/client/netmonitor/test/browser_net_block-pattern.js index ffc36737353c..4b5f7bae60fc 100644 --- a/devtools/client/netmonitor/test/browser_net_block-pattern.js +++ b/devtools/client/netmonitor/test/browser_net_block-pattern.js @@ -93,7 +93,7 @@ add_task(async function() { "The fourth request was not blocked" ); - EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requestItems[0]); // Right-click test1, select "Unblock URL" from its context menu await toggleBlockedUrl(requestItems[0], monitor, store, "unblock"); diff --git a/devtools/client/netmonitor/test/browser_net_block.js b/devtools/client/netmonitor/test/browser_net_block.js index 299d6fb0c304..e18e8ab70def 100644 --- a/devtools/client/netmonitor/test/browser_net_block.js +++ b/devtools/client/netmonitor/test/browser_net_block.js @@ -39,7 +39,7 @@ add_task(async function() { ); const firstRequest = document.querySelectorAll(".request-list-item")[0]; - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); await waitForHeaderSections; @@ -57,7 +57,7 @@ add_task(async function() { info("Captured normal request"); // Mark as blocked - EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); const contextBlock = getContextMenuItem( monitor, "request-list-context-block-url" @@ -94,7 +94,7 @@ add_task(async function() { ); const firstRequest = document.querySelectorAll(".request-list-item")[0]; - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); await waitForHeaderSections; @@ -113,7 +113,7 @@ add_task(async function() { info("Captured blocked request"); // Mark as unblocked - EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); const contextUnblock = getContextMenuItem( monitor, "request-list-context-unblock-url" @@ -143,7 +143,7 @@ add_task(async function() { unblockedRequestSize = firstRequest.querySelector( ".requests-list-transferred" ).textContent; - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); unblockedRequestState = getSelectedRequest(store.getState()); info("Captured unblocked request"); } diff --git a/devtools/client/netmonitor/test/browser_net_brotli.js b/devtools/client/netmonitor/test/browser_net_brotli.js index a0eb8096b0b1..292e61aa1760 100644 --- a/devtools/client/netmonitor/test/browser_net_brotli.js +++ b/devtools/client/netmonitor/test/browser_net_brotli.js @@ -32,7 +32,7 @@ add_task(async function() { const requestItem = document.querySelector(".request-list-item"); // Status code title is generated on hover const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -58,7 +58,7 @@ add_task(async function() { TEST_EVENTS.RECEIVED_RESPONSE_CONTENT ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; await onResponseContent; await testResponse("br"); diff --git a/devtools/client/netmonitor/test/browser_net_cached-status.js b/devtools/client/netmonitor/test/browser_net_cached-status.js index 6a886c72298c..dfbc4c95c865 100644 --- a/devtools/client/netmonitor/test/browser_net_cached-status.js +++ b/devtools/client/netmonitor/test/browser_net_cached-status.js @@ -101,7 +101,7 @@ add_task(async function() { const requestItem = document.querySelectorAll(".request-list-item")[index]; requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); diff --git a/devtools/client/netmonitor/test/browser_net_cause_source_map.js b/devtools/client/netmonitor/test/browser_net_cause_source_map.js index 779f354e3081..1e6e443ebcf0 100644 --- a/devtools/client/netmonitor/test/browser_net_cause_source_map.js +++ b/devtools/client/netmonitor/test/browser_net_cause_source_map.js @@ -32,12 +32,12 @@ add_task(async function() { info("Clicking item and waiting for details panel to open"); waitPromise = waitForDOM(document, ".network-details-bar"); const xhrRequestItem = document.querySelectorAll(".request-list-item")[3]; - EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequestItem); + await EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequestItem); await waitPromise; info("Clicking stack tab and waiting for stack panel to open"); waitPromise = waitForDOM(document, "#stack-trace-panel"); - clickOnSidebarTab(document, "stack-trace"); + await clickOnSidebarTab(document, "stack-trace"); await waitPromise; info("Waiting for source maps to be applied"); diff --git a/devtools/client/netmonitor/test/browser_net_clear.js b/devtools/client/netmonitor/test/browser_net_clear.js index 41367fb03f27..4fa77a3b0de8 100644 --- a/devtools/client/netmonitor/test/browser_net_clear.js +++ b/devtools/client/netmonitor/test/browser_net_clear.js @@ -30,7 +30,7 @@ add_task(async function() { assertSingleRequestState(); // Click clear and make sure the requests are gone - EventUtils.sendMouseEvent({ type: "click" }, clearButton); + await EventUtils.sendMouseEvent({ type: "click" }, clearButton); assertNoRequestState(); // Load a second request and make sure they still show up @@ -50,7 +50,7 @@ add_task(async function() { ); // Click clear and make sure the details pane closes - EventUtils.sendMouseEvent({ type: "click" }, clearButton); + await EventUtils.sendMouseEvent({ type: "click" }, clearButton); assertNoRequestState(); ok( diff --git a/devtools/client/netmonitor/test/browser_net_column-resize-fit.js b/devtools/client/netmonitor/test/browser_net_column-resize-fit.js index da874058e778..76df3a013c40 100644 --- a/devtools/client/netmonitor/test/browser_net_column-resize-fit.js +++ b/devtools/client/netmonitor/test/browser_net_column-resize-fit.js @@ -30,7 +30,7 @@ add_task(async function() { const fileHeader = document.querySelector(`#requests-list-file-header-box`); const fileColumnResizer = fileHeader.querySelector(".column-resizer"); - EventUtils.sendMouseEvent({ type: "dblclick" }, fileColumnResizer); + await EventUtils.sendMouseEvent({ type: "dblclick" }, fileColumnResizer); // After resize - get fresh prefs for tests. let columnsData = JSON.parse( @@ -47,7 +47,7 @@ add_task(async function() { ); // Resizing `transferred` column. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector("#requests-list-transferred-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_columns_last_column.js b/devtools/client/netmonitor/test/browser_net_columns_last_column.js index c18e0e3a317c..a972e3a11de9 100644 --- a/devtools/client/netmonitor/test/browser_net_columns_last_column.js +++ b/devtools/client/netmonitor/test/browser_net_columns_last_column.js @@ -50,7 +50,7 @@ add_task(async function() { await teardown(monitor); async function testLastMenuItem(column) { - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector(`#requests-list-${column}-button`) ); diff --git a/devtools/client/netmonitor/test/browser_net_columns_reset.js b/devtools/client/netmonitor/test/browser_net_columns_reset.js index f9e88e889c3b..84461cd9d480 100644 --- a/devtools/client/netmonitor/test/browser_net_columns_reset.js +++ b/devtools/client/netmonitor/test/browser_net_columns_reset.js @@ -27,7 +27,7 @@ add_task(async function() { await hideColumn(monitor, "status"); await hideColumn(monitor, "waterfall"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector("#requests-list-contentSize-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_columns_showhide.js b/devtools/client/netmonitor/test/browser_net_columns_showhide.js index 9fb6167b8f2b..8e76bd3df723 100644 --- a/devtools/client/netmonitor/test/browser_net_columns_showhide.js +++ b/devtools/client/netmonitor/test/browser_net_columns_showhide.js @@ -65,7 +65,7 @@ async function testWhiteSpaceContextMenuItem(column, document, monitor) { ); info(`Right clicking on white-space in the header to get the context menu`); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector(".requests-list-headers") ); @@ -82,7 +82,7 @@ async function testVisibleColumnContextMenuItem(column, document, monitor) { ); info(`Clicking context-menu item for ${column}`); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector("#requests-list-status-button") || document.querySelector("#requests-list-waterfall-button") @@ -133,7 +133,7 @@ async function testHiddenColumnContextMenuItem(column, document, monitor) { ); info(`Clicking context-menu item for ${column}`); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector("#requests-list-status-button") || document.querySelector("#requests-list-waterfall-button") diff --git a/devtools/client/netmonitor/test/browser_net_complex-params.js b/devtools/client/netmonitor/test/browser_net_complex-params.js index f580b14ec4f3..1b5b920e0910 100644 --- a/devtools/client/netmonitor/test/browser_net_complex-params.js +++ b/devtools/client/netmonitor/test/browser_net_complex-params.js @@ -24,16 +24,16 @@ add_task(async function() { await performRequests(monitor, tab, 12); let wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); await wait; testParamsTab1('{ "foo": "bar" }', ""); wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[1] ); @@ -41,7 +41,7 @@ add_task(async function() { testParamsTab1('{ "foo": "bar" }', ""); wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[2] ); @@ -51,7 +51,7 @@ add_task(async function() { let waitRows, waitSourceEditor; waitRows = waitForDOM(document, "#request-panel tr.treeRow", 1); waitSourceEditor = waitForDOM(document, "#request-panel .CodeMirror-code"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[3] ); @@ -60,7 +60,7 @@ add_task(async function() { waitRows = waitForDOM(document, "#request-panel tr.treeRow", 1); waitSourceEditor = waitForDOM(document, "#request-panel .CodeMirror-code"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[4] ); @@ -74,21 +74,21 @@ add_task(async function() { 1 ); waitSourceEditor = waitForDOM(document, "#request-panel .CodeMirror-code"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[5] ); await Promise.all([waitAccordionItems, waitSourceEditor]); testParamsTab2("?foo=bar", "text"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[6] ); testParamsTab3(); wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[7] ); @@ -96,7 +96,7 @@ add_task(async function() { testParamsTab1('{ "foo": "bar" }', ""); wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[8] ); diff --git a/devtools/client/netmonitor/test/browser_net_content-type.js b/devtools/client/netmonitor/test/browser_net_content-type.js index 914bf03e81d0..0969cde95b5e 100644 --- a/devtools/client/netmonitor/test/browser_net_content-type.js +++ b/devtools/client/netmonitor/test/browser_net_content-type.js @@ -29,7 +29,7 @@ add_task(async function() { for (const requestItem of document.querySelectorAll(".request-list-item")) { const requestsListStatus = requestItem.querySelector(".status-code"); requestItem.scrollIntoView(); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); } diff --git a/devtools/client/netmonitor/test/browser_net_cookies_sorted.js b/devtools/client/netmonitor/test/browser_net_cookies_sorted.js index 626cd52e1c1f..141d2299de21 100644 --- a/devtools/client/netmonitor/test/browser_net_cookies_sorted.js +++ b/devtools/client/netmonitor/test/browser_net_cookies_sorted.js @@ -23,17 +23,17 @@ add_task(async function() { await wait; wait = waitForDOM(document, ".headers-overview"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); - clickOnSidebarTab(document, "cookies"); + await clickOnSidebarTab(document, "cookies"); info("Check if Request-Cookies and Response-Cookies are sorted"); const expectedLabelValues = [ diff --git a/devtools/client/netmonitor/test/browser_net_copy_as_curl.js b/devtools/client/netmonitor/test/browser_net_copy_as_curl.js index 883771b3c8e2..2fd2268c2afd 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_as_curl.js +++ b/devtools/client/netmonitor/test/browser_net_copy_as_curl.js @@ -179,8 +179,8 @@ async function testForPlatform(tab, monitor, testData) { const items = document.querySelectorAll(".request-list-item"); const itemIndex = items.length - 1; - EventUtils.sendMouseEvent({ type: "mousedown" }, items[itemIndex]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent({ type: "mousedown" }, items[itemIndex]); + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_as_fetch.js b/devtools/client/netmonitor/test/browser_net_copy_as_fetch.js index efb8c94107f1..446673d104f1 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_as_fetch.js +++ b/devtools/client/netmonitor/test/browser_net_copy_as_fetch.js @@ -54,8 +54,11 @@ add_task(async function() { const { document } = monitor.panelWin; const items = document.querySelectorAll(".request-list-item"); - EventUtils.sendMouseEvent({ type: "mousedown" }, items[items.length - 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( + { type: "mousedown" }, + items[items.length - 1] + ); + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_headers.js b/devtools/client/netmonitor/test/browser_net_copy_headers.js index 699cf628e13e..ae413b6b40db 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_headers.js +++ b/devtools/client/netmonitor/test/browser_net_copy_headers.js @@ -22,7 +22,7 @@ add_task(async function() { tab.linkedBrowser.reload(); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -30,7 +30,7 @@ add_task(async function() { const requestItem = getSortedRequests(store.getState())[0]; const { method, httpVersion, status, statusText } = requestItem; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); @@ -76,7 +76,7 @@ add_task(async function() { "date: Sun, 3 May 2015 11:11:11 GMT", ].join("\n"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_image_as_data_uri.js b/devtools/client/netmonitor/test/browser_net_copy_image_as_data_uri.js index ddf94d615018..9627dfc1392d 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_image_as_data_uri.js +++ b/devtools/client/netmonitor/test/browser_net_copy_image_as_data_uri.js @@ -19,11 +19,11 @@ add_task(async function() { // Execute requests. await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[5] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[5] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_params.js b/devtools/client/netmonitor/test/browser_net_copy_params.js index 8487647052d3..421e7b389b94 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_params.js +++ b/devtools/client/netmonitor/test/browser_net_copy_params.js @@ -21,54 +21,54 @@ add_task(async function() { // Execute requests. await performRequests(monitor, tab, 7); - testCopyUrlParamsHidden(0, false); + await testCopyUrlParamsHidden(0, false); await testCopyUrlParams(0, "a"); - testCopyPostDataHidden(0, false); + await testCopyPostDataHidden(0, false); await testCopyPostData(0, '{ "foo": "bar" }'); - testCopyUrlParamsHidden(1, false); + await testCopyUrlParamsHidden(1, false); await testCopyUrlParams(1, "a=b"); - testCopyPostDataHidden(1, false); + await testCopyPostDataHidden(1, false); await testCopyPostData(1, '{ "foo": "bar" }'); - testCopyUrlParamsHidden(2, false); + await testCopyUrlParamsHidden(2, false); await testCopyUrlParams(2, "a=b"); - testCopyPostDataHidden(2, false); + await testCopyPostDataHidden(2, false); await testCopyPostData(2, "foo=bar"); - testCopyUrlParamsHidden(3, false); + await testCopyUrlParamsHidden(3, false); await testCopyUrlParams(3, "a"); - testCopyPostDataHidden(3, false); + await testCopyPostDataHidden(3, false); await testCopyPostData(3, '{ "foo": "bar" }'); - testCopyUrlParamsHidden(4, false); + await testCopyUrlParamsHidden(4, false); await testCopyUrlParams(4, "a=b"); - testCopyPostDataHidden(4, false); + await testCopyPostDataHidden(4, false); await testCopyPostData(4, '{ "foo": "bar" }'); - testCopyUrlParamsHidden(5, false); + await testCopyUrlParamsHidden(5, false); await testCopyUrlParams(5, "a=b"); - testCopyPostDataHidden(5, false); + await testCopyPostDataHidden(5, false); await testCopyPostData(5, "?foo=bar"); - testCopyRequestDataLabel(5, "POST"); + await testCopyRequestDataLabel(5, "POST"); - testCopyUrlParamsHidden(6, true); - testCopyPostDataHidden(6, true); + await testCopyUrlParamsHidden(6, true); + await testCopyPostDataHidden(6, true); - testCopyPostDataHidden(7, false); - testCopyRequestDataLabel(7, "PATCH"); + await testCopyPostDataHidden(7, false); + await testCopyRequestDataLabel(7, "PATCH"); - testCopyPostDataHidden(8, false); - testCopyRequestDataLabel(8, "PUT"); + await testCopyPostDataHidden(8, false); + await testCopyRequestDataLabel(8, "PUT"); return teardown(monitor); - function testCopyUrlParamsHidden(index, hidden) { - EventUtils.sendMouseEvent( + async function testCopyUrlParamsHidden(index, hidden) { + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[index] ); @@ -86,11 +86,11 @@ add_task(async function() { } async function testCopyUrlParams(index, queryString) { - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[index] ); @@ -103,12 +103,12 @@ add_task(async function() { ok(true, "The url query string copied from the selected item is correct."); } - function testCopyPostDataHidden(index, hidden) { - EventUtils.sendMouseEvent( + async function testCopyPostDataHidden(index, hidden) { + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[index] ); @@ -125,12 +125,12 @@ add_task(async function() { ); } - function testCopyRequestDataLabel(index, method) { - EventUtils.sendMouseEvent( + async function testCopyRequestDataLabel(index, method) { + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[index] ); @@ -155,11 +155,11 @@ add_task(async function() { const { formDataSections, requestPostData } = requests[index]; return formDataSections && requestPostData; }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[index] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_response.js b/devtools/client/netmonitor/test/browser_net_copy_response.js index 7cd82669bb70..4ede814d01b8 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_response.js +++ b/devtools/client/netmonitor/test/browser_net_copy_response.js @@ -21,11 +21,11 @@ add_task(async function() { // Execute requests. await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[3] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[3] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_svg_image_as_data_uri.js b/devtools/client/netmonitor/test/browser_net_copy_svg_image_as_data_uri.js index 99508f999e56..55dbb0848bdf 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_svg_image_as_data_uri.js +++ b/devtools/client/netmonitor/test/browser_net_copy_svg_image_as_data_uri.js @@ -21,11 +21,11 @@ add_task(async function() { }); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_copy_url.js b/devtools/client/netmonitor/test/browser_net_copy_url.js index 628dc40c0cb2..a8705fc1b227 100644 --- a/devtools/client/netmonitor/test/browser_net_copy_url.js +++ b/devtools/client/netmonitor/test/browser_net_copy_url.js @@ -21,7 +21,7 @@ add_task(async function() { // Execute requests. await performRequests(monitor, tab, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -37,7 +37,7 @@ add_task(async function() { emptyClipboard(); info("Simulating context click on a first element of the request table"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_cyrillic-01.js b/devtools/client/netmonitor/test/browser_net_cyrillic-01.js index 79b598f33206..71d871f613b1 100644 --- a/devtools/client/netmonitor/test/browser_net_cyrillic-01.js +++ b/devtools/client/netmonitor/test/browser_net_cyrillic-01.js @@ -27,7 +27,7 @@ add_task(async function() { const requestItem = document.querySelectorAll(".request-list-item")[0]; const requestsListStatus = requestItem.querySelector(".status-code"); requestItem.scrollIntoView(); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -44,13 +44,13 @@ add_task(async function() { ); let wait = waitForDOM(document, "#headers-panel"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; wait = waitForDOM(document, "#response-panel .CodeMirror-code"); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; ok( diff --git a/devtools/client/netmonitor/test/browser_net_cyrillic-02.js b/devtools/client/netmonitor/test/browser_net_cyrillic-02.js index 364133c0ffa1..efa98bae4e4b 100644 --- a/devtools/client/netmonitor/test/browser_net_cyrillic-02.js +++ b/devtools/client/netmonitor/test/browser_net_cyrillic-02.js @@ -29,7 +29,7 @@ add_task(async function() { const requestItem = document.querySelectorAll(".request-list-item")[0]; const requestsListStatus = requestItem.querySelector(".status-code"); requestItem.scrollIntoView(); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -46,14 +46,14 @@ add_task(async function() { ); wait = waitForDOM(document, "#headers-panel"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; wait = waitForDOM(document, "#response-panel .accordion-item", 2); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; wait = waitForDOM(document, "#response-panel .CodeMirror-code"); diff --git a/devtools/client/netmonitor/test/browser_net_decode-params.js b/devtools/client/netmonitor/test/browser_net_decode-params.js index d1bce04e814a..03cbeef5c8ef 100644 --- a/devtools/client/netmonitor/test/browser_net_decode-params.js +++ b/devtools/client/netmonitor/test/browser_net_decode-params.js @@ -23,13 +23,13 @@ add_task(async function() { const wait = waitUntil( () => document.querySelectorAll(".tabpanel-summary-label")[0] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); return teardown(monitor); }); diff --git a/devtools/client/netmonitor/test/browser_net_decode-url.js b/devtools/client/netmonitor/test/browser_net_decode-url.js index 070e1e2a7103..9dd91f03857b 100644 --- a/devtools/client/netmonitor/test/browser_net_decode-url.js +++ b/devtools/client/netmonitor/test/browser_net_decode-url.js @@ -24,7 +24,7 @@ add_task(async function() { document.querySelector("#headers-panel .url-preview") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_details_copy.js b/devtools/client/netmonitor/test/browser_net_details_copy.js index ad9b95c94019..b23df478332b 100644 --- a/devtools/client/netmonitor/test/browser_net_details_copy.js +++ b/devtools/client/netmonitor/test/browser_net_details_copy.js @@ -29,7 +29,7 @@ add_task(async function() { const urlRow = urlPreview.querySelector(".objectRow"); /* Test for copy on the url */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, urlRow); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, urlRow); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "properties-view-context-menu-copy").click(); }, "http://example.com/browser/devtools/client/netmonitor/test/html_simple-test-page.html"); @@ -37,7 +37,7 @@ add_task(async function() { ok(true, "The copy action put expected url string into clipboard"); /* Test for copy all */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, urlRow); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, urlRow); const expected = JSON.stringify( { GET: { @@ -92,7 +92,7 @@ add_task(async function() { )[1]; /* Test for copy */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, httpSummaryValue); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, httpSummaryValue); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "headers-panel-context-menu-copy").click(); }, "Version: HTTP/1.1"); @@ -100,7 +100,7 @@ add_task(async function() { ok(true, "The copy action put expected text into clipboard"); /* Test for copy all */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, httpSummaryValue); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, httpSummaryValue); const expected = JSON.stringify( { Status: "200OK", @@ -142,7 +142,7 @@ add_task(async function() { "#response-panel .treeTable" ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await onResponsePanelReady; const responsePanel = document.querySelector("#response-panel"); @@ -151,7 +151,7 @@ add_task(async function() { const stringRow = responsePanel.querySelectorAll(".stringRow")[0]; /* Test for copy an object */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, objectRow); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, objectRow); const expected = JSON.stringify({ obj: { type: "string" } }, null, "\t"); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "properties-view-context-menu-copy").click(); @@ -160,7 +160,7 @@ add_task(async function() { ok(true, "The copy action put expected json into clipboard"); /* Test for copy all */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, objectRow); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, objectRow); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "properties-view-context-menu-copyall").click(); }, expected); @@ -168,7 +168,7 @@ add_task(async function() { ok(true, "The copy all action put expected json into clipboard"); /* Test for copy a single row */ - EventUtils.sendMouseEvent({ type: "contextmenu" }, stringRow); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, stringRow); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "properties-view-context-menu-copy").click(); }, "type: string"); @@ -200,17 +200,17 @@ add_task(async function() { await wait; wait = waitForDOM(document, ".headers-overview"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); - clickOnSidebarTab(document, "cookies"); + await clickOnSidebarTab(document, "cookies"); const cookiesPanel = document.querySelector("#cookies-panel"); @@ -224,7 +224,7 @@ add_task(async function() { ]; for (let i = 0; i < objectRows.length; i++) { const cur = objectRows[i]; - EventUtils.sendMouseEvent({ type: "contextmenu" }, cur); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, cur); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "properties-view-context-menu-copy").click(); }, JSON.stringify(expectedResponseCookies[i], null, "\t")); @@ -233,7 +233,7 @@ add_task(async function() { const expectedRequestCookies = ["bob: true", "foo: bar", "tom: cool"]; for (let i = 0; i < expectedRequestCookies.length; i++) { const cur = stringRows[objectRows.length + i]; - EventUtils.sendMouseEvent({ type: "contextmenu" }, cur); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, cur); await waitForClipboardPromise(function setup() { getContextMenuItem(monitor, "properties-view-context-menu-copy").click(); }, expectedRequestCookies[i]); diff --git a/devtools/client/netmonitor/test/browser_net_edit_resend_cancel.js b/devtools/client/netmonitor/test/browser_net_edit_resend_cancel.js index de7afd6e5f5d..ca0960193846 100644 --- a/devtools/client/netmonitor/test/browser_net_edit_resend_cancel.js +++ b/devtools/client/netmonitor/test/browser_net_edit_resend_cancel.js @@ -28,9 +28,9 @@ add_task(async function() { const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview") ); - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); await waitForHeaders; - EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); const firstRequestState = getSelectedRequest(store.getState()); const contextResend = getContextMenuItem( monitor, diff --git a/devtools/client/netmonitor/test/browser_net_edit_resend_caret.js b/devtools/client/netmonitor/test/browser_net_edit_resend_caret.js index d6d46e1b6ea8..7500287d63f9 100644 --- a/devtools/client/netmonitor/test/browser_net_edit_resend_caret.js +++ b/devtools/client/netmonitor/test/browser_net_edit_resend_caret.js @@ -27,10 +27,10 @@ add_task(async function() { const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview") ); - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); await waitForHeaders; await waitForRequestData(store, ["requestHeaders"]); - EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); // Open "New Request" form const contextResend = getContextMenuItem( diff --git a/devtools/client/netmonitor/test/browser_net_edit_resend_with_filtering.js b/devtools/client/netmonitor/test/browser_net_edit_resend_with_filtering.js index fc3ff9b90f42..eecb62702a40 100644 --- a/devtools/client/netmonitor/test/browser_net_edit_resend_with_filtering.js +++ b/devtools/client/netmonitor/test/browser_net_edit_resend_with_filtering.js @@ -24,7 +24,7 @@ add_task(async function() { // Confirm XHR request and click it const xhrRequestItem = document.querySelectorAll(".request-list-item")[0]; - EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequestItem); + await EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequestItem); const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview") ); @@ -32,7 +32,7 @@ add_task(async function() { const firstRequest = getSelectedRequest(store.getState()); // Open context menu and execute "Edit & Resend". - EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequestItem); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequestItem); getContextMenuItem(monitor, "request-list-context-resend").click(); // Wait for "Edit & Resend" panel to appear diff --git a/devtools/client/netmonitor/test/browser_net_edit_resend_xhr.js b/devtools/client/netmonitor/test/browser_net_edit_resend_xhr.js index 82ba4462d48a..9ef4fec370cb 100644 --- a/devtools/client/netmonitor/test/browser_net_edit_resend_xhr.js +++ b/devtools/client/netmonitor/test/browser_net_edit_resend_xhr.js @@ -22,7 +22,7 @@ add_task(async function() { // Selects 1st XHR request const xhrRequest = document.querySelectorAll(".request-list-item")[0]; - EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, xhrRequest); // Stores original request for comparison of values later const { getSelectedRequest } = windowRequire( @@ -31,7 +31,7 @@ add_task(async function() { const original = getSelectedRequest(store.getState()); // Context Menu > "Edit & Resend" - EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, xhrRequest); getContextMenuItem(monitor, "request-list-context-resend").click(); // 1) Wait for "Edit & Resend" panel to appear @@ -43,7 +43,7 @@ add_task(async function() { // Selects cloned request const clonedRequest = document.querySelectorAll(".request-list-item")[1]; - EventUtils.sendMouseEvent({ type: "mousedown" }, clonedRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, clonedRequest); const cloned = getSelectedRequest(store.getState()); // Compares if the requests have the same cause type (XHR) diff --git a/devtools/client/netmonitor/test/browser_net_filter-01.js b/devtools/client/netmonitor/test/browser_net_filter-01.js index e5c2091f4a85..e6d47b2dd642 100644 --- a/devtools/client/netmonitor/test/browser_net_filter-01.js +++ b/devtools/client/netmonitor/test/browser_net_filter-01.js @@ -231,7 +231,7 @@ add_task(async function() { await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -256,7 +256,7 @@ add_task(async function() { testFilterButtons(monitor, "all"); await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); @@ -264,84 +264,84 @@ add_task(async function() { await testContents([1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Reset filters - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-css-button") ); testFilterButtons(monitor, "css"); await testContents([0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-js-button") ); testFilterButtons(monitor, "js"); await testContents([0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-xhr-button") ); testFilterButtons(monitor, "xhr"); await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-fonts-button") ); testFilterButtons(monitor, "fonts"); await testContents([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-images-button") ); testFilterButtons(monitor, "images"); await testContents([0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-media-button") ); testFilterButtons(monitor, "media"); await testContents([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-ws-button") ); testFilterButtons(monitor, "ws"); await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -350,7 +350,7 @@ add_task(async function() { await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); // Text in filter box that matches nothing should hide all. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -358,7 +358,7 @@ add_task(async function() { await testContents([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // ASCII text in filter box that matches should filter out everything else. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -366,7 +366,7 @@ add_task(async function() { await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // ASCII text in filter box that matches should filter out everything else. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -374,7 +374,7 @@ add_task(async function() { await testContents([1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Test negative filtering ASCII text(only show unmatched items) - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -382,7 +382,7 @@ add_task(async function() { await testContents([0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); // Unicode text in filter box that matches should filter out everything else. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -391,7 +391,7 @@ add_task(async function() { // Ditto, except the above is for a Unicode URI component, and this one is for // a Unicode domain name. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -399,7 +399,7 @@ add_task(async function() { await testContents([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]); // Test negative filtering Unicode text(only show unmatched items) - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -408,7 +408,7 @@ add_task(async function() { // Ditto, except the above is for a Unicode URI component, and this one is for // a Unicode domain name. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -419,11 +419,11 @@ add_task(async function() { // Enable filtering for html and css; should show request of both type. setFreetextFilter(""); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-css-button") ); @@ -441,7 +441,7 @@ add_task(async function() { await testContents([1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Disable some filters. Only one left active. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-css-button") ); @@ -449,7 +449,7 @@ add_task(async function() { await testContents([1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); // Disable last active filter. Should toggle to all. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); @@ -457,20 +457,20 @@ add_task(async function() { await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]); // Enable few filters and click on all. Only "all" should be checked. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-css-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-ws-button") ); testFilterButtonsCustom(monitor, [0, 1, 1, 0, 0, 0, 0, 0, 1, 0]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -493,7 +493,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); } diff --git a/devtools/client/netmonitor/test/browser_net_filter-02.js b/devtools/client/netmonitor/test/browser_net_filter-02.js index 9ef463fe7432..edc57082210c 100644 --- a/devtools/client/netmonitor/test/browser_net_filter-02.js +++ b/devtools/client/netmonitor/test/browser_net_filter-02.js @@ -152,7 +152,7 @@ add_task(async function() { await performRequestsInContent(REQUESTS_WITH_MEDIA_AND_FLASH_AND_WS); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -177,7 +177,7 @@ add_task(async function() { await testContents([1, 1, 1, 1, 1, 1, 1, 1, 1]); info("Testing html filtering."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); @@ -232,7 +232,7 @@ add_task(async function() { ]); info("Resetting filters."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); @@ -283,7 +283,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); } diff --git a/devtools/client/netmonitor/test/browser_net_filter-03.js b/devtools/client/netmonitor/test/browser_net_filter-03.js index 334d4db60e7d..b7cf94cdce48 100644 --- a/devtools/client/netmonitor/test/browser_net_filter-03.js +++ b/devtools/client/netmonitor/test/browser_net_filter-03.js @@ -47,7 +47,7 @@ add_task(async function() { await performRequestsInContent(requests); await wait; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -72,7 +72,7 @@ add_task(async function() { testContents([0, 1, 2, 3, 4, 5, 6], 7, 0); info("Sorting by size, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-contentSize-button") ); @@ -80,7 +80,7 @@ add_task(async function() { testContents([6, 4, 5, 0, 1, 2, 3], 7, 6); info("Testing html filtering."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); @@ -94,7 +94,7 @@ add_task(async function() { await wait; info("Testing html filtering again."); - resetSorting(); + await resetSorting(); testFilterButtons(monitor, "html"); testContents([8, 13, 9, 11, 10, 12, 0, 4, 1, 5, 2, 6, 3, 7], 2, 13); @@ -105,7 +105,7 @@ add_task(async function() { await wait; info("Testing html filtering again."); - resetSorting(); + await resetSorting(); testFilterButtons(monitor, "html"); testContents( [12, 13, 20, 14, 16, 18, 15, 17, 19, 0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11], @@ -115,12 +115,12 @@ add_task(async function() { await teardown(monitor); - function resetSorting() { - EventUtils.sendMouseEvent( + async function resetSorting() { + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-initiator-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-contentSize-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_filter-04.js b/devtools/client/netmonitor/test/browser_net_filter-04.js index 9fc5a0d305ac..2eedce765c30 100644 --- a/devtools/client/netmonitor/test/browser_net_filter-04.js +++ b/devtools/client/netmonitor/test/browser_net_filter-04.js @@ -64,7 +64,7 @@ add_task(async function() { testFilterButtons(monitor, "js"); ok(true, "Only the correct filter type was taken into consideration."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_filter-flags.js b/devtools/client/netmonitor/test/browser_net_filter-flags.js index ce9e24b110ba..e5bec1e0b47a 100644 --- a/devtools/client/netmonitor/test/browser_net_filter-flags.js +++ b/devtools/client/netmonitor/test/browser_net_filter-flags.js @@ -417,7 +417,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); } diff --git a/devtools/client/netmonitor/test/browser_net_footer-summary.js b/devtools/client/netmonitor/test/browser_net_footer-summary.js index e98508d33526..6dffb614bf09 100644 --- a/devtools/client/netmonitor/test/browser_net_footer-summary.js +++ b/devtools/client/netmonitor/test/browser_net_footer-summary.js @@ -48,7 +48,7 @@ add_task(async function() { const buttonEl = document.querySelector( `.requests-list-filter-${button}-button` ); - EventUtils.sendMouseEvent({ type: "click" }, buttonEl); + await EventUtils.sendMouseEvent({ type: "click" }, buttonEl); testStatus(); } } diff --git a/devtools/client/netmonitor/test/browser_net_header-docs.js b/devtools/client/netmonitor/test/browser_net_header-docs.js index a2a28a06c562..e292f510bac7 100644 --- a/devtools/client/netmonitor/test/browser_net_header-docs.js +++ b/devtools/client/netmonitor/test/browser_net_header-docs.js @@ -34,7 +34,7 @@ add_task(async function() { interactiveRule: false, labelRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_header-ref-policy.js b/devtools/client/netmonitor/test/browser_net_header-ref-policy.js index 8b3fd5ffea70..912055a273c0 100644 --- a/devtools/client/netmonitor/test/browser_net_header-ref-policy.js +++ b/devtools/client/netmonitor/test/browser_net_header-ref-policy.js @@ -23,7 +23,7 @@ add_task(async function() { const wait = waitUntil( () => document.querySelectorAll(".tabpanel-summary-label")[0] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_headers_filter.js b/devtools/client/netmonitor/test/browser_net_headers_filter.js index 342305326ea6..89bfe87afb44 100644 --- a/devtools/client/netmonitor/test/browser_net_headers_filter.js +++ b/devtools/client/netmonitor/test/browser_net_headers_filter.js @@ -22,7 +22,7 @@ add_task(async function() { await wait; wait = waitUntil(() => document.querySelector(".headers-overview")); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_headers_sorted.js b/devtools/client/netmonitor/test/browser_net_headers_sorted.js index 04a4abd1d93b..7dac7c7a89bc 100644 --- a/devtools/client/netmonitor/test/browser_net_headers_sorted.js +++ b/devtools/client/netmonitor/test/browser_net_headers_sorted.js @@ -39,7 +39,7 @@ async function verifyHeaders(monitor) { info("Check if Request-Headers and Response-Headers are sorted"); const wait = waitForDOM(document, ".headers-overview"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_initiator.js b/devtools/client/netmonitor/test/browser_net_initiator.js index 99c2a705f26f..144f2f1881bb 100644 --- a/devtools/client/netmonitor/test/browser_net_initiator.js +++ b/devtools/client/netmonitor/test/browser_net_initiator.js @@ -164,7 +164,7 @@ add_task(async function() { continue; } - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll( ".request-list-item .requests-list-initiator-lastframe" @@ -187,7 +187,7 @@ add_task(async function() { validateRequests(EXPECTED_REQUESTS, monitor); // Sort the requests by initiator and check the order - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-initiator-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_json-b64.js b/devtools/client/netmonitor/test/browser_net_json-b64.js index 8bea7b487137..dd8d2d6ff5f9 100644 --- a/devtools/client/netmonitor/test/browser_net_json-b64.js +++ b/devtools/client/netmonitor/test/browser_net_json-b64.js @@ -31,7 +31,7 @@ add_task(async function() { store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([wait, waitForPropsView]); diff --git a/devtools/client/netmonitor/test/browser_net_json-empty.js b/devtools/client/netmonitor/test/browser_net_json-empty.js index 8f1fa3111970..ebc9e7f009c0 100644 --- a/devtools/client/netmonitor/test/browser_net_json-empty.js +++ b/devtools/client/netmonitor/test/browser_net_json-empty.js @@ -30,7 +30,7 @@ add_task(async function() { ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await onResponsePanelReady; diff --git a/devtools/client/netmonitor/test/browser_net_json-long.js b/devtools/client/netmonitor/test/browser_net_json-long.js index 7ed7cfa09337..319014441956 100644 --- a/devtools/client/netmonitor/test/browser_net_json-long.js +++ b/devtools/client/netmonitor/test/browser_net_json-long.js @@ -32,7 +32,7 @@ add_task(async function() { const requestItem = document.querySelector(".request-list-item"); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -64,7 +64,7 @@ add_task(async function() { store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([wait, waitForPropsView]); diff --git a/devtools/client/netmonitor/test/browser_net_json-malformed.js b/devtools/client/netmonitor/test/browser_net_json-malformed.js index 3ba474efbcdc..2e262f87912f 100644 --- a/devtools/client/netmonitor/test/browser_net_json-malformed.js +++ b/devtools/client/netmonitor/test/browser_net_json-malformed.js @@ -27,7 +27,7 @@ add_task(async function() { const requestItem = document.querySelector(".request-list-item"); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -47,7 +47,7 @@ add_task(async function() { const wait = waitForDOM(document, "#response-panel .CodeMirror-code"); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; const tabpanel = document.querySelector("#response-panel"); diff --git a/devtools/client/netmonitor/test/browser_net_json-nogrip.js b/devtools/client/netmonitor/test/browser_net_json-nogrip.js index a1f901ea5840..ce75a1e2767a 100644 --- a/devtools/client/netmonitor/test/browser_net_json-nogrip.js +++ b/devtools/client/netmonitor/test/browser_net_json-nogrip.js @@ -34,7 +34,7 @@ add_task(async function() { ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([onResponsePanelReady, onPropsViewReady]); const tabpanel = document.querySelector("#response-panel"); diff --git a/devtools/client/netmonitor/test/browser_net_json-null.js b/devtools/client/netmonitor/test/browser_net_json-null.js index a9b41167d846..bb81384564c7 100644 --- a/devtools/client/netmonitor/test/browser_net_json-null.js +++ b/devtools/client/netmonitor/test/browser_net_json-null.js @@ -34,7 +34,7 @@ add_task(async function() { 1 ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([onResponsePanelReady, onPropsViewReady]); const tabpanel = document.querySelector("#response-panel"); diff --git a/devtools/client/netmonitor/test/browser_net_json_custom_mime.js b/devtools/client/netmonitor/test/browser_net_json_custom_mime.js index 0f510c6ddbe9..3243e524113f 100644 --- a/devtools/client/netmonitor/test/browser_net_json_custom_mime.js +++ b/devtools/client/netmonitor/test/browser_net_json_custom_mime.js @@ -27,7 +27,7 @@ add_task(async function() { const requestItem = document.querySelector(".request-list-item"); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -55,7 +55,7 @@ add_task(async function() { ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([wait, waitForPropsView]); testJsonSectionInResponseTab(); diff --git a/devtools/client/netmonitor/test/browser_net_json_text_mime.js b/devtools/client/netmonitor/test/browser_net_json_text_mime.js index 25ddc6d351cf..ea467b968a9a 100644 --- a/devtools/client/netmonitor/test/browser_net_json_text_mime.js +++ b/devtools/client/netmonitor/test/browser_net_json_text_mime.js @@ -28,7 +28,7 @@ add_task(async function() { const requestItem = document.querySelector(".request-list-item"); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -56,7 +56,7 @@ add_task(async function() { ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([wait, waitForPropsView]); testJsonSectionInResponseTab(); diff --git a/devtools/client/netmonitor/test/browser_net_jsonp.js b/devtools/client/netmonitor/test/browser_net_jsonp.js index e0b48df140b0..3482d65f2421 100644 --- a/devtools/client/netmonitor/test/browser_net_jsonp.js +++ b/devtools/client/netmonitor/test/browser_net_jsonp.js @@ -28,7 +28,7 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); } @@ -73,7 +73,7 @@ add_task(async function() { ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await Promise.all([wait, waitForPropsView]); testJsonSectionInResponseTab(`"Hello JSONP!"`); @@ -90,7 +90,7 @@ add_task(async function() { info("Testing second request"); wait = waitForDOM(document, "#response-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[1] ); diff --git a/devtools/client/netmonitor/test/browser_net_large-response.js b/devtools/client/netmonitor/test/browser_net_large-response.js index d64a3f74c1c9..58854a0b2442 100644 --- a/devtools/client/netmonitor/test/browser_net_large-response.js +++ b/devtools/client/netmonitor/test/browser_net_large-response.js @@ -38,7 +38,7 @@ add_task(async function() { const requestItem = document.querySelector(".request-list-item"); requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); @@ -56,7 +56,7 @@ add_task(async function() { wait = waitForDOM(document, "#response-panel .accordion-item", 2); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; wait = waitForDOM(document, "#response-panel .CodeMirror-code"); diff --git a/devtools/client/netmonitor/test/browser_net_open_in_debugger.js b/devtools/client/netmonitor/test/browser_net_open_in_debugger.js index a0953ef70159..b7e5606da1c0 100644 --- a/devtools/client/netmonitor/test/browser_net_open_in_debugger.js +++ b/devtools/client/netmonitor/test/browser_net_open_in_debugger.js @@ -23,11 +23,11 @@ add_task(async function() { // Execute requests. await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[2] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[2] ); diff --git a/devtools/client/netmonitor/test/browser_net_open_in_style_editor.js b/devtools/client/netmonitor/test/browser_net_open_in_style_editor.js index cb402975447c..985cf88acaa8 100644 --- a/devtools/client/netmonitor/test/browser_net_open_in_style_editor.js +++ b/devtools/client/netmonitor/test/browser_net_open_in_style_editor.js @@ -23,11 +23,11 @@ add_task(async function() { // Execute requests. await performRequests(monitor, tab, CONTENT_TYPE_WITHOUT_CACHE_REQUESTS); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[1] ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[1] ); diff --git a/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js b/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js index 4b53e1828e4d..b9ee25095710 100644 --- a/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js +++ b/devtools/client/netmonitor/test/browser_net_open_request_in_tab.js @@ -64,8 +64,8 @@ add_task(async function() { async function openLastRequestInTab() { const requestItems = document.querySelectorAll(".request-list-item"); const lastRequest = requestItems[requestItems.length - 1]; - EventUtils.sendMouseEvent({ type: "mousedown" }, lastRequest); - EventUtils.sendMouseEvent({ type: "contextmenu" }, lastRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, lastRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, lastRequest); await waitUntil(() => getContextMenuItem(monitor, "request-list-context-newtab") ); @@ -146,7 +146,7 @@ add_task(async function() { const lastRequest = requestItems[requestItems.length - 1]; const onTabOpen = once(gBrowser.tabContainer, "TabOpen", false); - EventUtils.sendMouseEvent({ type: "dblclick" }, lastRequest); + await EventUtils.sendMouseEvent({ type: "dblclick" }, lastRequest); await onTabOpen; info("A new tab has been opened"); diff --git a/devtools/client/netmonitor/test/browser_net_pane-collapse.js b/devtools/client/netmonitor/test/browser_net_pane-collapse.js index 6e39fd056c01..1aa95c0049c6 100644 --- a/devtools/client/netmonitor/test/browser_net_pane-collapse.js +++ b/devtools/client/netmonitor/test/browser_net_pane-collapse.js @@ -40,7 +40,7 @@ add_task(async function() { "The details panel should at this point be visible." ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".sidebar-toggle") ); diff --git a/devtools/client/netmonitor/test/browser_net_pane-network-details.js b/devtools/client/netmonitor/test/browser_net_pane-network-details.js index 91a3f3a01f37..928d2e30b66f 100644 --- a/devtools/client/netmonitor/test/browser_net_pane-network-details.js +++ b/devtools/client/netmonitor/test/browser_net_pane-network-details.js @@ -46,34 +46,34 @@ add_task(async function() { await wait; info("Test with the first request in the list visible"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - testDetailsPanel(true, 0); + await testDetailsPanel(true, 0); info("Test with first request in the list not visible"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-js-button") ); testFilterButtons(monitor, "js"); - testDetailsPanel(true, 2); + await testDetailsPanel(true, 2); info( "Test with no request in the list visible i.e. no request match the filters" ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-all-button") ); setFreetextFilter("foobar"); // The network details panel should not open as there are no available requests visible - testDetailsPanel(false); + await testDetailsPanel(false); await teardown(monitor); @@ -86,7 +86,7 @@ add_task(async function() { ); } - function testDetailsPanel(shouldPanelOpen, selectedItemIndex = 0) { + async function testDetailsPanel(shouldPanelOpen, selectedItemIndex = 0) { // Expected default state should be panel closed ok( !document.querySelector(".sidebar-toggle"), @@ -131,7 +131,7 @@ add_task(async function() { `The item index ${selectedItemIndex} should be selected in the requests menu.` ); // Close the panel - EventUtils.sendMouseEvent({ type: "click" }, toggleButton); + await EventUtils.sendMouseEvent({ type: "click" }, toggleButton); } else { ok(!toggleButton, "The pane toggle button should be not visible."); is( diff --git a/devtools/client/netmonitor/test/browser_net_pane-toggle.js b/devtools/client/netmonitor/test/browser_net_pane-toggle.js index f2ead92c1f19..1d074de32b93 100644 --- a/devtools/client/netmonitor/test/browser_net_pane-toggle.js +++ b/devtools/client/netmonitor/test/browser_net_pane-toggle.js @@ -81,7 +81,7 @@ add_task(async function() { "The first item should be selected in the requests menu." ); - EventUtils.sendMouseEvent({ type: "click" }, toggleButton); + await EventUtils.sendMouseEvent({ type: "click" }, toggleButton); is( !!document.querySelector(".network-details-bar"), diff --git a/devtools/client/netmonitor/test/browser_net_params_sorted.js b/devtools/client/netmonitor/test/browser_net_params_sorted.js index ccc31bcc21ef..02f950596a7c 100644 --- a/devtools/client/netmonitor/test/browser_net_params_sorted.js +++ b/devtools/client/netmonitor/test/browser_net_params_sorted.js @@ -21,13 +21,13 @@ add_task(async function() { await performRequests(monitor, tab, 1); const wait = waitForDOM(document, ".headers-overview"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); // The Params panel should render the following // POSTed JSON data structure: diff --git a/devtools/client/netmonitor/test/browser_net_pause.js b/devtools/client/netmonitor/test/browser_net_pause.js index ce16ab945c2e..5d4db7b3abc3 100644 --- a/devtools/client/netmonitor/test/browser_net_pause.js +++ b/devtools/client/netmonitor/test/browser_net_pause.js @@ -35,20 +35,20 @@ add_task(async function() { }); // Click pause, load second request and make sure they don't show up. - EventUtils.sendMouseEvent({ type: "click" }, pauseButton); + await EventUtils.sendMouseEvent({ type: "click" }, pauseButton); await performPausedRequest(tab, monitor, toolbox); ok(noRequest, "There should be no activity when paused."); assertRequestCount(store, 1); // Click pause again to resume monitoring. Load a third request // and make sure they will show up. - EventUtils.sendMouseEvent({ type: "click" }, pauseButton); + await EventUtils.sendMouseEvent({ type: "click" }, pauseButton); await performRequestAndWait(tab, monitor); assertRequestCount(store, 2); // Click pause, reload the page and check that there are // some requests. Page reload should auto-resume. - EventUtils.sendMouseEvent({ type: "click" }, pauseButton); + await EventUtils.sendMouseEvent({ type: "click" }, pauseButton); const networkEvents = waitForNetworkEvents(monitor, 1); tab.linkedBrowser.reload(); await networkEvents; diff --git a/devtools/client/netmonitor/test/browser_net_post-data-01.js b/devtools/client/netmonitor/test/browser_net_post-data-01.js index 735cfd4a710a..54f088d6107d 100644 --- a/devtools/client/netmonitor/test/browser_net_post-data-01.js +++ b/devtools/client/netmonitor/test/browser_net_post-data-01.js @@ -32,7 +32,7 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); } @@ -69,11 +69,11 @@ add_task(async function() { // Wait for all accordion items updated by react const wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); await wait; await testParamsTab("urlencoded"); @@ -87,7 +87,7 @@ add_task(async function() { document, "#request-panel .CodeMirror-code" ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[1] ); diff --git a/devtools/client/netmonitor/test/browser_net_post-data-02.js b/devtools/client/netmonitor/test/browser_net_post-data-02.js index ca31bb8ab533..b53275bdb6ce 100644 --- a/devtools/client/netmonitor/test/browser_net_post-data-02.js +++ b/devtools/client/netmonitor/test/browser_net_post-data-02.js @@ -25,11 +25,11 @@ add_task(async function() { // Wait for all tree view updated by react const wait = waitForDOM(document, "#request-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); await wait; const tabpanel = document.querySelector("#request-panel"); diff --git a/devtools/client/netmonitor/test/browser_net_post-data-03.js b/devtools/client/netmonitor/test/browser_net_post-data-03.js index 9b2a0d40b1a2..08b895ba68f2 100644 --- a/devtools/client/netmonitor/test/browser_net_post-data-03.js +++ b/devtools/client/netmonitor/test/browser_net_post-data-03.js @@ -26,7 +26,7 @@ add_task(async function() { // Wait for all tree view updated by react let wait = waitForDOM(document, "#headers-panel .accordion-item", 3); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "headers"); + await clickOnSidebarTab(document, "headers"); await wait; let tabpanel = document.querySelector("#headers-panel"); @@ -72,7 +72,7 @@ add_task(async function() { // Wait for all tree sections updated by react wait = waitForDOM(document, "#request-panel .accordion-item", 2); - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); await wait; tabpanel = document.querySelector("#request-panel"); diff --git a/devtools/client/netmonitor/test/browser_net_post-data-04.js b/devtools/client/netmonitor/test/browser_net_post-data-04.js index 5bcb8cc41acd..d196afe25537 100644 --- a/devtools/client/netmonitor/test/browser_net_post-data-04.js +++ b/devtools/client/netmonitor/test/browser_net_post-data-04.js @@ -35,7 +35,7 @@ add_task(async function() { "#request-panel .CodeMirror-code" ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); await Promise.all([waitAccordionItems, waitSourceEditor]); const tabpanel = document.querySelector("#request-panel"); diff --git a/devtools/client/netmonitor/test/browser_net_raw_headers.js b/devtools/client/netmonitor/test/browser_net_raw_headers.js index 6f946888b708..7c130d479430 100644 --- a/devtools/client/netmonitor/test/browser_net_raw_headers.js +++ b/devtools/client/netmonitor/test/browser_net_raw_headers.js @@ -25,25 +25,37 @@ add_task(async function() { await performRequests(monitor, tab, 2); let wait = waitForDOM(document, "#headers-panel .accordion-item", 2); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; wait = waitForDOM(document, "#responseHeaders textarea.raw-headers", 1); - EventUtils.sendMouseEvent({ type: "click" }, getRawHeadersToggle("RESPONSE")); + await EventUtils.sendMouseEvent( + { type: "click" }, + getRawHeadersToggle("RESPONSE") + ); await wait; wait = waitForDOM(document, "#requestHeaders textarea.raw-headers", 1); - EventUtils.sendMouseEvent({ type: "click" }, getRawHeadersToggle("REQUEST")); + await EventUtils.sendMouseEvent( + { type: "click" }, + getRawHeadersToggle("REQUEST") + ); await wait; testRawHeaderToggleStyle(true); testShowRawHeaders(getSortedRequests(store.getState())[0]); - EventUtils.sendMouseEvent({ type: "click" }, getRawHeadersToggle("RESPONSE")); - EventUtils.sendMouseEvent({ type: "click" }, getRawHeadersToggle("REQUEST")); + await EventUtils.sendMouseEvent( + { type: "click" }, + getRawHeadersToggle("RESPONSE") + ); + await EventUtils.sendMouseEvent( + { type: "click" }, + getRawHeadersToggle("REQUEST") + ); testRawHeaderToggleStyle(false); testHideRawHeaders(document); diff --git a/devtools/client/netmonitor/test/browser_net_reload-button.js b/devtools/client/netmonitor/test/browser_net_reload-button.js index 5feacae38573..1ce624817097 100644 --- a/devtools/client/netmonitor/test/browser_net_reload-button.js +++ b/devtools/client/netmonitor/test/browser_net_reload-button.js @@ -14,7 +14,7 @@ add_task(async function() { const { document } = monitor.panelWin; const wait = waitForNetworkEvents(monitor, 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-reload-notice-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_req-resp-bodies.js b/devtools/client/netmonitor/test/browser_net_req-resp-bodies.js index d62ab267b33c..b5e7ad943255 100644 --- a/devtools/client/netmonitor/test/browser_net_req-resp-bodies.js +++ b/devtools/client/netmonitor/test/browser_net_req-resp-bodies.js @@ -55,7 +55,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); } diff --git a/devtools/client/netmonitor/test/browser_net_resend_csp.js b/devtools/client/netmonitor/test/browser_net_resend_csp.js index 78f81feb6f58..c569bc0b9274 100644 --- a/devtools/client/netmonitor/test/browser_net_resend_csp.js +++ b/devtools/client/netmonitor/test/browser_net_resend_csp.js @@ -21,7 +21,7 @@ add_task(async function() { // Select the image request const imgRequest = document.querySelectorAll(".request-list-item")[0]; - EventUtils.sendMouseEvent({ type: "mousedown" }, imgRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, imgRequest); // Stores original request for comparison of values later const { getSelectedRequest } = windowRequire( @@ -30,7 +30,7 @@ add_task(async function() { const origReq = getSelectedRequest(store.getState()); // Context Menu > "Resend" - EventUtils.sendMouseEvent({ type: "contextmenu" }, imgRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, imgRequest); getContextMenuItem(monitor, "request-list-context-resend-only").click(); await performRequests(monitor, tab, 1); diff --git a/devtools/client/netmonitor/test/browser_net_resend_xhr.js b/devtools/client/netmonitor/test/browser_net_resend_xhr.js index 258962bf2662..d780bf139003 100644 --- a/devtools/client/netmonitor/test/browser_net_resend_xhr.js +++ b/devtools/client/netmonitor/test/browser_net_resend_xhr.js @@ -21,7 +21,7 @@ add_task(async function() { // Selects 1st request const firstRequest = document.querySelectorAll(".request-list-item")[0]; - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); // Stores original request for comparison of values later const { getSelectedRequest } = windowRequire( @@ -31,7 +31,7 @@ add_task(async function() { const waitForResentRequestEvent = waitForNetworkEvents(monitor, 1); // Context Menu > "Resend" - EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); getContextMenuItem(monitor, "request-list-context-resend-only").click(); await waitForResentRequestEvent; diff --git a/devtools/client/netmonitor/test/browser_net_security-details.js b/devtools/client/netmonitor/test/browser_net_security-details.js index 90acf28e5c41..5ce69bb28cee 100644 --- a/devtools/client/netmonitor/test/browser_net_security-details.js +++ b/devtools/client/netmonitor/test/browser_net_security-details.js @@ -29,7 +29,7 @@ add_task(async function() { await wait; store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "security"); + await clickOnSidebarTab(document, "security"); await waitUntil(() => document.querySelector("#security-panel .security-info-value") ); diff --git a/devtools/client/netmonitor/test/browser_net_security-error.js b/devtools/client/netmonitor/test/browser_net_security-error.js index 4b1e1c3a880c..743d8ea10eb4 100644 --- a/devtools/client/netmonitor/test/browser_net_security-error.js +++ b/devtools/client/netmonitor/test/browser_net_security-error.js @@ -28,7 +28,7 @@ add_task(async function() { store.dispatch(Actions.toggleNetworkDetails()); await waitUntil(() => document.querySelector("#security-tab")); - clickOnSidebarTab(document, "security"); + await clickOnSidebarTab(document, "security"); await securityInfoLoaded; const errormsg = document.querySelector(".security-info-value"); diff --git a/devtools/client/netmonitor/test/browser_net_security-icon-click.js b/devtools/client/netmonitor/test/browser_net_security-icon-click.js index 6f8e9731b3e7..59d1fba96f92 100644 --- a/devtools/client/netmonitor/test/browser_net_security-icon-click.js +++ b/devtools/client/netmonitor/test/browser_net_security-icon-click.js @@ -29,10 +29,10 @@ add_task(async function() { await clickAndTestSecurityIcon(); info("Selecting headers panel again."); - clickOnSidebarTab(document, "headers"); + await clickOnSidebarTab(document, "headers"); info("Sorting the items by filename."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-file-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_security-tab-deselect.js b/devtools/client/netmonitor/test/browser_net_security-tab-deselect.js index aaa39cc92185..4f8468758ed6 100644 --- a/devtools/client/netmonitor/test/browser_net_security-tab-deselect.js +++ b/devtools/client/netmonitor/test/browser_net_security-tab-deselect.js @@ -34,20 +34,20 @@ add_task(async function() { info("Selecting secure request."); wait = waitForDOM(document, ".tabs"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; info("Selecting security tab."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelector("#security-tab") ); info("Selecting insecure request."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[1] ); diff --git a/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js b/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js index 621b7fef88e4..1eff79b630ac 100644 --- a/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js +++ b/devtools/client/netmonitor/test/browser_net_security-tab-visibility.js @@ -68,7 +68,7 @@ add_task(async function() { await onComplete; info("Selecting the request."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -89,7 +89,7 @@ add_task(async function() { if (testcase.visibleOnSecurityInfo) { // click security panel to lazy load the securityState await waitUntil(() => document.querySelector("#security-tab")); - clickOnSidebarTab(document, "security"); + await clickOnSidebarTab(document, "security"); await waitUntil(() => document.querySelector("#security-panel .security-info-value") ); diff --git a/devtools/client/netmonitor/test/browser_net_security-warnings.js b/devtools/client/netmonitor/test/browser_net_security-warnings.js index c7e3fb3698e4..5c950e0e0121 100644 --- a/devtools/client/netmonitor/test/browser_net_security-warnings.js +++ b/devtools/client/netmonitor/test/browser_net_security-warnings.js @@ -38,7 +38,7 @@ add_task(async function() { info("Selecting the request."); wait = waitForDOM(document, ".tabs"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -47,7 +47,7 @@ add_task(async function() { if (!document.querySelector("#security-tab[aria-selected=true]")) { info("Selecting security tab."); wait = waitForDOM(document, "#security-panel .properties-view"); - clickOnSidebarTab(document, "security"); + await clickOnSidebarTab(document, "security"); await wait; } diff --git a/devtools/client/netmonitor/test/browser_net_server_timings.js b/devtools/client/netmonitor/test/browser_net_server_timings.js index 0fbcd667d9d8..2f923645b81c 100644 --- a/devtools/client/netmonitor/test/browser_net_server_timings.js +++ b/devtools/client/netmonitor/test/browser_net_server_timings.js @@ -36,7 +36,7 @@ add_task(async function() { interactiveRule: false, labelRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelectorAll(".request-list-item")[0] ); @@ -44,7 +44,7 @@ add_task(async function() { store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "timings"); + await clickOnSidebarTab(document, "timings"); await wait; // Check the UI contains server side timings and correct values diff --git a/devtools/client/netmonitor/test/browser_net_service-worker-status.js b/devtools/client/netmonitor/test/browser_net_service-worker-status.js index f75f03bcdcab..9d24c1b5c814 100644 --- a/devtools/client/netmonitor/test/browser_net_service-worker-status.js +++ b/devtools/client/netmonitor/test/browser_net_service-worker-status.js @@ -64,7 +64,7 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); } diff --git a/devtools/client/netmonitor/test/browser_net_set-cookie-same-site.js b/devtools/client/netmonitor/test/browser_net_set-cookie-same-site.js index 189cebec459c..33efa0b261f9 100644 --- a/devtools/client/netmonitor/test/browser_net_set-cookie-same-site.js +++ b/devtools/client/netmonitor/test/browser_net_set-cookie-same-site.js @@ -22,13 +22,13 @@ add_task(async function() { await wait; wait = waitForDOM(document, ".headers-overview"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); await wait; - clickOnSidebarTab(document, "cookies"); + await clickOnSidebarTab(document, "cookies"); info("Checking the SameSite property"); const expectedValues = [ diff --git a/devtools/client/netmonitor/test/browser_net_simple-request-data.js b/devtools/client/netmonitor/test/browser_net_simple-request-data.js index e41357b710f7..fb6b4535f5f1 100644 --- a/devtools/client/netmonitor/test/browser_net_simple-request-data.js +++ b/devtools/client/netmonitor/test/browser_net_simple-request-data.js @@ -320,7 +320,10 @@ function test() { const requestsListStatus = requestListItem.querySelector( ".status-code" ); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded( requestListItem, diff --git a/devtools/client/netmonitor/test/browser_net_simple-request-details.js b/devtools/client/netmonitor/test/browser_net_simple-request-details.js index 954887cf0b78..98e0f07b2379 100644 --- a/devtools/client/netmonitor/test/browser_net_simple-request-details.js +++ b/devtools/client/netmonitor/test/browser_net_simple-request-details.js @@ -353,10 +353,11 @@ add_task(async function() { )[pos]; const onPanelOpen = waitForDOM(document, `#${tabName}-panel`); - clickOnSidebarTab( + await clickOnSidebarTab( document, tabEl.id.substring(0, tabEl.id.indexOf("-tab")) ); + await EventUtils.sendMouseEvent({ type: "click" }, tabEl); await onPanelOpen; is( diff --git a/devtools/client/netmonitor/test/browser_net_sort-01.js b/devtools/client/netmonitor/test/browser_net_sort-01.js index e59f993a30e8..02e9fc8564b6 100644 --- a/devtools/client/netmonitor/test/browser_net_sort-01.js +++ b/devtools/client/netmonitor/test/browser_net_sort-01.js @@ -78,7 +78,7 @@ add_task(async function() { await testContents([0, 2, 4, 3, 1], 0); info("Testing status sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -95,7 +95,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], 0); info("Testing status sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -112,7 +112,7 @@ add_task(async function() { await testContents([14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0], 14); info("Testing status sort yet again, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -120,7 +120,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], 0); info("Testing status sort yet again, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -219,7 +219,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); } diff --git a/devtools/client/netmonitor/test/browser_net_sort-02.js b/devtools/client/netmonitor/test/browser_net_sort-02.js index 9fdeb6b7d369..34a7687fc404 100644 --- a/devtools/client/netmonitor/test/browser_net_sort-02.js +++ b/devtools/client/netmonitor/test/browser_net_sort-02.js @@ -78,7 +78,7 @@ add_task(async function() { await testContents([0, 2, 4, 3, 1]); info("Testing status sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -86,7 +86,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing status sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -94,7 +94,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing status sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); @@ -102,7 +102,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing method sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-method-button") ); @@ -110,7 +110,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing method sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-method-button") ); @@ -118,7 +118,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing method sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-method-button") ); @@ -126,7 +126,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing file sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-file-button") ); @@ -134,7 +134,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing file sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-file-button") ); @@ -142,7 +142,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing file sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-file-button") ); @@ -150,7 +150,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing URL sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-url-button") ); @@ -158,7 +158,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing URL sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-url-button") ); @@ -166,7 +166,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing URL sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-url-button") ); @@ -174,7 +174,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing type sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-type-button") ); @@ -182,7 +182,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing type sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-type-button") ); @@ -190,7 +190,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing type sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-type-button") ); @@ -198,7 +198,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing transferred sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-transferred-button") ); @@ -206,7 +206,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing transferred sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-transferred-button") ); @@ -214,7 +214,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing transferred sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-transferred-button") ); @@ -222,7 +222,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing size sort, ascending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-contentSize-button") ); @@ -230,7 +230,7 @@ add_task(async function() { await testContents([0, 1, 2, 3, 4]); info("Testing size sort, descending."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-contentSize-button") ); @@ -238,7 +238,7 @@ add_task(async function() { await testContents([4, 3, 2, 1, 0]); info("Testing size sort, ascending. Checking sort loops correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-contentSize-button") ); @@ -251,7 +251,7 @@ add_task(async function() { // opened, the waterfall button is not visible. Therefore we hide the network // details panel await store.dispatch(Actions.toggleNetworkDetails()); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-waterfall-button") ); @@ -261,7 +261,7 @@ add_task(async function() { info("Testing waterfall sort, descending."); await store.dispatch(Actions.toggleNetworkDetails()); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-waterfall-button") ); @@ -271,7 +271,7 @@ add_task(async function() { info("Testing waterfall sort, ascending. Checking sort loops correctly."); await store.dispatch(Actions.toggleNetworkDetails()); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-waterfall-button") ); @@ -373,7 +373,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); } diff --git a/devtools/client/netmonitor/test/browser_net_sort-reset.js b/devtools/client/netmonitor/test/browser_net_sort-reset.js index 30c97b696f71..6967676b0ae5 100644 --- a/devtools/client/netmonitor/test/browser_net_sort-reset.js +++ b/devtools/client/netmonitor/test/browser_net_sort-reset.js @@ -61,24 +61,24 @@ add_task(async function() { testHeaders(); await testContents([0, 2, 4, 3, 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); info("Testing sort reset using middle click."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", button: 1 }, document.querySelector("#requests-list-status-button") ); testHeaders(); await testContents([0, 2, 4, 3, 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); info("Testing sort reset using context menu 'Reset Sorting'"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector("#requests-list-contentSize-button") ); @@ -86,12 +86,12 @@ add_task(async function() { testHeaders(); await testContents([0, 2, 4, 3, 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#requests-list-status-button") ); info("Testing sort reset using context menu 'Reset Columns'"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector("#requests-list-contentSize-button") ); @@ -197,7 +197,10 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); } diff --git a/devtools/client/netmonitor/test/browser_net_sse-basic.js b/devtools/client/netmonitor/test/browser_net_sse-basic.js index b37b112085cc..37b6c7e06bd6 100644 --- a/devtools/client/netmonitor/test/browser_net_sse-basic.js +++ b/devtools/client/netmonitor/test/browser_net_sse-basic.js @@ -35,7 +35,7 @@ add_task(async function() { is(requests.length, 1, "There should be one request"); // Select the request to open the side panel. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Wait for messages to be displayed in DevTools const wait = waitForDOM( @@ -45,7 +45,7 @@ add_task(async function() { ); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -106,7 +106,7 @@ add_task(async function() { await waitForTick(); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector(".message-list-headers") ); diff --git a/devtools/client/netmonitor/test/browser_net_statistics-02.js b/devtools/client/netmonitor/test/browser_net_statistics-02.js index 129914df3e59..7547438dce6c 100644 --- a/devtools/client/netmonitor/test/browser_net_statistics-02.js +++ b/devtools/client/netmonitor/test/browser_net_statistics-02.js @@ -16,23 +16,23 @@ add_task(async function() { const { document, store, windowRequire, connector } = panel; const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-css-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-js-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-ws-button") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-other-button") ); @@ -55,7 +55,7 @@ add_task(async function() { ); ok(true, "Two real pie charts appear to be rendered correctly."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".pie-chart-slice") ); diff --git a/devtools/client/netmonitor/test/browser_net_status-codes.js b/devtools/client/netmonitor/test/browser_net_status-codes.js index 56f44ef0f3e7..11f9b8fab402 100644 --- a/devtools/client/netmonitor/test/browser_net_status-codes.js +++ b/devtools/client/netmonitor/test/browser_net_status-codes.js @@ -117,7 +117,10 @@ add_task(async function() { for (const requestItem of requestListItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent( + { type: "mouseover" }, + requestsListStatus + ); await waitUntil(() => requestsListStatus.title); } @@ -166,7 +169,7 @@ add_task(async function() { * A function that tests "Headers" panel contains correct information. */ async function testHeaders(data, index) { - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); @@ -184,7 +187,7 @@ add_task(async function() { const statusCode = panel.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, statusCode); + await EventUtils.sendMouseEvent({ type: "mouseover" }, statusCode); await waitUntil(() => statusCode.title); is( diff --git a/devtools/client/netmonitor/test/browser_net_streaming-response.js b/devtools/client/netmonitor/test/browser_net_streaming-response.js index 8845808e955f..c57f6725a991 100644 --- a/devtools/client/netmonitor/test/browser_net_streaming-response.js +++ b/devtools/client/netmonitor/test/browser_net_streaming-response.js @@ -42,7 +42,7 @@ add_task(async function() { for (const requestItem of requestItems) { requestItem.scrollIntoView(); const requestsListStatus = requestItem.querySelector(".status-code"); - EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); + await EventUtils.sendMouseEvent({ type: "mouseover" }, requestsListStatus); await waitUntil(() => requestsListStatus.title); await waitForDOMIfNeeded(requestItem, ".requests-list-timings-total"); } @@ -63,7 +63,7 @@ add_task(async function() { wait = waitForDOM(document, "#response-panel"); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; store.dispatch(Actions.selectRequest(null)); diff --git a/devtools/client/netmonitor/test/browser_net_telemetry_edit_resend.js b/devtools/client/netmonitor/test/browser_net_telemetry_edit_resend.js index ef3870b12f60..e635f710ccf0 100644 --- a/devtools/client/netmonitor/test/browser_net_telemetry_edit_resend.js +++ b/devtools/client/netmonitor/test/browser_net_telemetry_edit_resend.js @@ -33,10 +33,10 @@ add_task(async function() { const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview") ); - EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "mousedown" }, firstRequest); await waitForHeaders; await waitForRequestData(store, ["requestHeaders", "responseHeaders"]); - EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, firstRequest); // Open "New Request" form and resend. getContextMenuItem(monitor, "request-list-context-resend").click(); diff --git a/devtools/client/netmonitor/test/browser_net_telemetry_filters_changed.js b/devtools/client/netmonitor/test/browser_net_telemetry_filters_changed.js index 34a5dbd4b45d..cec725d91f30 100644 --- a/devtools/client/netmonitor/test/browser_net_telemetry_filters_changed.js +++ b/devtools/client/netmonitor/test/browser_net_telemetry_filters_changed.js @@ -33,7 +33,7 @@ add_task(async function() { await wait; info("Click on the 'HTML' filter"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-html-button") ); @@ -50,7 +50,7 @@ add_task(async function() { ); info("Click on the 'CSS' filter"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector(".requests-list-filter-css-button") ); diff --git a/devtools/client/netmonitor/test/browser_net_telemetry_select_ws_frame.js b/devtools/client/netmonitor/test/browser_net_telemetry_select_ws_frame.js index 7e70cb6ffbef..822ceb28fd0a 100644 --- a/devtools/client/netmonitor/test/browser_net_telemetry_select_ws_frame.js +++ b/devtools/client/netmonitor/test/browser_net_telemetry_select_ws_frame.js @@ -39,7 +39,7 @@ add_task(async function() { is(requests.length, 1, "There should be one request"); // Select the request to open the side panel. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Wait for all sent/received messages to be displayed in DevTools. const wait = waitForDOM( @@ -49,7 +49,7 @@ add_task(async function() { ); // Click on the "Response" panel. - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel. @@ -69,7 +69,7 @@ add_task(async function() { ); // Select frame - EventUtils.sendMouseEvent({ type: "mousedown" }, frames[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, frames[0]); await payloadResolved; // Verify existence of the telemetry event. diff --git a/devtools/client/netmonitor/test/browser_net_telemetry_sidepanel_changed.js b/devtools/client/netmonitor/test/browser_net_telemetry_sidepanel_changed.js index e516908a2753..2f166b610c43 100644 --- a/devtools/client/netmonitor/test/browser_net_telemetry_sidepanel_changed.js +++ b/devtools/client/netmonitor/test/browser_net_telemetry_sidepanel_changed.js @@ -33,7 +33,7 @@ add_task(async function() { const waitForHeaders = waitUntil(() => document.querySelector(".headers-overview") ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -42,7 +42,7 @@ add_task(async function() { // Click on the Cookies panel and wait till it's opened. info("Click on the Cookies panel"); - clickOnSidebarTab(document, "cookies"); + await clickOnSidebarTab(document, "cookies"); await waitForRequestData(store, ["requestCookies", "responseCookies"]); checkTelemetryEvent( diff --git a/devtools/client/netmonitor/test/browser_net_truncate-post-data.js b/devtools/client/netmonitor/test/browser_net_truncate-post-data.js index f5169594ba25..0a9f07614839 100644 --- a/devtools/client/netmonitor/test/browser_net_truncate-post-data.js +++ b/devtools/client/netmonitor/test/browser_net_truncate-post-data.js @@ -41,7 +41,7 @@ add_task(async function() { ); store.dispatch(Actions.toggleNetworkDetails()); - clickOnSidebarTab(document, "request"); + await clickOnSidebarTab(document, "request"); await Promise.all([waitAccordionItems, waitSourceEditor]); diff --git a/devtools/client/netmonitor/test/browser_net_url-preview.js b/devtools/client/netmonitor/test/browser_net_url-preview.js index f5f0c652b933..590df5b49770 100644 --- a/devtools/client/netmonitor/test/browser_net_url-preview.js +++ b/devtools/client/netmonitor/test/browser_net_url-preview.js @@ -23,7 +23,7 @@ add_task(async function() { await performRequests(monitor, tab, 3); let wait = waitForDOM(document, "#headers-panel .url-preview", 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[0] ); @@ -34,7 +34,7 @@ add_task(async function() { // Select the second request wait = waitForDOM(document, "#headers-panel .url-preview", 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[1] ); @@ -54,7 +54,7 @@ add_task(async function() { // Select the third request wait = waitForDOM(document, "#headers-panel .url-preview", 1); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[2] ); diff --git a/devtools/client/netmonitor/test/browser_net_use_as_fetch.js b/devtools/client/netmonitor/test/browser_net_use_as_fetch.js index f471986151eb..c7099750148b 100644 --- a/devtools/client/netmonitor/test/browser_net_use_as_fetch.js +++ b/devtools/client/netmonitor/test/browser_net_use_as_fetch.js @@ -56,8 +56,11 @@ add_task(async function() { const { document } = monitor.panelWin; const items = document.querySelectorAll(".request-list-item"); - EventUtils.sendMouseEvent({ type: "mousedown" }, items[items.length - 1]); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( + { type: "mousedown" }, + items[items.length - 1] + ); + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelectorAll(".request-list-item")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_view-source-debugger.js b/devtools/client/netmonitor/test/browser_net_view-source-debugger.js index 686a247e8764..8ec62eed6d31 100644 --- a/devtools/client/netmonitor/test/browser_net_view-source-debugger.js +++ b/devtools/client/netmonitor/test/browser_net_view-source-debugger.js @@ -33,7 +33,7 @@ add_task(async function() { info("Clicking stack-trace tab and waiting for stack-trace panel to open"); const waitForTab = waitForDOM(document, "#stack-trace-tab"); // Click on the first request - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelector(".request-list-item") ); diff --git a/devtools/client/netmonitor/test/browser_net_waterfall-click.js b/devtools/client/netmonitor/test/browser_net_waterfall-click.js index 87e6ffb77728..0ce60f2525f0 100644 --- a/devtools/client/netmonitor/test/browser_net_waterfall-click.js +++ b/devtools/client/netmonitor/test/browser_net_waterfall-click.js @@ -20,7 +20,7 @@ add_task(async function() { info("Clicking waterfall and waiting for panel update."); const wait = waitForDOM(document, "#timings-panel"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".requests-list-timings")[0] ); diff --git a/devtools/client/netmonitor/test/browser_net_ws-basic.js b/devtools/client/netmonitor/test/browser_net_ws-basic.js index a239fa74df87..85e60fc0a0ee 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-basic.js +++ b/devtools/client/netmonitor/test/browser_net_ws-basic.js @@ -33,7 +33,7 @@ add_task(async function() { is(requests.length, 1, "There should be one request"); // Select the request to open the side panel. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Wait for all sent/received messages to be displayed in DevTools const wait = waitForDOM( @@ -43,7 +43,7 @@ add_task(async function() { ); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel diff --git a/devtools/client/netmonitor/test/browser_net_ws-clear.js b/devtools/client/netmonitor/test/browser_net_ws-clear.js index 636efc1f2d86..d1baa75f6656 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-clear.js +++ b/devtools/client/netmonitor/test/browser_net_ws-clear.js @@ -41,10 +41,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -72,7 +72,7 @@ add_task(async function() { "#messages-view .message-list-table .message-list-item", 2 ); - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); await wait; const secondRequestFrames = document.querySelectorAll( "#messages-view .message-list-table .message-list-item" diff --git a/devtools/client/netmonitor/test/browser_net_ws-connection-closed.js b/devtools/client/netmonitor/test/browser_net_ws-connection-closed.js index 2055f6e8c11c..35804e82ce5e 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-connection-closed.js +++ b/devtools/client/netmonitor/test/browser_net_ws-connection-closed.js @@ -32,10 +32,10 @@ add_task(async function() { const requests = document.querySelectorAll(".request-list-item"); // Select the request to open the side panel. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); const wait = waitForDOM( document, diff --git a/devtools/client/netmonitor/test/browser_net_ws-early-connection.js b/devtools/client/netmonitor/test/browser_net_ws-early-connection.js index 44ac2687783c..d23076b1f21a 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-early-connection.js +++ b/devtools/client/netmonitor/test/browser_net_ws-early-connection.js @@ -45,7 +45,7 @@ add_task(async function() { ok(index !== -1, "There must be one WS connection request"); // Select the connection request to see WS frames in the side panel. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[index]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[index]); info("Waiting for WS frames..."); diff --git a/devtools/client/netmonitor/test/browser_net_ws-filter-dropdown.js b/devtools/client/netmonitor/test/browser_net_ws-filter-dropdown.js index fa7803fb9823..9f70851f7fe9 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-filter-dropdown.js +++ b/devtools/client/netmonitor/test/browser_net_ws-filter-dropdown.js @@ -41,10 +41,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -56,7 +56,7 @@ add_task(async function() { is(frames.length, 4, "There should be four frames"); // Click on filter menu - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, document.querySelector("#frame-filter-menu") ); @@ -111,7 +111,7 @@ add_task(async function() { "#messages-view .message-list-table .message-list-item", 3 ); - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); await wait; const secondRequestFrames = document.querySelectorAll( "#messages-view .message-list-table .message-list-item" diff --git a/devtools/client/netmonitor/test/browser_net_ws-filter-regex.js b/devtools/client/netmonitor/test/browser_net_ws-filter-regex.js index 835872f6f44f..759aa4e2e821 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-filter-regex.js +++ b/devtools/client/netmonitor/test/browser_net_ws-filter-regex.js @@ -42,10 +42,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel diff --git a/devtools/client/netmonitor/test/browser_net_ws-json-stomp-payload.js b/devtools/client/netmonitor/test/browser_net_ws-json-stomp-payload.js index 381bba060cfa..450d42f5823c 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-json-stomp-payload.js +++ b/devtools/client/netmonitor/test/browser_net_ws-json-stomp-payload.js @@ -42,10 +42,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -60,7 +60,7 @@ add_task(async function() { await waitForTick(); const waitForData = waitForDOM(document, "#message-formattedData"); const [requestFrame] = frames; - EventUtils.sendMouseEvent({ type: "mousedown" }, requestFrame); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requestFrame); await waitForData; diff --git a/devtools/client/netmonitor/test/browser_net_ws-limit-frames.js b/devtools/client/netmonitor/test/browser_net_ws-limit-frames.js index 72aae5398406..152a319f6f72 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-limit-frames.js +++ b/devtools/client/netmonitor/test/browser_net_ws-limit-frames.js @@ -37,10 +37,10 @@ add_task(async function() { const wait = waitForDOM(document, "#messages-view .truncated-message"); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel diff --git a/devtools/client/netmonitor/test/browser_net_ws-limit-payload.js b/devtools/client/netmonitor/test/browser_net_ws-limit-payload.js index e0c4bc9fc0e9..fe2ba5fa429a 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-limit-payload.js +++ b/devtools/client/netmonitor/test/browser_net_ws-limit-payload.js @@ -42,10 +42,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -58,7 +58,7 @@ add_task(async function() { // Wait for next tick to do async stuff (The MessagePayload component uses the async function getMessagePayload) await waitForTick(); - EventUtils.sendMouseEvent({ type: "mousedown" }, frames[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, frames[0]); await waitForDOM(document, "#messages-view .truncated-data-message"); diff --git a/devtools/client/netmonitor/test/browser_net_ws-messages-navigation.js b/devtools/client/netmonitor/test/browser_net_ws-messages-navigation.js index 88e055ab5778..167516ee0d30 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-messages-navigation.js +++ b/devtools/client/netmonitor/test/browser_net_ws-messages-navigation.js @@ -44,10 +44,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -65,7 +65,7 @@ add_task(async function() { // The first message is actually the second child, there is a hidden row. `.message-list-item:nth-child(${2}).selected` ); - EventUtils.sendMouseEvent({ type: "mousedown" }, frames[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, frames[0]); await waitForSelected; const checkSelected = messageRowNumber => { diff --git a/devtools/client/netmonitor/test/browser_net_ws-sockjs-stomp-payload.js b/devtools/client/netmonitor/test/browser_net_ws-sockjs-stomp-payload.js index 676029a3068f..335861d7a022 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-sockjs-stomp-payload.js +++ b/devtools/client/netmonitor/test/browser_net_ws-sockjs-stomp-payload.js @@ -42,10 +42,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -60,7 +60,7 @@ add_task(async function() { await waitForTick(); const waitForData = waitForDOM(document, "#message-formattedData"); const [, responseFrame] = frames; - EventUtils.sendMouseEvent({ type: "mousedown" }, responseFrame); + await EventUtils.sendMouseEvent({ type: "mousedown" }, responseFrame); await waitForData; diff --git a/devtools/client/netmonitor/test/browser_net_ws-sse-persist-columns.js b/devtools/client/netmonitor/test/browser_net_ws-sse-persist-columns.js index 4224619d7d05..d8a52dde7a31 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-sse-persist-columns.js +++ b/devtools/client/netmonitor/test/browser_net_ws-sse-persist-columns.js @@ -81,13 +81,13 @@ add_task(async function() { is(requests.length, 2, "There should be two requests"); // Select the WS request. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); store.dispatch(Actions.toggleMessageColumn("size")); store.dispatch(Actions.toggleMessageColumn("opCode")); store.dispatch(Actions.toggleMessageColumn("maskBit")); store.dispatch(Actions.toggleMessageColumn("finBit")); - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); // Get all messages present in the "Response" panel const frames = document.querySelectorAll( @@ -140,7 +140,7 @@ add_task(async function() { ); // Select the SSE request. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); store.dispatch(Actions.toggleMessageColumn("lastEventId")); store.dispatch(Actions.toggleMessageColumn("eventName")); @@ -186,7 +186,7 @@ add_task(async function() { ); // Select the WS request again. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); is( shallowEqual(store.getState().messages.columns, { data: true, @@ -201,7 +201,7 @@ add_task(async function() { ); // Select the SSE request again. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); is( shallowEqual(store.getState().messages.columns, { data: true, @@ -219,7 +219,7 @@ add_task(async function() { store.dispatch(Actions.resetMessageColumns()); // Switch to WS request again. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); is( shallowEqual(store.getState().messages.columns, { data: true, @@ -237,7 +237,7 @@ add_task(async function() { store.dispatch(Actions.resetMessageColumns()); // Switch to SSE request again. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[1]); is( shallowEqual(store.getState().messages.columns, { data: true, @@ -252,7 +252,7 @@ add_task(async function() { ); // Switch to WS request again. - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); is( shallowEqual(store.getState().messages.columns, { data: true, diff --git a/devtools/client/netmonitor/test/browser_net_ws-stomp-payload.js b/devtools/client/netmonitor/test/browser_net_ws-stomp-payload.js index 7e01bf7b3e9e..7b396c9eac6f 100644 --- a/devtools/client/netmonitor/test/browser_net_ws-stomp-payload.js +++ b/devtools/client/netmonitor/test/browser_net_ws-stomp-payload.js @@ -42,10 +42,10 @@ add_task(async function() { ); // Select the first request - EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requests[0]); // Click on the "Response" panel - clickOnSidebarTab(document, "response"); + await clickOnSidebarTab(document, "response"); await wait; // Get all messages present in the "Response" panel @@ -60,7 +60,7 @@ add_task(async function() { await waitForTick(); const waitForData = waitForDOM(document, "#message-formattedData"); const [requestFrame] = frames; - EventUtils.sendMouseEvent({ type: "mousedown" }, requestFrame); + await EventUtils.sendMouseEvent({ type: "mousedown" }, requestFrame); await waitForData; diff --git a/devtools/client/netmonitor/test/head.js b/devtools/client/netmonitor/test/head.js index 64dda700994b..e089391b4023 100644 --- a/devtools/client/netmonitor/test/head.js +++ b/devtools/client/netmonitor/test/head.js @@ -977,7 +977,7 @@ async function hideColumn(monitor, column) { const { document } = monitor.panelWin; info(`Clicking context-menu item for ${column}`); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector(".requests-list-headers") ); @@ -1000,7 +1000,7 @@ async function showColumn(monitor, column) { const { document } = monitor.panelWin; info(`Clicking context-menu item for ${column}`); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "contextmenu" }, document.querySelector(".requests-list-headers") ); @@ -1031,7 +1031,7 @@ async function selectIndexAndWaitForSourceEditor(monitor, index) { ); // Select the request first, as it may try to fetch whatever is the current request's // responseContent if we select the ResponseTab first. - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, document.querySelectorAll(".request-list-item")[index] ); @@ -1273,7 +1273,7 @@ async function waitForDOMIfNeeded(target, selector, expectedLength = 1) { * The action, block or unblock, to construct a corresponding context menu id. */ async function toggleBlockedUrl(element, monitor, store, action = "block") { - EventUtils.sendMouseEvent({ type: "contextmenu" }, element); + await EventUtils.sendMouseEvent({ type: "contextmenu" }, element); const contextMenuId = `request-list-context-${action}-url`; const contextBlockToggle = getContextMenuItem(monitor, contextMenuId); const onRequestComplete = waitForDispatch( @@ -1348,13 +1348,13 @@ function compareValues(first, second) { * @param {String} name * Network panel sidebar tab name. */ -const clickOnSidebarTab = (doc, name) => { +const clickOnSidebarTab = async (doc, name) => { AccessibilityUtils.setEnv({ // Keyboard accessibility is handled on the sidebar tabs container level // (nav). Users can use arrow keys to navigate between and select tabs. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, doc.querySelector(`#${name}-tab`) ); diff --git a/devtools/client/performance/test/browser_perf-button-states.js b/devtools/client/performance/test/browser_perf-button-states.js index d294617f3f58..aeb74b3915c6 100644 --- a/devtools/client/performance/test/browser_perf-button-states.js +++ b/devtools/client/performance/test/browser_perf-button-states.js @@ -49,7 +49,7 @@ add_task(async function() { expectedArgs: ["recording"], }); - click(recordButton); + await click(recordButton); await uiStartClick; checkRecordButtonsStates(true, true); @@ -77,7 +77,7 @@ add_task(async function() { expectedArgs: ["recorded"], }); - click(recordButton); + await click(recordButton); await uiStopClick; await recordingStopped; diff --git a/devtools/client/performance/test/browser_perf-calltree-js-events.js b/devtools/client/performance/test/browser_perf-calltree-js-events.js index c2d671b62922..b9651bba4900 100644 --- a/devtools/client/performance/test/browser_perf-calltree-js-events.js +++ b/devtools/client/performance/test/browser_perf-calltree-js-events.js @@ -65,7 +65,7 @@ add_task(async function() { const onFocus = () => count++; JsCallTreeView.on("focus", onFocus); - click(firstTreeItem); + await click(firstTreeItem); key("VK_DOWN"); key("VK_DOWN"); diff --git a/devtools/client/performance/test/browser_perf-gc-snap.js b/devtools/client/performance/test/browser_perf-gc-snap.js index 4d147e1195ca..9e42476b5957 100644 --- a/devtools/client/performance/test/browser_perf-gc-snap.js +++ b/devtools/client/performance/test/browser_perf-gc-snap.js @@ -36,14 +36,14 @@ async function spawnTest() { let targetMarker = gcMarkers[1]; let targetBar = bars[1]; info(`Clicking GC Marker of type ${targetMarker.causeName} ${targetMarker.start}:${targetMarker.end}`); - EventUtils.sendMouseEvent({ type: "mousedown" }, targetBar); + await EventUtils.sendMouseEvent({ type: "mousedown" }, targetBar); let showAllocsButton; // On slower machines this can not be found immediately? await waitUntil(() => showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']")); ok(showAllocsButton, "GC buttons when allocations are enabled"); rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); - EventUtils.sendMouseEvent({ type: "click" }, showAllocsButton); + await EventUtils.sendMouseEvent({ type: "click" }, showAllocsButton); await rendered; is(OverviewView.getTimeInterval().startTime, 0, "When clicking first GC, should use 0 as start time"); @@ -64,13 +64,13 @@ async function spawnTest() { targetBar = bars[4]; info(`Clicking GC Marker of type ${targetMarker.causeName} ${targetMarker.start}:${targetMarker.end}`); - EventUtils.sendMouseEvent({ type: "mousedown" }, targetBar); + await EventUtils.sendMouseEvent({ type: "mousedown" }, targetBar); // On slower machines this can not be found immediately? await waitUntil(() => showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']")); ok(showAllocsButton, "GC buttons when allocations are enabled"); rendered = once(MemoryCallTreeView, EVENTS.UI_MEMORY_CALL_TREE_RENDERED); - EventUtils.sendMouseEvent({ type: "click" }, showAllocsButton); + await EventUtils.sendMouseEvent({ type: "click" }, showAllocsButton); await rendered; within(OverviewView.getTimeInterval().startTime, gcMarkers[2].end, EPSILON, @@ -107,7 +107,7 @@ async function spawnTest() { bars = $$(".waterfall-marker-bar"); gcMarkers = PerformanceController.getCurrentRecording().getMarkers(); - EventUtils.sendMouseEvent({ type: "mousedown" }, bars[0]); + await EventUtils.sendMouseEvent({ type: "mousedown" }, bars[0]); showAllocsButton = $("#waterfall-details .custom-button[type='show-allocations']"); ok(!showAllocsButton, "No GC buttons when allocations are disabled"); diff --git a/devtools/client/performance/test/browser_perf-marker-details.js b/devtools/client/performance/test/browser_perf-marker-details.js index 8bf7c09b5cbf..9f55497a105c 100644 --- a/devtools/client/performance/test/browser_perf-marker-details.js +++ b/devtools/client/performance/test/browser_perf-marker-details.js @@ -109,7 +109,7 @@ async function spawnTest() { for (let i = 0; i < bars.length; i++) { let bar = bars[i]; let m = markers[i]; - EventUtils.sendMouseEvent({ type: "mousedown" }, bar); + await EventUtils.sendMouseEvent({ type: "mousedown" }, bar); if (tests[m.name]) { if (!testsDone.includes(m.name)) { diff --git a/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js b/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js index c74311564901..62cf4b15eb9b 100644 --- a/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js +++ b/devtools/client/performance/test/browser_perf-options-show-jit-optimizations.js @@ -69,7 +69,7 @@ async function spawnTest() { // Select the node with optimizations and change to a new recording // to ensure the opts view is cleared let rendered = once(JsCallTreeView, "focus"); - mousedown(window, $$(".call-tree-item")[2]); + await mousedown(window, $$(".call-tree-item")[2]); await rendered; let isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(!isHidden, "opts view should be visible when selecting a frame with opts"); @@ -87,7 +87,7 @@ async function spawnTest() { await rendered; rendered = once(JsCallTreeView, "focus"); - mousedown(window, $$(".call-tree-item")[2]); + await mousedown(window, $$(".call-tree-item")[2]); await rendered; isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok(!isHidden, "opts view should be visible when selecting a frame with opts"); @@ -100,7 +100,7 @@ async function spawnTest() { ok(isHidden, "opts view hidden when toggling off jit pref"); rendered = once(JsCallTreeView, "focus"); - mousedown(window, $$(".call-tree-item")[2]); + await mousedown(window, $$(".call-tree-item")[2]); await rendered; isHidden = $("#jit-optimizations-view").classList.contains("hidden"); ok( @@ -127,7 +127,7 @@ async function spawnTest() { info(`Checking frame ${frameIndex}`); // Click the frame let rendered = once(JsCallTreeView, "focus"); - mousedown(window, $$(".call-tree-item")[frameIndex]); + await mousedown(window, $$(".call-tree-item")[frameIndex]); await rendered; let isHidden = $("#jit-optimizations-view").classList.contains("hidden"); diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-01.js b/devtools/client/performance/test/browser_perf-tree-abstract-01.js index 9ef432b22254..75c8c3803b5b 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-01.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-01.js @@ -61,7 +61,7 @@ add_task(async function() { let receivedExpandEvent = once(treeRoot, "expand", { spreadArgs: true }); let receivedFocusEvent = once(treeRoot, "focus"); - mousedown(treeRoot.target.querySelector(".arrow")); + await mousedown(treeRoot.target.querySelector(".arrow")); let [eventItem] = await receivedExpandEvent; is(eventItem, treeRoot, "The 'expand' event target is correct (1)."); @@ -130,7 +130,7 @@ add_task(async function() { // Test clicking on the `foo` node... receivedFocusEvent = once(treeRoot, "focus", { spreadArgs: true }); - mousedown(fooItem.target); + await mousedown(fooItem.target); [eventItem] = await receivedFocusEvent; is(eventItem, fooItem, "The 'focus' event target is correct (2)."); @@ -144,7 +144,7 @@ add_task(async function() { receivedExpandEvent = once(treeRoot, "expand", { spreadArgs: true }); receivedFocusEvent = once(treeRoot, "focus"); - dblclick(barItem.target); + await dblclick(barItem.target); [eventItem] = await receivedExpandEvent; is(eventItem, barItem, "The 'expand' event target is correct (3)."); diff --git a/devtools/client/performance/test/browser_perf-tree-abstract-04.js b/devtools/client/performance/test/browser_perf-tree-abstract-04.js index ef86fd2157b0..fe5acb7be8fc 100644 --- a/devtools/client/performance/test/browser_perf-tree-abstract-04.js +++ b/devtools/client/performance/test/browser_perf-tree-abstract-04.js @@ -31,7 +31,7 @@ add_task(async function() { info("Double clicking on the root item arrow and waiting for focus event."); const receivedFocusEvent = once(treeRoot, "focus"); - dblclick(treeRoot.target.querySelector(".arrow")); + await dblclick(treeRoot.target.querySelector(".arrow")); await receivedFocusEvent; is( diff --git a/devtools/client/performance/test/browser_perf-tree-view-06.js b/devtools/client/performance/test/browser_perf-tree-view-06.js index 859fbb676519..1a51be9ea1ee 100644 --- a/devtools/client/performance/test/browser_perf-tree-view-06.js +++ b/devtools/client/performance/test/browser_perf-tree-view-06.js @@ -45,14 +45,14 @@ add_task(async function() { treeRoot.on("link", handler); // Fire right click. - rightMousedown(A.target.querySelector(".call-tree-url")); + await rightMousedown(A.target.querySelector(".call-tree-url")); // Ensure link was not called for right click. await idleWait(100); ok(!linkEvent, "The `link` event not fired for right click."); // Fire left click. - mousedown(A.target.querySelector(".call-tree-url")); + await mousedown(A.target.querySelector(".call-tree-url")); // Ensure link was called for left click. await waitUntil(() => linkEvent); diff --git a/devtools/client/performance/test/browser_timeline-waterfall-rerender.js b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js index de83f2b56a81..bab37542cffc 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-rerender.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-rerender.js @@ -57,7 +57,7 @@ async function spawnTest() { // Simulate a resize on the marker details. rerendered = WaterfallView.once(EVENTS.UI_WATERFALL_RENDERED); - EventUtils.sendMouseEvent({ type: "mouseup" }, WaterfallView.detailsSplitter); + await EventUtils.sendMouseEvent({ type: "mouseup" }, WaterfallView.detailsSplitter); await rerendered; let afterResizeBarsCount = $$(".waterfall-marker-bar").length; diff --git a/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js index 7bde96849be9..e82c463742ea 100644 --- a/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js +++ b/devtools/client/performance/test/browser_timeline-waterfall-sidebar.js @@ -51,7 +51,7 @@ async function spawnTest() { for (let i = 0; i < bars.length; i++) { let bar = bars[i]; let mkr = markers[i]; - EventUtils.sendMouseEvent({ type: "mousedown" }, bar); + await EventUtils.sendMouseEvent({ type: "mousedown" }, bar); let type = $(".marker-details-type").getAttribute("value"); let tooltip = $(".marker-details-duration").getAttribute("tooltiptext"); diff --git a/devtools/client/performance/test/head.js b/devtools/client/performance/test/head.js index 2f4500884a9e..f97eb393b939 100644 --- a/devtools/client/performance/test/head.js +++ b/devtools/client/performance/test/head.js @@ -46,23 +46,23 @@ const either = (value, a, b, message) => { }; // Shortcut for simulating a click on an element. -const click = (node, win = window) => { - EventUtils.sendMouseEvent({ type: "click" }, node, win); +const click = async (node, win = window) => { + await EventUtils.sendMouseEvent({ type: "click" }, node, win); }; // Shortcut for simulating a double click on an element. -const dblclick = (node, win = window) => { - EventUtils.sendMouseEvent({ type: "dblclick" }, node, win); +const dblclick = async (node, win = window) => { + await EventUtils.sendMouseEvent({ type: "dblclick" }, node, win); }; // Shortcut for simulating a mousedown on an element. -const mousedown = (node, win = window) => { - EventUtils.sendMouseEvent({ type: "mousedown" }, node, win); +const mousedown = async (node, win = window) => { + await EventUtils.sendMouseEvent({ type: "mousedown" }, node, win); }; // Shortcut for simulating a mousedown using the right mouse button on an element. -const rightMousedown = (node, win = window) => { - EventUtils.sendMouseEvent({ type: "mousedown", button: 2 }, node, win); +const rightMousedown = async (node, win = window) => { + await EventUtils.sendMouseEvent({ type: "mousedown", button: 2 }, node, win); }; // Shortcut for firing a key event, like "VK_UP", "VK_DOWN", etc. diff --git a/devtools/client/shared/sourceeditor/test/browser_editor_cursor.js b/devtools/client/shared/sourceeditor/test/browser_editor_cursor.js index c4e71424d577..2e0f72dc025f 100644 --- a/devtools/client/shared/sourceeditor/test/browser_editor_cursor.js +++ b/devtools/client/shared/sourceeditor/test/browser_editor_cursor.js @@ -41,7 +41,7 @@ async function test() { ".CodeMirror-gutters" ); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown", shiftKey: true }, gutter, iframe.contentWindow diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js b/devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js index 62b906782095..ccaede645d94 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_clickable_urls.js @@ -44,7 +44,7 @@ add_task(async function() { onTabLoaded = BrowserTestUtils.waitForNewTab(gBrowser, secondURL, true); const isMacOS = Services.appinfo.OS === "Darwin"; - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [isMacOS ? "metaKey" : "ctrlKey"]: true, @@ -80,7 +80,7 @@ add_task(async function() { // focused/active state. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [isMacOS ? "metaKey" : "ctrlKey"]: true, diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_eval_sources.js b/devtools/client/webconsole/test/browser/browser_webconsole_eval_sources.js index 95baf1cac7bf..267192de256e 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_eval_sources.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_eval_sources.js @@ -58,6 +58,6 @@ async function clickFirstStackElement(hud, message, needsExpansion) { }); const onSourceOpenedInDebugger = once(hud, "source-in-debugger-opened"); - EventUtils.sendMouseEvent({ type: "mousedown" }, frame); + await EventUtils.sendMouseEvent({ type: "mousedown" }, frame); await onSourceOpenedInDebugger; } diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_filter_buttons_overflow.js b/devtools/client/webconsole/test/browser/browser_webconsole_filter_buttons_overflow.js index 3ecf3f6ea9be..325ee06ffa4e 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_filter_buttons_overflow.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_filter_buttons_overflow.js @@ -43,7 +43,7 @@ add_task(async function() { // container level. mustHaveAccessibleRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [Services.appinfo.OS === "Darwin" ? "metaKey" : "ctrlKey"]: true, diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js b/devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js index 6192cb5c7570..0d56856b8f94 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_input_focus.js @@ -50,7 +50,7 @@ add_task(async function() { interactiveRule: false, labelRule: false, }); - EventUtils.sendMouseEvent({ type: "click" }, msg); + await EventUtils.sendMouseEvent({ type: "click" }, msg); AccessibilityUtils.resetEnv(); ok(isInputFocused(hud), "input node is focused, second time"); @@ -70,7 +70,7 @@ add_task(async function() { interactiveRule: false, labelRule: false, }); - EventUtils.sendMouseEvent({ type: "click" }, msg); + await EventUtils.sendMouseEvent({ type: "click" }, msg); AccessibilityUtils.resetEnv(); ok(!isInputFocused(hud), "input node not focused after text is selected"); }); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_location_styleeditor_link.js b/devtools/client/webconsole/test/browser/browser_webconsole_location_styleeditor_link.js index 3a6634367f92..4d1c5699cdd3 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_location_styleeditor_link.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_location_styleeditor_link.js @@ -38,7 +38,7 @@ async function testViewSource(hud, toolbox, text) { const onStyleEditorSelected = toolbox.once("styleeditor-selected"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, messageNode.querySelector(".frame-link-filename") ); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_network_message_ctrl_click.js b/devtools/client/webconsole/test/browser/browser_webconsole_network_message_ctrl_click.js index 8de75165aa38..c26963000203 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_network_message_ctrl_click.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_network_message_ctrl_click.js @@ -28,7 +28,7 @@ add_task(async function() { info("Cmd/Ctrl click on the message"); const urlObject = message.querySelector(".url"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [isMacOS ? "metaKey" : "ctrlKey"]: true, diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js b/devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js index 7b1c0504ee2f..0b5728eeeecd 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_object_ctrl_click.js @@ -32,7 +32,7 @@ add_task(async function() { // container level. mustHaveAccessibleRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [isMacOS ? "metaKey" : "ctrlKey"]: true, @@ -89,7 +89,7 @@ add_task(async function() { interactiveRule: false, labelRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [isMacOS ? "metaKey" : "ctrlKey"]: true, diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js b/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js index 6152f3124b04..72faace0f592 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_sidebar_scroll.js @@ -33,7 +33,7 @@ add_task(async function() { interactiveRule: false, labelRule: false, }); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click", [isMacOS ? "metaKey" : "ctrlKey"]: true, diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_split.js b/devtools/client/webconsole/test/browser/browser_webconsole_split.js index 5c96f9effabf..9a92befcff74 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_split.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_split.js @@ -109,7 +109,7 @@ add_task(async function() { // Toobox toolbar buttons are handled with arrow keys. nonNegativeTabIndexRule: false, }); - EventUtils.sendMouseEvent({ type: "click" }, button); + await EventUtils.sendMouseEvent({ type: "click" }, button); AccessibilityUtils.resetEnv(); await onPopupShown; diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_location_debugger_link.js b/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_location_debugger_link.js index 544000d83c7d..cb937049d816 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_location_debugger_link.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_location_debugger_link.js @@ -48,7 +48,7 @@ async function testOpenInDebugger(hud, toolbox, text) { async function checkClickOnNode(hud, toolbox, frameNode) { info("checking click on node location"); const onSourceInDebuggerOpened = once(hud, "source-in-debugger-opened"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, frameNode.querySelector(".location") ); diff --git a/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_mapped_location_debugger_link.js b/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_mapped_location_debugger_link.js index 4dc701e604f7..9d624bcecb7b 100644 --- a/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_mapped_location_debugger_link.js +++ b/devtools/client/webconsole/test/browser/browser_webconsole_stacktrace_mapped_location_debugger_link.js @@ -38,7 +38,7 @@ add_task(async function() { ); info("Click on the frame."); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "mousedown" }, node.querySelector(".stacktrace .location") ); diff --git a/devtools/client/webconsole/test/browser/head.js b/devtools/client/webconsole/test/browser/head.js index f4c69c1b6ae5..478635ab2dd8 100644 --- a/devtools/client/webconsole/test/browser/head.js +++ b/devtools/client/webconsole/test/browser/head.js @@ -506,7 +506,7 @@ async function checkClickOnNode( const onSourceInDebuggerOpened = once(hud, "source-in-debugger-opened"); - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "click" }, frameLinkNode.querySelector(".frame-link-filename") ); diff --git a/docshell/test/navigation/NavigationUtils.js b/docshell/test/navigation/NavigationUtils.js index c4b52dc62f66..4d9d40a3c604 100644 --- a/docshell/test/navigation/NavigationUtils.js +++ b/docshell/test/navigation/NavigationUtils.js @@ -43,13 +43,13 @@ function navigateByForm(name) { var hyperlink_count = 0; -function navigateByHyperlink(name) { +async function navigateByHyperlink(name) { var link = document.createElement("a"); link.href = target_url; link.target = name; link.id = "navigation_hyperlink_" + hyperlink_count++; document.body.appendChild(link); - sendMouseEvent({ type: "click" }, link.id); + await sendMouseEvent({ type: "click" }, link.id); } // ///////////////////////////////////////////////////////////////////////// diff --git a/docshell/test/navigation/navigate.html b/docshell/test/navigation/navigate.html index eed1eb1c18f3..fe191f1d93c7 100644 --- a/docshell/test/navigation/navigate.html +++ b/docshell/test/navigation/navigate.html @@ -3,7 +3,7 @@ diff --git a/dom/tests/mochitest/bugs/test_bug260264.html b/dom/tests/mochitest/bugs/test_bug260264.html index 9259320b4bb9..745b4eb16abd 100644 --- a/dom/tests/mochitest/bugs/test_bug260264.html +++ b/dom/tests/mochitest/bugs/test_bug260264.html @@ -47,10 +47,10 @@ add_task(async function check_sanity() { }); add_task(async function run_tests() { - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); await window.open.close(); await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 3]]}); @@ -58,28 +58,28 @@ add_task(async function run_tests() { add_task(async function run_tests2() { for (var count = 0, n = 0; n < 3; n++) { - send(a, "mouseup", function() { if (window.open("http://example.com")) count++ }); + await send(a, "mouseup", function() { if (window.open("http://example.com")) count++ }); } - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(1); - send(a, "mouseup", checkOpened); - send(a, "mouseup", checkBlocked); - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(); ok(count > 0, "Windows left open by previous tests?"); while (count --> 0) { - send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkOpened); } - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(); await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}); }); add_task(async function run_tests3() { - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(); await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}]); @@ -88,34 +88,34 @@ add_task(async function run_tests3() { add_task(async function run_tests4() { var count; - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); await window.open.close(); - send(a, "mouseup", checkOpened); - send(a, "mouseup", checkOpened); - send(a, "mouseup", checkOpened); - send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkOpened); await window.open.close(); for (count = 0, n = 0; n < 3; n++) { - send(a, "mouseover", function() { if (window.open("http://example.com")) count++ }); + await send(a, "mouseover", function() { if (window.open("http://example.com")) count++ }); } - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(1); - send(a, "mouseover", checkOpened); - send(a, "mouseover", checkBlocked); - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkOpened); + await send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(); ok(count > 0, "Windows left open by previous tests?"); while (count --> 0) { - send(a, "mouseover", checkOpened); + await send(a, "mouseover", checkOpened); } - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(); await SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events", "click"]]}); @@ -126,20 +126,20 @@ add_task(async function run_tests5() { }); add_task(async function run_tests6() { - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); await window.open.close(); await SpecialPowers.pushPrefEnv({"set": [["dom.popup_maximum", 2]]}); }); add_task(async function run_tests7() { - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(); - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(); await SpecialPowers.pushPermissions([{'type': 'popup', 'allow': ALLOW_ACTION, 'context': document}]); @@ -148,46 +148,46 @@ add_task(async function run_tests7() { add_task(async function run_tests8() { var count; - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); - send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); + await send(a, "click", checkOpened); await window.open.close(); for (count = 0, n = 0; n < 3; n++) { - send(a, "mouseup", function() { if (window.open("http://example.com")) count++ }); + await send(a, "mouseup", function() { if (window.open("http://example.com")) count++ }); } - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(1); - send(a, "mouseup", checkOpened); - send(a, "mouseup", checkBlocked); - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(); ok(count > 0, "Windows left open by previous tests?"); while (count --> 0) { - send(a, "mouseup", checkOpened); + await send(a, "mouseup", checkOpened); } - send(a, "mouseup", checkBlocked); + await send(a, "mouseup", checkBlocked); await window.open.close(); for (count = 0, n = 0; n < 3; n++) { - send(a, "mouseover", function() { if (window.open("http://example.com")) count++ }); + await send(a, "mouseover", function() { if (window.open("http://example.com")) count++ }); } - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(1); - send(a, "mouseover", checkOpened); - send(a, "mouseover", checkBlocked); - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkOpened); + await send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(); ok(count > 0, "Windows left open by previous tests?"); while (count --> 0) { - send(a, "mouseover", checkOpened); + await send(a, "mouseover", checkOpened); } - send(a, "mouseover", checkBlocked); + await send(a, "mouseover", checkBlocked); await window.open.close(); }); diff --git a/dom/tests/mochitest/bugs/utils_bug260264.js b/dom/tests/mochitest/bugs/utils_bug260264.js index 41a33e093fae..ee9ee896df77 100644 --- a/dom/tests/mochitest/bugs/utils_bug260264.js +++ b/dom/tests/mochitest/bugs/utils_bug260264.js @@ -6,13 +6,13 @@ const PROMPT_ACTION = SpecialPowers.Ci.nsIPermissionManager.PROMPT_ACTION; /** * Dispatches |handler| to |element|, as if fired in response to |event|. */ -function send(element, event, handler) { +async function send(element, event, handler) { function unique_handler() { return handler.apply(this, arguments); } element.addEventListener(event, unique_handler); try { - sendMouseEvent({ type: event }, element.id); + await sendMouseEvent({ type: event }, element.id); } finally { element.removeEventListener(event, unique_handler); } diff --git a/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js b/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js index ed38198efb4d..b8b722734086 100644 --- a/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js +++ b/testing/mochitest/tests/SimpleTest/AccessibilityUtils.js @@ -14,6 +14,9 @@ */ this.AccessibilityUtils = (function() { + // Duration until the accessible lookup times out. + const GET_ACCESSIBLE_TIMEOUT = 1000; + const FORCE_DISABLE_ACCESSIBILITY_PREF = "accessibility.force_disabled"; // Accessible states. @@ -432,32 +435,6 @@ this.AccessibilityUtils = (function() { } } - /** - * Walk node ancestry and force refresh driver tick in every document. - * @param {DOMNode} node - * Node for traversing the ancestry. - */ - function forceRefreshDriverTick(node) { - const wins = []; - let bc = BrowsingContext.getFromWindow(node.ownerDocument.defaultView); // eslint-disable-line - while (bc) { - wins.push(bc.associatedWindow); - bc = bc.embedderWindowGlobal?.browsingContext; - } - - let win = wins.pop(); - while (win) { - // Stop the refresh driver from doing its regular ticks and force two - // refresh driver ticks: first to let layout update and notify a11y, and - // the second to let a11y process updates. - win.windowUtils.advanceTimeAndRefresh(100); - win.windowUtils.advanceTimeAndRefresh(100); - // Go back to normal refresh driver ticks. - win.windowUtils.restoreNormalRefresh(); - win = wins.pop(); - } - } - /** * Get an accessible object for a node. * Note: this method will not resolve if accessible object does not become @@ -466,10 +443,10 @@ this.AccessibilityUtils = (function() { * @param {DOMNode} node * Node to get the accessible object for. * - * @return {nsIAccessible} - * Accessibility object for a given node. + * @return {Promise.} + * Promise with an accessibility object for a given node. */ - function getAccessible(node) { + async function getAccessible(node) { const accessibilityService = Cc[ "@mozilla.org/accessibilityService;1" ].getService(Ci.nsIAccessibilityService); @@ -483,9 +460,28 @@ this.AccessibilityUtils = (function() { return acc; } - // Force refresh tick throughout document hierarchy - forceRefreshDriverTick(node); - return accessibilityService.getAccessibleFor(node); + let resolver, timeoutID; + const accPromise = new Promise(resolve => { + resolver = resolve; + }); + + const observe = subject => { + acc = accessibilityService.getAccessibleFor(node); + if (acc) { + clearTimeout(timeoutID); + SpecialPowers.Services.obs.removeObserver(observe, "accessible-event"); + resolver(acc); + } + }; + SpecialPowers.Services.obs.addObserver(observe, "accessible-event"); + + timeoutID = setTimeout(() => { + // Final attempt in case the show event never fired. + SpecialPowers.Services.obs.removeObserver(observe, "accessible-event"); + resolver(accessibilityService.getAccessibleFor(node)); + }, GET_ACCESSIBLE_TIMEOUT); + + return accPromise; } function runIfA11YChecks(task) { @@ -502,8 +498,8 @@ this.AccessibilityUtils = (function() { * */ const AccessibilityUtils = { - assertCanBeClicked(node) { - const acc = getAccessible(node); + async assertCanBeClicked(node) { + const acc = await getAccessible(node); if (!acc) { if (gEnv.mustHaveAccessibleRule) { a11yFail("Node is not accessible via accessibility API", { diff --git a/testing/mochitest/tests/SimpleTest/EventUtils.js b/testing/mochitest/tests/SimpleTest/EventUtils.js index 387644830f7b..9a881accd870 100644 --- a/testing/mochitest/tests/SimpleTest/EventUtils.js +++ b/testing/mochitest/tests/SimpleTest/EventUtils.js @@ -227,7 +227,7 @@ function computeButtons(aEvent, utils) { return utils.MOUSE_BUTTONS_NOT_SPECIFIED; } -function sendMouseEvent(aEvent, aTarget, aWindow) { +async function sendMouseEvent(aEvent, aTarget, aWindow) { if ( ![ "click", @@ -253,7 +253,7 @@ function sendMouseEvent(aEvent, aTarget, aWindow) { } if (aEvent.type === "click" && this.AccessibilityUtils) { - this.AccessibilityUtils.assertCanBeClicked(aTarget); + await this.AccessibilityUtils.assertCanBeClicked(aTarget); } var event = aWindow.document.createEvent("MouseEvent"); diff --git a/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js b/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js index d34c26530733..c915a6f0e7f6 100644 --- a/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js +++ b/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js @@ -19,7 +19,7 @@ add_task(async () => { let controls = pipWin.document.getElementById("controls"); await promiseFullscreenEntered(pipWin, async () => { - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "dblclick", }, @@ -38,7 +38,7 @@ add_task(async () => { // on the document body. await promiseFullscreenExited(pipWin, async () => { - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "dblclick", }, @@ -55,7 +55,7 @@ add_task(async () => { // Now we double-click to re-enter fullscreen. await promiseFullscreenEntered(pipWin, async () => { - EventUtils.sendMouseEvent( + await EventUtils.sendMouseEvent( { type: "dblclick", },