Error importing js-modules using Components.utils.import

57 views
Skip to first unread message

Michael Gasch

unread,
Jun 30, 2025, 5:58:21 AMJun 30
to enter...@mozilla.org

Hello,

 

I try to prepare Firefox 140esr with autoconfig.

 

This block:

 

try {

  var Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services;

  Components.utils.import("resource://gre/modules/FileUtils.jsm");

  Components.utils.import("resource://gre/modules/AddonManager.jsm");

  Components.utils.import("resource://gre/modules/NetUtil.jsm");

  Components.utils.import("resource://gre/modules/Console.jsm");

  Cu.importGlobalProperties(['PathUtils']);

} catch(e) {

  displayError("lhm-config-mozilla", e);

  throw e;

}

 

works with Firefox 128esr but throws an exception with 140esr:

 

Components.utils.import is not a function

 

Does an alternative way of importing js-modules exist?

 

Michael Gasch

-- 

 

Landeshauptstadt München

IT-Referat

it@M

 

Geschäftsfeld Infrastruktur, Basisservices und Support

Stadtweite Basisanwendungen

Serviceteam Kommunikation & Kollaboration

Browser (Chrome, Edge, Firefox), Gimp, Inkscape, OBS-Studio

 

it@M Logo

 

Büro: Agnes-Pockels-Bogen 33, Zimmer QUBES, Gebäudeteil P/Q 4.OG, Shared Desk, 80992 München

Postanschrift: Agnes-Pockels-Bogen 33, 80992 München

 

Telefon: +49 89 233-770122

michae...@muenchen.de

itm.i...@muenchen.de

Website: https://muenchen.digital

 

Elektronische Kommunikation mit der Landeshauptstadt München siehe:

https://www.muenchen.de/ekomm

 

Bitte denken Sie an die Umwelt, bevor Sie diese E-Mail ausdrucken. Pro Blatt sparen Sie durchschnittlich 15g Holz, 260ml Wasser, 0,05kWh Strom und 5g CO2.

 

Mike Kaply

unread,
Jun 30, 2025, 6:40:11 AMJun 30
to Michael Gasch, Mozilla.org
There have been significant changes in how JavaScript modules are imported, including the renaming of all JSM files.

This will require updates to any autoconfig scripts.

I'm curious why you still need autoconfig?

Mike

--
You received this message because you are subscribed to the Google Groups "enter...@mozilla.org" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enterprise+...@mozilla.org.
To view this discussion visit https://groups.google.com/a/mozilla.org/d/msgid/enterprise/3b00d756c72348b0bb3fd0bb63e0309e%40muenchen.de.
Reply all
Reply to author
Forward
0 new messages