Commit 95a481ed authored by Andreea Pavel's avatar Andreea Pavel
Browse files

Backed out 5 changesets (bug 1543940) for failing browser_menu_api.js on a CLOSED TREE

Backed out changeset aaa0f827616a (bug 1543940)
Backed out changeset 590b72185b69 (bug 1543940)
Backed out changeset 42e2136f684f (bug 1543940)
Backed out changeset a66967f17042 (bug 1543940)
Backed out changeset b1e6e932873c (bug 1543940)
parent 349aacd4
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@ add_task(async function() {


  const { document, tab, window } = await openAboutDebugging();
  const { document, tab, window } = await openAboutDebugging();
  await selectThisFirefoxPage(document, window.AboutDebugging.store);
  await selectThisFirefoxPage(document, window.AboutDebugging.store);
  const { devtoolsTab, devtoolsWindow } =
  const { devtoolsDocument, devtoolsTab, devtoolsWindow } =
    await openAboutDevtoolsToolbox(document, tab, window);
    await openAboutDevtoolsToolbox(document, tab, window);


  info("Select inspector tool");
  info("Select inspector tool");
@@ -29,7 +29,7 @@ add_task(async function() {
                                     markupDocument.ownerGlobal);
                                     markupDocument.ownerGlobal);


  info("Check whether proper context menu of markup view will be shown");
  info("Check whether proper context menu of markup view will be shown");
  await waitUntil(() => toolbox.topDoc.querySelector("#node-menu-edithtml"));
  await waitUntil(() => devtoolsDocument.querySelector("#node-menu-edithtml"));
  ok(true, "Context menu of markup view should be shown");
  ok(true, "Context menu of markup view should be shown");


  await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
  await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
+1 −1
Original line number Original line Diff line number Diff line
@@ -203,7 +203,7 @@ class AccessibilityRow extends Component {
      }));
      }));
    }
    }


    menu.popup(e.screenX, e.screenY, gToolbox.doc);
    menu.popup(e.screenX, e.screenY, gToolbox);


    if (gTelemetry) {
    if (gTelemetry) {
      gTelemetry.scalarAdd(TELEMETRY_ACCESSIBLE_CONTEXT_MENU_OPENED, 1);
      gTelemetry.scalarAdd(TELEMETRY_ACCESSIBLE_CONTEXT_MENU_OPENED, 1);
+7 −7
Original line number Original line Diff line number Diff line
@@ -15,7 +15,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
@@ -36,7 +36,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
@@ -57,7 +57,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
@@ -78,7 +78,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
@@ -99,7 +99,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
@@ -120,7 +120,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
@@ -141,7 +141,7 @@
        "byName": {},
        "byName": {},
        "byBlocks": {},
        "byBlocks": {},
        "usedIds": {
        "usedIds": {
          "1": 1
          "0": 0
        }
        }
      }
      }
    }
    }
+6 −22
Original line number Original line Diff line number Diff line
@@ -2610,12 +2610,12 @@ function showMenu(evt, items) {
  });
  });


  if (inToolbox()) {
  if (inToolbox()) {
    menu.popup(evt.screenX, evt.screenY, window.parent.document);
    menu.popup(evt.screenX, evt.screenY, { doc: window.parent.document });
    return;
    return;
  }
  }


  menu.on("open", (_, popup) => onShown(menu, popup));
  menu.on("open", (_, popup) => onShown(menu, popup));
  menu.popup(evt.clientX, evt.clientY, document);
  menu.popup(evt.clientX, evt.clientY, { doc: document });
}
}


function createSubMenu(subItems) {
function createSubMenu(subItems) {
@@ -2712,11 +2712,6 @@ function inToolbox() {
  }
  }
}
}


// Copied from m-c DevToolsUtils.
function getTopWindow(win) {
  return win.windowRoot ? win.windowRoot.ownerGlobal : win.top;
}

/**
/**
 * A partial implementation of the Menu API provided by electron:
 * A partial implementation of the Menu API provided by electron:
 * https://github.com/electron/electron/blob/master/docs/api/menu.md.
 * https://github.com/electron/electron/blob/master/docs/api/menu.md.
@@ -2768,16 +2763,11 @@ Menu.prototype.insert = function (pos, menuItem) {
 *
 *
 * @param {int} screenX
 * @param {int} screenX
 * @param {int} screenY
 * @param {int} screenY
 * @param {Document} doc
 * @param Toolbox toolbox (non standard)
 *        The document that should own the context menu.
 *        Needed so we in which window to inject XUL
 */
 */
Menu.prototype.popup = function (screenX, screenY, doc) {
Menu.prototype.popup = function (screenX, screenY, toolbox) {
  // The context-menu will be created in the topmost window to preserve keyboard
  let doc = toolbox.doc;
  // navigation. See Bug 1543940. Keep a reference on the window owning the menu to hide
  // the popup on unload.
  const win = doc.defaultView;
  doc = getTopWindow(doc.defaultView).document;

  let popupset = doc.querySelector("popupset");
  let popupset = doc.querySelector("popupset");
  if (!popupset) {
  if (!popupset) {
    popupset = doc.createXULElement("popupset");
    popupset = doc.createXULElement("popupset");
@@ -2800,15 +2790,9 @@ Menu.prototype.popup = function (screenX, screenY, doc) {
  }
  }
  this._createMenuItems(popup);
  this._createMenuItems(popup);


  // The context menu will be created in the topmost chrome window. Hide it manually when
  // the owner document is unloaded.
  const onWindowUnload = () => popup.hidePopup();
  win.addEventListener("unload", onWindowUnload);

  // Remove the menu from the DOM once it's hidden.
  // Remove the menu from the DOM once it's hidden.
  popup.addEventListener("popuphidden", e => {
  popup.addEventListener("popuphidden", e => {
    if (e.target === popup) {
    if (e.target === popup) {
      win.removeEventListener("unload", onWindowUnload);
      popup.remove();
      popup.remove();
      this.emit("close", popup);
      this.emit("close", popup);
    }
    }
+1 −1
Original line number Original line Diff line number Diff line
@@ -53,7 +53,7 @@
    "babel-plugin-transform-imports": "^1.5.0",
    "babel-plugin-transform-imports": "^1.5.0",
    "codemirror": "^5.28.0",
    "codemirror": "^5.28.0",
    "devtools-environment": "^0.0.6",
    "devtools-environment": "^0.0.6",
    "devtools-launchpad": "^0.0.152",
    "devtools-launchpad": "^0.0.151",
    "devtools-linters": "^0.0.4",
    "devtools-linters": "^0.0.4",
    "devtools-reps": "0.23.0",
    "devtools-reps": "0.23.0",
    "devtools-source-map": "0.16.0",
    "devtools-source-map": "0.16.0",
Loading