GNOME Bugzilla – Bug 781471
Lots of warnings on initialization
Last modified: 2018-07-19 10:33:04 UTC
When I run GNOME Shell 3.24, I see a whole lot of warnings: Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/main.js 317]: reference to undefined property global.stage Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/layout.js 217]: reference to undefined property global.window_group Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/layout.js 899]: reference to undefined property this.monitors[this.findIndexForActor(...)] Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/osdMonitorLabeler.js 59]: reference to undefined property Meta.MonitorManager Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/panel.js 1107]: reference to undefined property indicator.menu._openChangedId Gjs-Message: JS WARNING: [resource:///org/gnome/gjs/modules/tweener/tweener.js 514]: reference to undefined property obj.delay current session already has an ibus-daemon. Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/slider.js 34]: reference to undefined property St.GenericAccessible GNOME Shell-Message: Failed to register AuthenticationAgent Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/search.js 432]: reference to undefined property provider.isRemoteProvider GNOME Shell-Message: Failed to add search provider /usr/share/gnome-shell/search-providers/org.gnome.bijiben-search-provider.ini: TypeError: appInfo is null Gjs-Message: JS WARNING: [/home/feaneron/.local/share/gnome-shell/extensions/screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com/extension.js 150]: reference to undefined property Meta.KeyBindingFlags.REVERSES User Themes-Message: loading default theme (Adwaita) GNOME Shell-Message: Extension screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com already installed in /home/feaneron/.local/share/gnome-shell/extensions/screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com. /usr/share/gnome-shell/extensions/screenshot-window-sizer@gnome-shell-extensions.gcampax.github.com will not be loaded GNOME Shell-Message: Extension user-theme@gnome-shell-extensions.gcampax.github.com already installed in /home/feaneron/.local/share/gnome-shell/extensions/user-theme@gnome-shell-extensions.gcampax.github.com. /usr/share/gnome-shell/extensions/user-theme@gnome-shell-extensions.gcampax.github.com will not be loaded Gjs-Message: JS WARNING: [/usr/share/gnome-shell/extensions/pomodoro@arun.codito.in/presence.js 42]: reference to undefined property this._timerState Gjs-Message: JS WARNING: [resource:///org/gnome/shell/misc/ibusManager.js 196]: reference to undefined property this._engines[id] Gjs-Message: JS WARNING: [/usr/share/gnome-shell/extensions/pomodoro@arun.codito.in/extension.js 173]: reference to undefined property this._timerState Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/messageList.js 353]: reference to undefined property this._useBodyMarkup Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/messageList.js 386]: reference to undefined property this._useBodyMarkup Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/status/network.js 1897]: reference to undefined property this._mainConnectionStateChangedId Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/messageList.js 169]: reference to undefined property this._container Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/panel.js 342]: reference to undefined property this.menu.actionGroup Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/dash.js 760]: reference to undefined property oldApps[oldIndex] Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/appDisplay.js 1298]: reference to undefined property this.name Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/workspace.js 1233]: reference to undefined property this._reservedSlotWindow Gjs-Message: JS WARNING: [/usr/share/gnome-shell/extensions/pomodoro@arun.codito.in/dialogs.js 134]: reference to undefined property source.indicatorCount Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/messageList.js 392]: reference to undefined property this._useBodyMarkup Window manager warning: last_user_time (1254097) is greater than comparison timestamp (1251878). This most likely represents a buggy client sending inaccurate timestamps in messages such as _NET_ACTIVE_WINDOW. Trying to work around... Window manager warning: 0x2600007 (gnome-br) appears to be one of the offending windows with a timestamp of 1254097. Working around... Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/notificationDaemon.js 189]: reference to undefined property ndata.hints['desktop-entry'] Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/notificationDaemon.js 394]: reference to undefined property hints.resident Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/modalDialog.js 311]: reference to undefined property global.gdk_screen
The same issues, GNOME Shell 3.24.0, Ubuntu GNOME 17.04 amd64: Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/main.js 317]: reference to undefined property global.stage Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/layout.js 217]: reference to undefined property global.window_group Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/layout.js 899]: reference to undefined property this.monitors[this.findIndexForActor(...)] Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/osdMonitorLabeler.js 59]: reference to undefined property Meta.MonitorManager Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/panel.js 1107]: reference to undefined property indicator.menu._openChangedId Gjs-Message: JS WARNING: [resource:///org/gnome/gjs/modules/tweener/tweener.js 514]: reference to undefined property obj.delay current session already has an ibus-daemon. Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/slider.js 34]: reference to undefined property St.GenericAccessible Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/search.js 432]: reference to undefined property provider.isRemoteProvider Gjs-Message: JS WARNING: [resource:///org/gnome/shell/misc/ibusManager.js 196]: reference to undefined property this._engines[id] Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/status/network.js 1885]: reference to undefined property this._mainConnectionStateChangedId Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/panel.js 342]: reference to undefined property this.menu.actionGroup Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/dash.js 760]: reference to undefined property oldApps[oldIndex] Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/appDisplay.js 1298]: reference to undefined property this.name Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/workspace.js 1229]: reference to undefined property this._reservedSlotWindow
*** Bug 783896 has been marked as a duplicate of this bug. ***
Created attachment 353949 [details] [review] Initialize properties in _init() While we've always considered it good style to initialize JS properties, some code that relies on uninitialized properties having an implicit value of 'undefined' has slipped in over time. The updated SpiderMonkey version used by gjs now warns when accessing those properties, so we should make sure that they are properly initialized to avoid log spam, even though all warnings addressed here occur in conditionals that produce the correct result with 'undefined'.
Created attachment 353950 [details] [review] Don't use 'undefined' as boolean Make sure we pass a proper false value instead of undefined to avoid warnings.
Created attachment 353951 [details] [review] dash: Fix some JS warnings We currently use "array[index]" to test whether an array has an element at index before using it. However nowadays gjs warns about accessing non-existent array elements, so the test itself already produces a warning. Avoid this by checking the array length before using an index to access an element.
Created attachment 353952 [details] [review] remoteMenu: Add actionGroup accessor To avoid recreating the app menu unnecessarily, the panel checks whether the menu's current actionGroup already matches the target one. However as the menu's actionGroup property is currently private, the test always fails, whoops.
Created attachment 353953 [details] [review] panel: Fix a JS warning We need to track the open-status of indicator menus, but don't want to hook up signals more than once, so we check for the handler ID we store on the object. As the property is only defined once we did set up the signal connection, this check now logs a warning. We can avoid it by checking for the existence of the property rather than a particular value.
Created attachment 353954 [details] [review] history: Fix bogus return value We only use lastItem() to reset the history index to the end, so nobody noticed the utter nonsense in the return value until gjs started to warn about it. As we don't actually use the value anywhere, we could just remove it, but the function name implies that an item is returned, so fix it to behave as advertised.
Created attachment 353955 [details] [review] ibusManager: Fix a warning Don't try to access a non-existent engine - it probably makes sense to use Map() instead of a plain object to track engines in the future, but for now just add an additional check to shut up a warning.
Created attachment 353956 [details] [review] layout: Range-check index before array lookup findMonitorForActor() may be called before the layoutManager gets to initialize monitors, so make sure the monitor index is in range to avoid a warning.
Created attachment 353957 [details] [review] windowManager: Fix a warning The destroy effect currently relies on a monkey-patched property added from the map effect. However on X11 it is possible that we did no map animation for a window that is destroyed when the shell was restarted or had taken over from another WM. Just use the real MetaWindow property to avoid a warning in that case.
Created attachment 353958 [details] [review] calendar: Fix access to undefined property Don't call a parent method before chaining-up _init() to avoid a warning about access to an undefined property.
Created attachment 353959 [details] [review] notificationDaemon: Avoid access to undefined property Avoid a warning when assigning from an undefined property by making sure to pass a proper null value instead.
Created attachment 353960 [details] [review] dateMenu: Set _delegate on non-menu-item menu child PopupMenu needs special-treatment of certain types of menu items, which it determines via children's _delegate property. However as the calendar drop-down is very unmenu-ish, we use regular actors rather than PopupMenuItems and the missing _delegate property triggers a warning. Just add it as the bare minimum to make PopupMenu happy.
Created attachment 353961 [details] [review] shellDBus: Avoid access to undefined properties Don't rely on an implicit undefined value of unset parameters to shut up some warnings.
The attached patches should fix most of the JS warnings that are triggered by gnome-shell as seen in my logs (and mostly matching the ones on this bug). (In reply to Georges Basile Stavracas Neto from comment #0) > Gjs-Message: JS WARNING: [resource:///org/gnome/shell/ui/main.js 317]: > reference to undefined property global.stage The ShellGlobal singleton is initialized before handing over control to javascript, so why all its GObject properties trigger a warning is a complete mystery to me. Any hints appreciated. > [resource:///org/gnome/shell/ui/osdMonitorLabeler.js 59]: reference to > undefined property Meta.MonitorManager Same for valid classes in properly imported typelib namespaces ...
Created attachment 353966 [details] [review] Initialize properties in _init() Found another case ...
Review of attachment 353950 [details] [review]: ok
Review of attachment 353951 [details] [review]: seems fine and more readable
Review of attachment 353952 [details] [review]: right
Review of attachment 353953 [details] [review]: ++
Review of attachment 353954 [details] [review]: obviously
Review of attachment 353955 [details] [review]: indeed
Review of attachment 353956 [details] [review]: this looks fine but callers will still blow up since only one deals with a null monitor
Review of attachment 353957 [details] [review]: might as well just remove the JS property and always use the real one, no?
Review of attachment 353958 [details] [review]: ::: js/ui/calendar.js @@ +765,2 @@ this.setUseBodyMarkup(notification.bannerBodyMarkup); + this.setBody(notification.bannerBodyText); nit: it would also work to keep the body text instead of null above and avoid this second call
Review of attachment 353959 [details] [review]: ok
Review of attachment 353960 [details] [review]: sure
Review of attachment 353961 [details] [review]: ++
Review of attachment 353966 [details] [review]: all lgtm
Created attachment 355513 [details] [review] layout: Skip strut computation in the no-monitor case It's possible for updateRegions() to be called before monitors have been properly initialized. Instead of throwing an error in that case, just skip the strut computation (that doesn't make sense anyway without a monitor). (In reply to Rui Matos from comment #24) > this looks fine but callers will still blow up since only one deals with a > null monitor Yeah, it's not meant to fix the no-monitor case, just to guard against any calls during initialization. The only caller that looks like we might run into on startup (although I haven't seen it in the logs) is the one in _updateRegions(), so probably worth handling it.
(In reply to Rui Matos from comment #25) > Review of attachment 353957 [details] [review] [review]: > > might as well just remove the JS property and always use the real one, no? It's used in the 'notify::window-type' handler to update the dimming of the parent window if either the old or new window type was "attached-modal-dialog". I don't see how we can do the "old window type" part without tracking it ourselves ... (In reply to Rui Matos from comment #26) > Review of attachment 353958 [details] [review] [review]: > > ::: js/ui/calendar.js > @@ +765,2 @@ > this.setUseBodyMarkup(notification.bannerBodyMarkup); > + this.setBody(notification.bannerBodyText); > > nit: it would also work to keep the body text instead of null above and > avoid this second call Oh, true - nice catch!
Review of attachment 355513 [details] [review]: looks fine
Review of attachment 353957 [details] [review]: (In reply to Florian Müllner from comment #32) > It's used in the 'notify::window-type' handler to update the dimming of the > parent window if either the old or new window type was > "attached-modal-dialog". I don't see how we can do the "old window type" > part without tracking it ourselves ... Aha, indeed, I misread that code
Review of attachment 353956 [details] [review]: ++
Attachment 353950 [details] pushed as e2f88d6 - Don't use 'undefined' as boolean Attachment 353951 [details] pushed as 2a01606 - dash: Fix some JS warnings Attachment 353952 [details] pushed as 755698a - remoteMenu: Add actionGroup accessor Attachment 353953 [details] pushed as 28d0983 - panel: Fix a JS warning Attachment 353954 [details] pushed as b50d714 - history: Fix bogus return value Attachment 353955 [details] pushed as f33560f - ibusManager: Fix a warning Attachment 353956 [details] pushed as 1ba014d - layout: Range-check index before array lookup Attachment 353957 [details] pushed as 32fdc22 - windowManager: Fix a warning Attachment 353958 [details] pushed as b73c96d - calendar: Fix access to undefined property Attachment 353959 [details] pushed as d815c5d - notificationDaemon: Avoid access to undefined property Attachment 353960 [details] pushed as c1758c4 - dateMenu: Set _delegate on non-menu-item menu child Attachment 353961 [details] pushed as ccaae5d - shellDBus: Avoid access to undefined properties Attachment 353966 [details] pushed as 358133e - Initialize properties in _init() Attachment 355513 [details] pushed as 4e57b45 - layout: Skip strut computation in the no-monitor case I still see some warnings that fall in the two categories mentioned in comment #16; I'll leave this open for now in the hope that we'll figure those out as well ...
Created attachment 355667 [details] [review] Remove excess parameter to g_app_info_launch() Commit 39a840e2c3d added an additional parameter to shell_app_launch(). When adjusting callers, the parameter was also added accidentally to calls of the confusingly similar g_app_info_launch() ... Remove those to fix some warnings.
Review of attachment 355667 [details] [review]: yep
Comment on attachment 355667 [details] [review] Remove excess parameter to g_app_info_launch() Attachment 355667 [details] pushed as 6b71b79 - Remove excess parameter to g_app_info_launch()
With gnome-shell 3.26.1, only a few warnings are left: Okt 25 22:25:07 hostname gnome-shell[899]: JS WARNING: [resource:///org/gnome/shell/ui/main.js 315]: reference to undefined property "MetaStage" Okt 25 22:25:07 hostname gnome-shell[899]: JS WARNING: [resource:///org/gnome/shell/ui/layout.js 221]: reference to undefined property "MetaWindowGroup" Okt 25 22:25:07 hostname gnome-shell[899]: JS WARNING: [resource:///org/gnome/shell/ui/osdMonitorLabeler.js 59]: reference to undefined property "MetaDBusDisplayConfigSkeleton" Okt 25 22:25:07 hostname gnome-shell[899]: JS WARNING: [resource:///org/gnome/shell/ui/slider.js 38]: reference to undefined property "CallyActor" Okt 25 22:25:08 hostname gnome-shell[899]: JS WARNING: [resource:///org/gnome/gjs/modules/tweener/tweener.js 540]: reference to undefined property "isSpecialProperty" Okt 25 22:25:09 hostname gnome-shell[899]: JS WARNING: [resource:///org/gnome/shell/ui/windowManager.js 1471]: reference to undefined property "MetaWindowX11" Okt 25 22:37:19 hostname gnome-shell[1597]: JS WARNING: [resource:///org/gnome/shell/ui/popupMenu.js 715]: reference to undefined property "_delegate" Repeated warnings have been removed from this list.
(In reply to Christian Stadelmann from comment #40) > With gnome-shell 3.26.1, only a few warnings are left: > > Okt 25 22:25:07 hostname gnome-shell[899]: JS WARNING: > [resource:///org/gnome/shell/ui/main.js 315]: reference to undefined > property "MetaStage" Those are the kinds of warnings mentioned in comment #16 - still no idea what's wrong there. > Okt 25 22:25:08 hostname gnome-shell[899]: JS WARNING: > [resource:///org/gnome/gjs/modules/tweener/tweener.js 540]: reference to > undefined property "isSpecialProperty" That's not gnome-shell - I've submitted https://gitlab.gnome.org/GNOME/gjs/merge_requests/5 > Okt 25 22:37:19 hostname gnome-shell[1597]: JS WARNING: > [resource:///org/gnome/shell/ui/popupMenu.js 715]: reference to undefined > property "_delegate" That's likely a non-PopupMenuItem-actor added to a menu without setting the _delegate property like we do here: https://git.gnome.org//browse/gnome-shell/tree/js/ui/dateMenu.js#n490 As far as I can see we don't stuff custom actors into a menu anywhere else, so I suspect that this is triggered by an extension.
(In reply to Florian Müllner from comment #41) > (In reply to Christian Stadelmann from comment #40) > > With gnome-shell 3.26.1, only a few warnings are left: > > > > Okt 25 22:25:07 hostname gnome-shell[899]: JS WARNING: > > [resource:///org/gnome/shell/ui/main.js 315]: reference to undefined > > property "MetaStage" > > Those are the kinds of warnings mentioned in comment #16 - still no idea > what's wrong there. I had another look today, and finally figure it out \o/
Created attachment 371621 [details] [review] clutter: Don't reference invalid pc in gir Cally is built into clutter itself rather than exposed as a separate library.
Created attachment 371622 [details] [review] window-group: Remove undefined function declaration Ever since the function has been made public, its name has been meta_actor_is_untransformed() ...
Created attachment 371623 [details] [review] build: Introspect some more types While MetaStage, MetaWindowGroup and MetaDBusDisplayConfigSkeleton don't appear explicitly in the public API, their gtypes are still exposed via meta_get_stage_for_screen(), meta_get_*window_group_for_screen() and MetaMonitorManager's parent type. Newer versions of gjs will warn about undefined properties if it encounters a gtype without introspection information, so expose those types to shut up the warnings.
Created attachment 371624 [details] [review] build: Include Cally in St introspection CallyActor is exposed indirectly via StAccessible's parent type, so add the dependency to shut up a gjs warning.
Also filed as https://gitlab.gnome.org/GNOME/mutter/merge_requests/100 and https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/94.
Created attachment 371784 [details] [review] build: Introspect some more types While MetaStage, MetaWindowGroup and MetaDBusDisplayConfigSkeleton don't appear explicitly in the public API, their gtypes are still exposed via meta_get_stage_for_screen(), meta_get_*window_group_for_screen() and MetaMonitorManager's parent type. Newer versions of gjs will warn about undefined properties if it encounters a gtype without introspection information, so expose those types to shut up the warnings.
Attachment 371621 [details] pushed as 920dc9e - clutter: Don't reference invalid pc in gir Attachment 371622 [details] pushed as b380aa7 - window-group: Remove undefined function declaration Attachment 371784 [details] pushed as 28eff93 - build: Introspect some more types
Attachment 371624 [details] pushed as a49fb90 - build: Include Cally in St introspection
*** Bug 730087 has been marked as a duplicate of this bug. ***