Commit bf4c789c authored by Neil Deakin's avatar Neil Deakin
Browse files

Bug 1595875, fix handling of return value of FormAutoComplete:GetSelectedIndex...

Bug 1595875, fix handling of return value of FormAutoComplete:GetSelectedIndex that was incorrectly removed by 1573836, r=MattN

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

--HG--
extra : moz-landing-system : lando
parent d620f10c
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -182,9 +182,20 @@ class AutoCompleteChild extends JSWindowActorChild {
    // time it changes because not every action that can change the
    // selectedIndex is trivial to catch (e.g. moving the mouse over the
    // list).
    return Services.cpmm.sendSyncMessage("FormAutoComplete:GetSelectedIndex", {
    let selectedIndexResult = Services.cpmm.sendSyncMessage(
      "FormAutoComplete:GetSelectedIndex",
      {
        browsingContext: this.browsingContext,
    });
      }
    );

    if (
      selectedIndexResult.length != 1 ||
      !Number.isInteger(selectedIndexResult[0])
    ) {
      throw new Error("Invalid autocomplete selectedIndex");
    }
    return selectedIndexResult[0];
  }

  get popupOpen() {