Bug 2053780 and bug 2064036 removed the lazy getters that `ChromeUtils` and `XPCOMUtils` defined in `browser/components/urlbar/content/`, and bug 2062987 gates the system module imports on `ChromeUtils` being available. What neither covers is a handful of direct `ChromeUtils` calls, each of which throws in a content realm where `ChromeUtils` is undefined: - `ChromeUtils.generateQI` -- `SearchModeSwitcher.mjs` (in the constructor, so it runs for every switcher, content included) and `UrlbarInputBase.mjs`, both to implement `nsIObserver`/`nsISupportsWeakReference`. - `ChromeUtils.encodeURIForSrcset` -- `UrlbarInputBase.mjs` and `SmartbarInput.mjs`, both when setting an engine icon. - `ChromeUtils.now` -- `UrlbarChildTelemetry.mjs", which is the content-side engagement collector used on the message path. At least the `SearchModeSwitcher` constructor and `UrlbarChildTelemetry` sit on paths a content-realm `<moz-urlbar>` reaches, so these are functional blockers rather than tidiness. Notes toward fixes: `generateQI` is there because these objects are XPCOM observers, so if the observer registration moves to the parent the `QueryInterface` goes with it. `ChromeUtils.now` has `performance.now()` as a content-safe equivalent, modulo the time base. `encodeURIForSrcset` has no content-realm equivalent and would need the actor, or a different way to set the icon.
Bug 2064185 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Bug 2053780 and bug 2064036 removed the lazy getters that `ChromeUtils` and `XPCOMUtils` defined in `browser/components/urlbar/content/`, and bug 2062987 gates the system module imports on `ChromeUtils` being available. What neither covers is a handful of direct `ChromeUtils` calls, each of which throws in a content realm where `ChromeUtils` is undefined: - `ChromeUtils.generateQI` -- `SearchModeSwitcher.mjs` (in the constructor, so it runs for every switcher, content included) and `UrlbarInputBase.mjs`, both to implement `nsIObserver`/`nsISupportsWeakReference`. - `ChromeUtils.encodeURIForSrcset` -- `UrlbarInputBase.mjs` and `SmartbarInput.mjs`, both when setting an engine icon. - `ChromeUtils.now` -- `UrlbarChildTelemetry.mjs`, which is the content-side engagement collector used on the message path. At least the `SearchModeSwitcher` constructor and `UrlbarChildTelemetry` sit on paths a content-realm `<moz-urlbar>` reaches, so these are functional blockers rather than tidiness. Notes toward fixes: `generateQI` is there because these objects are XPCOM observers, so if the observer registration moves to the parent the `QueryInterface` goes with it. `ChromeUtils.now` has `performance.now()` as a content-safe equivalent, modulo the time base. `encodeURIForSrcset` has no content-realm equivalent and would need the actor, or a different way to set the icon.