Closed Bug 1635422 Opened 4 years ago Closed 3 years ago

JavaScript error: resource://gre/actors/AutoCompleteChild.jsm, line 196: Error: Invalid autocomplete selectedIndex

Categories

(Thunderbird :: Mail Window Front End, defect)

defect

Tracking

(thunderbird_esr78 unaffected)

RESOLVED FIXED
91 Branch
Tracking Status
thunderbird_esr78 --- unaffected

People

(Reporter: ishikawa, Assigned: darktrojan)

Details

Attachments

(2 files)

During the local mochitest run with FULL DEBUG version of TB, I see
the following error.

30:55.73 GECKO(1431743) [1431743, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /NEW-SSD/NREF-COMM-CENTRAL/mozilla/dom/base/nsContentUtils.cpp, line 3770
30:55.99 GECKO(1431743) JavaScript error: resource://gre/actors/AutoCompleteChild.jsm, line 196: Error: Invalid autocomplete selectedIndex
30:55.99 GECKO(1431743) [1431743, Main Thread] WARNING: NS_ENSURE_TRUE(aIndex >= 0 && static_cast<uint32_t>(aIndex) < mMatchCount) failed: file /NEW-SSD/NREF-COMM-CENTRAL/mozilla/toolkit/components/autocomplete/nsAutoCompleteController.cpp, line 1698

The error in JavaScript is thrown from the code in AutoCompleteChild.jsm..:

  get selectedIndex() {
    // selectedIndex getter must be synchronous because we need the
    // correct value when the controller is in controller::HandleEnter.
    // We can't easily just let the parent inform us the new value every
    // time it changes because not every action that can change the
    // selectedIndex is trivial to catch (e.g. moving the mouse over the
    // list).
    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];
  }

The JavaScript errors are found in the following two tests.

30:55.33 TEST_START: comm/mail/base/test/browser/browser_menulist.js
30:55.34 INFO Entering test bound
30:55.99 GECKO(1431743) JavaScript error: resource://gre/actors/AutoCompleteChild.jsm, line 196: Error: Invalid autocomplete selectedIndex
30:56.00 GECKO(1431743) JavaScript error: resource://gre/actors/AutoCompleteChild.jsm, line 196: Error: Invalid autocomplete selectedIndex
30:56.08 INFO Console message: [JavaScript Error: "Error: Invalid autocomplete selectedIndex" {file: "resource://gre/actors/AutoCompleteChild.jsm" line: 196}]
30:56.08 INFO Console message: [JavaScript Error: "Error: Invalid autocomplete selectedIndex" {file: "resource://gre/actors/AutoCompleteChild.jsm" line: 196}]
30:56.45 INFO Leaving test bound
30:56.50 TEST_END: Test OK. Subtests passed 54/55. Unexpected 0


52:50.02 TEST_START: comm/mail/components/preferences/test/browser/browser_cloudfile.js
52:50.04 INFO Entering test bound
52:50.04 INFO Leaving test bound
52:50.04 INFO Entering test bound addRemoveAccounts
52:54.92 GECKO(1445883) JavaScript error: resource://gre/actors/AutoCompleteChild.jsm, line 196: Error: Invalid autocomplete selectedIndex
52:55.46 INFO Console message: [JavaScript Error: "Error: Invalid autocomplete selectedIndex" {file: "resource://gre/actors/AutoCompleteChild.jsm" line: 196}]
52:56.73 INFO Leaving test bound addRemoveAccounts
         ...
53:11.44 TEST_END: Test OK. Subtests passed 118/118. Unexpected 0

The error from the CPP part comes from NS_ENSURE_TRUE as follows.:

nsresult nsAutoCompleteController::GetResultValueLabelAt(int32_t aIndex,
                                                         bool aGetFinalValue,
                                                         bool aGetValue,
                                                         nsAString& _retval) {
  NS_ENSURE_TRUE(aIndex >= 0 && static_cast<uint32_t>(aIndex) < mMatchCount,
                 NS_ERROR_ILLEGAL_VALUE);

  int32_t matchIndex;
  nsIAutoCompleteResult* result;

I am attaching the relevant part of the local log. It is a bit verbose
with the locally added dumps.

I've figured out how to make this annoying error message go away.

Assignee: nobody → geoff
Status: NEW → ASSIGNED

This module needs to be loaded so it registers to receive FormAutoComplete:GetSelectedIndex messages and respond appropriately, otherwise we get error messages like the one reported in this bug.

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/d7145715a912
Load AutoCompleteParent.jsm at start-up to avoid annoying error messages. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
OS: Linux → Unspecified
Hardware: x86_64 → Unspecified
Target Milestone: --- → 91 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: