Commit 665bdb85 authored by Andrei Oprea's avatar Andrei Oprea
Browse files

Bug 1569696 - CFR: recommend send tab on popular recipe sites r=k88hudson

Differential Revision: https://phabricator.services.mozilla.com/D47777

--HG--
extra : moz-landing-system : lando
parent 73cb259c
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -1047,8 +1047,9 @@ var UITour = {
   * @param {ChromeWindow} aWindow the chrome window
   * @param {bool} aShouldOpen true means we should open the menu, otherwise false
   * @param {String} aMenuName "appMenu" or "pageActionPanel"
   * @param {Object} aOptions Extra config arguments, example `autohide: true`.
   */
  _setMenuStateForAnnotation(aWindow, aShouldOpen, aMenuName) {
  _setMenuStateForAnnotation(aWindow, aShouldOpen, aMenuName, aOptions = {}) {
    log.debug("_setMenuStateForAnnotation: Menu is ", aMenuName);
    log.debug(
      "_setMenuStateForAnnotation: Menu is expected to be:",
@@ -1071,7 +1072,7 @@ var UITour = {
    if (aShouldOpen) {
      log.debug("_setMenuStateForAnnotation: Opening the menu");
      promise = new Promise(resolve => {
        this.showMenu(aWindow, aMenuName, resolve);
        this.showMenu(aWindow, aMenuName, resolve, aOptions);
      });
    } else if (!this.noautohideMenus.has(aMenuName)) {
      // If the menu was opened explictly by api user through `Mozilla.UITour.showMenu`,
@@ -1091,8 +1092,9 @@ var UITour = {
   *
   * @param {ChromeWindow} aChromeWindow The chrome window
   * @param {Object} aTarget The target on which we show highlight or show info.
   * @param {Object} options Extra config arguments, example `autohide: true`.
   */
  async _ensureTarget(aChromeWindow, aTarget) {
  async _ensureTarget(aChromeWindow, aTarget, aOptions = {}) {
    let shouldOpenAppMenu = false;
    let shouldOpenPageActionPanel = false;
    if (this.targetIsInAppMenu(aTarget)) {
@@ -1144,7 +1146,8 @@ var UITour = {
      promise = this._setMenuStateForAnnotation(
        aChromeWindow,
        true,
        menuToOpen
        menuToOpen,
        aOptions
      );
    }
    return promise;
@@ -1182,9 +1185,10 @@ var UITour = {
   *                      window.
   * @param aTarget    The element to highlight.
   * @param aEffect    (optional) The effect to use from UITour.highlightEffects or "none".
   * @param aOptions   (optional) Extra config arguments, example `autohide: true`.
   * @see UITour.highlightEffects
   */
  async showHighlight(aChromeWindow, aTarget, aEffect = "none") {
  async showHighlight(aChromeWindow, aTarget, aEffect = "none", aOptions = {}) {
    let showHighlightElement = aAnchorEl => {
      let highlighter = aChromeWindow.document.getElementById(
        "UITourHighlight"
@@ -1266,7 +1270,7 @@ var UITour = {
    };

    try {
      await this._ensureTarget(aChromeWindow, aTarget);
      await this._ensureTarget(aChromeWindow, aTarget, aOptions);
      let anchorEl = await this._correctAnchor(aChromeWindow, aTarget);
      showHighlightElement(anchorEl);
    } catch (e) {
@@ -1452,7 +1456,7 @@ var UITour = {
    this._setMenuStateForAnnotation(aWindow, false, "pageActionPanel");
  },

  showMenu(aWindow, aMenuName, aOpenCallback = null) {
  showMenu(aWindow, aMenuName, aOpenCallback = null, aOptions = {}) {
    log.debug("showMenu:", aMenuName);
    function openMenuButton(aMenuBtn) {
      if (!aMenuBtn || !aMenuBtn.hasMenu() || aMenuBtn.open) {
@@ -1483,7 +1487,9 @@ var UITour = {
        menu.show = () => aWindow.BrowserPageActions.showPanel();
      }

      if (!aOptions.autohide) {
        menu.node.setAttribute("noautohide", "true");
      }
      // If the popup is already opened, don't recreate the widget as it may cause a flicker.
      if (menu.node.state != "open") {
        this.recreatePopup(menu.node);