Bug: C-C TB, many warnings NS_ENSURE_SUCCESS(mStatus, mStatus) failed with result 0x804B000A (NS_ERROR_MALFORMED_URI): file .../dist/include/nsIURIMutator.h:610 during local mochitest with FULL DEBUG version of C-C TB
Status: NEW
Priority: --
Created: 2024-05-30 14:50:06+00:00
Resolved: 2024-07-15 12:30:06+00:00

During my local run of xpcshell test with FULLDEBUG  version of C-C TB,  I noticed that the following warning
is recroded more than 3K times. That is a bit excessive. This is in the top 5 of warnings list.
This warning is a new comer. It did not show up in the log about 18 days ago.

```
3900: Main Thread] WARNING: NS_ENSURE_SUCCESS(mStatus, mStatus) failed with result 0x804B000A (NS_ERROR_MALFORMED_URI): file /NEW-SSD/moz-obj-dir/objdir-tb3/dist/include/nsIURIMutator.h:610
```

3900 is the number of times it occurred.

The code comes from GENERATED nsIURIMutaror.h:

```
  template <class C>
  [[nodiscard]] nsresult Finalize(nsCOMPtr<C>& aURI)
  {
    NS_ENSURE_SUCCESS(mStatus, mStatus);  <==== HERE
    nsCOMPtr<nsIURI> uri;
    mStatus = mMutator->Finalize(getter_AddRefs(uri));
    NS_ENSURE_SUCCESS(mStatus, mStatus);
    aURI = do_QueryInterface(uri, &mStatus);
    NS_ENSURE_SUCCESS(mStatus, mStatus);
    mStatus = NS_ERROR_NOT_AVAILABLE; // Second call to Finalize should fail.
    return NS_OK;
  }

```

I also noticed that in my local log, the warning is always preceded by a failure message that is inserted by me.
That comes from SetSpec failure.
I counted the SetSepc failure:
```
    594 {debug} SetSpec failed. : aSpec=imap://Local Folder
   3095 {debug} SetSpec failed. : aSpec=imap://Local Folders
      1 {debug} SetSpec failed. : aSpec=imap://Local Folders-1
    201 {debug} SetSpec failed. : aSpec=imap://smart mailboxes
      5 {debug} SetSpec failed. : aSpec=imap://Smart Mailboxes
      4 Entering nsPop3Sink::EndMailDelivery(){debug} SetSpec failed. : aSpec=imap://Local Folders
```
The last line is due to a missing new line in one of the debug dump statement, I think.
The number adds up to 3900. So every warning is preceded by SetSpec failure message.
This may give a hint to whoever can debug this issue.

I added SetSpec failure dump many years ago. It seems that C-C TB used somewhat strange idea of URI, some of which are not recognized as valid by the rest of mozilla code.

The following is a list of SetSpec failure debug messages in my latest xpcshell test log.
```
      3 {debug} SetSpec failed. : aSpec=document.getElementById(
    594 {debug} SetSpec failed. : aSpec=imap://Local Folder
   3095 {debug} SetSpec failed. : aSpec=imap://Local Folders
      1 {debug} SetSpec failed. : aSpec=imap://Local Folders-1
    201 {debug} SetSpec failed. : aSpec=imap://smart mailboxes
      5 {debug} SetSpec failed. : aSpec=imap://Smart Mailboxes
      4 Entering nsPop3Sink::EndMailDelivery(){debug} SetSpec failed. : aSpec=imap://Local Folders

```
And this is the list from the latest local mochitest log. C-C TB is wasting many CPU cycles trying to use an invalid  URIs, I think

```
    540 {debug} SetSpec failed. : aSpec=branding/brand.ftl
    976 {debug} SetSpec failed. : aSpec=calendar/calendar-invitation-panel.ftl
      8 {debug} SetSpec failed. : aSpec=calendar/calendar-widgets.ftl
    326 {debug} SetSpec failed. : aSpec=calendar/category-dialog.ftl
    326 {debug} SetSpec failed. : aSpec=calendar/preferences.ftl
     11 {debug} SetSpec failed. : aSpec=DTD/xhtml1-strict.dtd
    180 {debug} SetSpec failed. : aSpec=messenger/about3Pane.ftl
     76 {debug} SetSpec failed. : aSpec=messenger/aboutAddonsExtra.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/aboutDialog.ftl
      9 {debug} SetSpec failed. : aSpec=messenger/aboutImport.ftl
     33 {debug} SetSpec failed. : aSpec=messenger/aboutSupportCalendar.ftl
     33 {debug} SetSpec failed. : aSpec=messenger/aboutSupportChat.ftl
     33 {debug} SetSpec failed. : aSpec=messenger/aboutSupportMail.ftl
     11 {debug} SetSpec failed. : aSpec=messenger/accountcreation/accountSetup.ftl
      6 {debug} SetSpec failed. : aSpec=messenger/accountManager.ftl
     23 {debug} SetSpec failed. : aSpec=messenger/accountProvisioner.ftl
    398 {debug} SetSpec failed. : aSpec=messenger/addressbook/aboutAddressBook.ftl
    398 {debug} SetSpec failed. : aSpec=messenger/addressbook/vcard.ftl
    392 {debug} SetSpec failed. : aSpec=messenger/appmenu.ftl
     76 {debug} SetSpec failed. : aSpec=messenger/extensionPermissions.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/messageheader/headerFields.ftl
   1156 {debug} SetSpec failed. : aSpec=messenger/messenger.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/openpgp/msgReadStatus.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/openpgp/openpgp-frontend.ftl
    976 {debug} SetSpec failed. : aSpec=messenger/openpgp/openpgp.ftl
     68 {debug} SetSpec failed. : aSpec=messenger/otr/chat.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/attachment-reminder.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/colors.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/connection.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/cookies.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/dock-options.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/fonts.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/languages.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/new-tag.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/notifications.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/offline.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/passwordManager.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/permissions.ftl
    718 {debug} SetSpec failed. : aSpec=messenger/preferences/preferences.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/receipts.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/sync-dialog.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/preferences/system-integration.ftl
    326 {debug} SetSpec failed. : aSpec=messenger/syncAccounts.ftl
    572 {debug} SetSpec failed. : aSpec=messenger/treeView.ftl
      2 {debug} SetSpec failed. : aSpec=moz-icon://
      2 {debug} SetSpec failed. : aSpec=moz-icon://chrome://calendar/content/sound.wav?size=16
     17 {debug} SetSpec failed. : aSpec=moz-icon://https://www.mozilla.org/?size=16&contentType=
      2 {debug} SetSpec failed. : aSpec=notarealaddress
      1 {debug} SetSpec failed. : aSpec=null
    326 {debug} SetSpec failed. : aSpec=security/certificates/certManager.ftl
    326 {debug} SetSpec failed. : aSpec=security/certificates/deviceManager.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/about/aboutAddons.ftl
     18 {debug} SetSpec failed. : aSpec=toolkit/about/aboutMozilla.ftl
      3 {debug} SetSpec failed. : aSpec=toolkit/about/aboutProfiles.ftl
     33 {debug} SetSpec failed. : aSpec=toolkit/about/aboutSupport.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/about/abuseReports.ftl
    329 {debug} SetSpec failed. : aSpec=toolkit/about/config.ftl
   1869 {debug} SetSpec failed. : aSpec=toolkit/global/arrowscrollbox.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/global/mozFiveStar.ftl
    120 {debug} SetSpec failed. : aSpec=toolkit/global/mozMessageBar.ftl
     78 {debug} SetSpec failed. : aSpec=toolkit/global/mozSupportLink.ftl
     51 {debug} SetSpec failed. : aSpec=toolkit/global/notification.ftl
     33 {debug} SetSpec failed. : aSpec=toolkit/global/processTypes.ftl
     33 {debug} SetSpec failed. : aSpec=toolkit/global/resetProfile.ftl
   1561 {debug} SetSpec failed. : aSpec=toolkit/global/textActions.ftl
   1156 {debug} SetSpec failed. : aSpec=toolkit/main-window/findbar.ftl
     48 {debug} SetSpec failed. : aSpec=toolkit/neterror/certError.ftl
     48 {debug} SetSpec failed. : aSpec=toolkit/neterror/netError.ftl
    326 {debug} SetSpec failed. : aSpec=toolkit/updates/history.ftl
     12 {debug} SetSpec failed. : aSpec=undefined

```