extensions/shared: Don't cache detected URL
The translation functions we export from extension utils must work with all extensions, not only the first that calls one of the functions. That means that we are back to examining a backtrace for every function call unless an extension defined its own translation functions with `import.meta.url`. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2887>
This commit is contained in:
parent
4cb503d481
commit
af5dd7ddd1
@ -218,10 +218,8 @@ export class GettextWrapper {
|
||||
}
|
||||
|
||||
#lookupExtension(funcName) {
|
||||
if (!this.#url)
|
||||
this.#url = this.#detectUrl();
|
||||
|
||||
const extension = this.#extensionClass.lookupByURL(this.#url);
|
||||
const url = this.#url ?? this.#detectUrl();
|
||||
const extension = this.#extensionClass.lookupByURL(url);
|
||||
if (!extension)
|
||||
throw new Error(`${funcName} can only be called from extensions`);
|
||||
return extension;
|
||||
|
Loading…
Reference in New Issue
Block a user