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'.

https://bugzilla.gnome.org/show_bug.cgi?id=781471
This commit is contained in:
Florian Müllner 2017-06-13 04:24:12 +02:00
parent 31c9d2cf7a
commit 54891a4cd0
7 changed files with 18 additions and 0 deletions

View File

@ -128,6 +128,9 @@ const ShellUserVerifier = new Lang.Class({
this._client = client;
this._defaultService = null;
this._preemptingService = null;
this._settings = new Gio.Settings({ schema_id: LOGIN_SCREEN_SCHEMA });
this._settings.connect('changed',
Lang.bind(this, this._updateDefaultService));
@ -140,6 +143,7 @@ const ShellUserVerifier = new Lang.Class({
// at startup should result in immediately initiating authentication.
// This is different than fingeprint readers, where we only check them
// after a user has been picked.
this.smartcardDetected = false;
this._checkForSmartcard();
this._smartcardInsertedId = this._smartcardManager.connect('smartcard-inserted',

View File

@ -1083,6 +1083,8 @@ const AppSearchProvider = new Lang.Class({
_init: function() {
this._appSys = Shell.AppSystem.get_default();
this.id = 'applications';
this.isRemoteProvider = false;
this.canLaunchSearch = false;
},
getResultMetas: function(apps, callback) {
@ -1251,6 +1253,7 @@ const FolderIcon = new Lang.Class({
_init: function(id, path, parentView) {
this.id = id;
this.name = '';
this._parentView = parentView;
this._folder = new Gio.Settings({ schema_id: 'org.gnome.desktop.app-folders.folder',

View File

@ -783,6 +783,7 @@ const LookingGlass = new Lang.Class({
this._open = false;
this._it = null;
this._offset = 0;
this._results = [];

View File

@ -165,6 +165,11 @@ const ScaleLayout = new Lang.Class({
Name: 'ScaleLayout',
Extends: Clutter.BinLayout,
_init: function(params) {
this._container = null;
this.parent(params);
},
_connectContainer: function(container) {
if (this._container == container)
return;
@ -299,6 +304,8 @@ const Message = new Lang.Class({
_init: function(title, body) {
this.expanded = false;
this._useBodyMarkup = false;
this.actor = new St.Button({ style_class: 'message',
accessible_role: Atk.Role.NOTIFICATION,
can_focus: true,

View File

@ -200,6 +200,7 @@ const RemoteSearchProvider = new Lang.Class({
this.appInfo = appInfo;
this.id = appInfo.get_id();
this.isRemoteProvider = true;
this.canLaunchSearch = false;
},
createIcon: function(size, meta) {

View File

@ -1709,6 +1709,7 @@ const NMApplet = new Lang.Class({
this._mainConnection = null;
this._mainConnectionIconChangedId = 0;
this._mainConnectionStateChangedId = 0;
this._notification = null;

View File

@ -1100,6 +1100,7 @@ const Workspace = new Lang.Class({
_init : function(metaWorkspace, monitorIndex) {
// When dragging a window, we use this slot for reserve space.
this._reservedSlot = null;
this._reservedSlotWindow = null;
this.metaWorkspace = metaWorkspace;
// The full geometry is the geometry we should try and position