Failure of ALL invocations of functions from keyboard.js after switch to ESModules
Affected version
- Fedora Linux 39 (Workstation Edition)
- Kernel: 6.5.11-300.fc39.x86_64
- gnome-shell 45.1 (gnome-shell-45.1-1.fc39.src.rpm)
Bug summary
Trying to execute any function from keyboard.js
fails. This can be e.g. activating input source or checking available input sources.
Steps to reproduce
- Start looking glass console
Alt+F2
- Execute
console.dir(imports.ui.status.keyboard.getInputSourceManager().inputSources);
What happened
An error occurred: <exception SyntaxError: import declarations may only appear at top level of a module>
What did you expect to happen
A list of available input sources should be returned (and visible using journalctl
), e.g.
{
"0": {
"type": "xkb",
"id": "es",
"displayName": "Spanish",
"_shortName": "es",
"index": 0,
"properties": null,
"xkbId": "es"
}
}
Impact on extensions
This bug prevents all extensions calling keyboard.js
from working. The following error is visible in Fedora's journal.
Nov 17 12:03:22 fedora gnome-shell[145124]: JS ERROR: SyntaxError: import declarations may only appear at top level of a module @ resource:///org/gnome/shell/ui/status/keyboard.js:3:0
Probable cause
I'm only suspecting that the first, comment line of ui/status/keyboard.js is responsible for this error.