After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 774758 - Extension preferences failing with "Error: Requiring Shell, version none: Typelib file for namespace 'Meta', version '3.0' not found"
Extension preferences failing with "Error: Requiring Shell, version none: Typ...
Status: RESOLVED WONTFIX
Product: gnome-shell
Classification: Core
Component: extensions
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2016-11-20 20:53 UTC by Vitor Araujo Boufleur
Modified: 2016-11-21 13:05 UTC
See Also:
GNOME target: ---
GNOME version: 3.19/3.20



Description Vitor Araujo Boufleur 2016-11-20 20:53:31 UTC
If the prefs.js contains the following line:

"const Util = imports.misc.util;"

The preferences dialog crashes with "Error: Requiring Shell, version none: Typelib file for namespace 'Meta', version '3.0' not found".

Stack trace:
  @resource:///org/gnome/shell/misc/util.js:7
  @/home/CENSORED/.local/share/gnome-shell/extensions/CENSORED/lib/util.js:34
  @/home/CENSORED/.local/share/gnome-shell/extensions/CENSORED/prefs.js:7
  Application<._getExtensionPrefsModule@resource:///org/gnome/shell/extensionPrefs/main.js:74
  wrapper@resource:///org/gnome/gjs/modules/lang.js:178
  Application<._selectExtension@resource:///org/gnome/shell/extensionPrefs/main.js:89
  wrapper@resource:///org/gnome/gjs/modules/lang.js:178
  Application<._onCommandLine@resource:///org/gnome/shell/extensionPrefs/main.js:238
  wrapper@resource:///org/gnome/gjs/modules/lang.js:178
  main@resource:///org/gnome/shell/extensionPrefs/main.js:376
  @<main>:1

I tested this on a random extension on a fresh copy of Fedora 24 and the error keeps happening anyway. My current system gnome-shell version is 3.20.4.

Step-by-step to reproduce:
1 - Choose a random extension and add the line "const Util = imports.misc.util;" to it's prefs.js file.
2 - Start gnome-shell-extension-prefs and try to open the modified extension preferences file.
3 - The error happens
Comment 1 Florian Müllner 2016-11-21 11:48:05 UTC
The reason for that particular error is that the extension-prefs tool doesn't include the (private) mutter typelibs in its search path. While we could add that, most gnome-shell code (and most definitively the code in the Meta namespace) is only useful when run in the compositor. So I don't see much of a point to make a handful of methods usable from external applications - if you want to use any of findUrls(), formatTime(), lowerBound() or insertSorted()(*) in a prefs dialog, you can just copy the code.

(*) those are the only functions in utils.js that look like they would work
Comment 2 Mario Wenzel 2016-11-21 12:27:07 UTC
Hi Florian,

it seems to me, that these utility functions that seem generally useful are in the wrong place if they can only be used when having a compositor available.

Their name certainly doesn't indicate that. Can we do anything else than saying that this is "by design"? To me, it doesn't look like it is. More like an accident.
Comment 3 Florian Müllner 2016-11-21 13:05:15 UTC
(In reply to Mario Wenzel from comment #2)
> it seems to me, that these utility functions that seem generally useful are
> in the wrong place if they can only be used when having a compositor
> available.

They are utility functions for *gnome-shell*, not general utility functions for any random program. There is an ExtensionUtils module that *is* usable from external processes, but that (and its dependencies) is really the only gnome-shell that can be assumed to work outside the gnome-shell process.


> Can we do anything else than saying that this is "by design"? To me, it 
> doesn't look like it is. More like an accident.

No, it's not an accident that any code that relies on access to internal state (window management, "global" object, scene graph etc.) doesn't work from a different process that doesn't have said state. Or in other words: If gnome-shell code was meant to work from any program, the whole concept of having extensions would be silly, as people could just write applications that use the gnome-shell library.