firefox-scripts: Exception in BootstrapLoader.js with Nightly 142.0a1 from 2025-06-25

Starting with Firefox Nightly 142.0a1 from 2025-06-25 there is new error BootstrapLoader.js

 1751116296574	addons.xpi	WARN	Exception running bootstrap method startup on {dc572301-7619-498c-a57d-39143191b318}: TypeError: Components.manager.addBootstrappedManifestLocation is not a function(chrome://userchromejs/content/BootstrapLoader.js:389:30) JS Stack trace: startup@BootstrapLoader.js:389:30
callBootstrapMethod@XPIProvider.sys.mjs:2067:33
startup@XPIProvider.sys.mjs:2183:34
startup@XPIProvider.sys.mjs:2813:41
callProvider@AddonManager.sys.mjs:228:31
_startProvider@AddonManager.sys.mjs:537:17
startup@AddonManager.sys.mjs:750:14
startup@AddonManager.sys.mjs:3702:26
observe@amManager.sys.mjs:73:29

Components.manager.addBootstrappedManifestLocation is not a function Components.manager.removeBootstrappedManifestLocation is not a function

Bug 1953136 Get rid of nsIComponentManager.addBootstrappedManifestLocation

@117649 can you look for replacement?

About this issue

Most upvoted comments

This is updated version of utils for Firefox 142+

utils.zip

This version is compatible with all Firefox version.

All users must update replace the utils files with the new version before Firefox 142 release

Don’t dodeleteTemporaryFileOnExit(tempFile) for now?

let tempDir = Services.dirsvc.get("ProfD", Ci.nsIFile)
    tempDir.append("browser-extension-data");
    tempDir.append(addon.id);

    function createManifestTemporarily(manifestText) {
      let tempFile = tempDir.clone();
      tempFile.append("chrome.manifest");

      let foStream = Cc[
        "@mozilla.org/network/file-output-stream;1"
      ].createInstance(Ci.nsIFileOutputStream);
      foStream.init(tempFile, 0x02 | 0x08 | 0x20, 0o664, 0); // write, create, truncate
      foStream.write(manifestText, manifestText.length);
      foStream.close();

      Components.manager
        .QueryInterface(Ci.nsIComponentRegistrar)
        .autoRegister(tempFile);

      // Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
      //   .getService(Ci.nsPIExternalAppLauncher)
      //   .deleteTemporaryFileOnExit(tempFile);

      return function () {
        tempFile.fileSize = 0; // truncate the manifest
        Cc["@mozilla.org/chrome/chrome-registry;1"]
          .getService(Ci.nsIXULChromeRegistry)
          .checkForNewChrome();
      };
    }

If we are using “browser-extension-data” why bother to delete manifest every time.

@onemen Use this

BootstrapLoader.zip

Put into the utils and replace bootstraploader. Mind the file name. No change to the addons. You’ll need a path under utils called addonManifest to host the manifest files. Temporary files will be deleted on app exit.