Bug 677372 - Add onContextMenuShown option to test_contextmenu. r=markh
☠☠ backed out by 22010b91698c ☠ ☠
authorEdouard Oger <eoger@fastmail.com>
Mon, 27 Jun 2016 16:46:43 -0700
changeset 330027 a6b4d5fa8ef63f0f46240d4b4afdbd5927277105
parent 330026 7345b89fb14fb8a05513b4dced4b6c6796267dda
child 330028 46231d51ba66ebc18acb965e9106f58a228e3906
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs677372
milestone50.0a1
Bug 677372 - Add onContextMenuShown option to test_contextmenu. r=markh MozReview-Commit-ID: D7sdRrsWRCF
browser/base/content/test/general/contextmenu_common.js
--- a/browser/base/content/test/general/contextmenu_common.js
+++ b/browser/base/content/test/general/contextmenu_common.js
@@ -237,16 +237,17 @@ let lastElementSelector = null;
  *                 the element, optional
  *        offsetY: vertical mouse offset from the top-left corner of the
  *                 element, optional
  *        centered: if true, mouse position is centered in element, defaults
  *                  to true if offsetX and offsetY are not provided
  *        waitForSpellCheck: wait until spellcheck is initialized before
  *                           starting test
  *        preCheckContextMenuFn: callback to run before opening menu
+ *        onContextMenuShown: callback to run when the context menu is shown
  *        postCheckContextMenuFn: callback to run after opening menu
  * @return {Promise} resolved after the test finishes
  */
 function* test_contextmenu(selector, menuItems, options={}) {
   contextMenu = document.getElementById("contentAreaContextMenu");
   is(contextMenu.state, "closed", "checking if popup is closed");
 
   // Default to centered if no positioning is defined.
@@ -290,16 +291,21 @@ function* test_contextmenu(selector, men
       button: 2,
       shiftkey: options.shiftkey,
       centered: options.centered
     },
     gBrowser.selectedBrowser);
   yield awaitPopupShown;
   info("Popup Shown");
 
+  if (options.onContextMenuShown) {
+    yield options.onContextMenuShown();
+    info("Completed onContextMenuShown");
+  }
+
   if (menuItems) {
     if (Services.prefs.getBoolPref("devtools.inspector.enabled")) {
       let inspectItems = ["---", null,
                           "context-inspect", true];
       menuItems = menuItems.concat(inspectItems);
     }
 
     checkContextMenu(menuItems);