cleanup: Use type-safe comparisons
We have been using type-safe comparisons in new code for quite a while now, however old code has only been adapted slowly. Change all the remaining bits to get rid of another legacy style difference. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2866>
This commit is contained in:

committed by
Marge Bot

parent
9a3913d4a0
commit
a42f7c2384
@@ -71,9 +71,9 @@ export const AuthPrompt = GObject.registerClass({
|
||||
this._cancelledRetries = 0;
|
||||
|
||||
let reauthenticationOnly;
|
||||
if (this._mode == AuthPromptMode.UNLOCK_ONLY)
|
||||
if (this._mode === AuthPromptMode.UNLOCK_ONLY)
|
||||
reauthenticationOnly = true;
|
||||
else if (this._mode == AuthPromptMode.UNLOCK_OR_LOG_IN)
|
||||
else if (this._mode === AuthPromptMode.UNLOCK_OR_LOG_IN)
|
||||
reauthenticationOnly = false;
|
||||
|
||||
this._userVerifier = new GdmUtil.ShellUserVerifier(this._gdmClient, {reauthenticationOnly});
|
||||
@@ -337,7 +337,7 @@ export const AuthPrompt = GObject.registerClass({
|
||||
}
|
||||
|
||||
_onCredentialManagerAuthenticated() {
|
||||
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
this.reset();
|
||||
}
|
||||
|
||||
@@ -352,11 +352,11 @@ export const AuthPrompt = GObject.registerClass({
|
||||
// 2) Don't reset if we've already succeeded at verification and
|
||||
// the user is getting logged in.
|
||||
if (this._userVerifier.serviceIsDefault(GdmUtil.SMARTCARD_SERVICE_NAME) &&
|
||||
this.verificationStatus == AuthPromptStatus.VERIFYING &&
|
||||
this.verificationStatus === AuthPromptStatus.VERIFYING &&
|
||||
this.smartcardDetected)
|
||||
return;
|
||||
|
||||
if (this.verificationStatus != AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
if (this.verificationStatus !== AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
this.reset();
|
||||
}
|
||||
|
||||
@@ -419,18 +419,18 @@ export const AuthPrompt = GObject.registerClass({
|
||||
oldActor.remove_all_transitions();
|
||||
|
||||
let wasSpinner;
|
||||
if (oldActor == this._spinner)
|
||||
if (oldActor === this._spinner)
|
||||
wasSpinner = true;
|
||||
else
|
||||
wasSpinner = false;
|
||||
|
||||
let isSpinner;
|
||||
if (actor == this._spinner)
|
||||
if (actor === this._spinner)
|
||||
isSpinner = true;
|
||||
else
|
||||
isSpinner = false;
|
||||
|
||||
if (this._defaultButtonWellActor != actor && oldActor) {
|
||||
if (this._defaultButtonWellActor !== actor && oldActor) {
|
||||
if (!animate) {
|
||||
oldActor.opacity = 0;
|
||||
|
||||
@@ -538,7 +538,7 @@ export const AuthPrompt = GObject.registerClass({
|
||||
}
|
||||
|
||||
_fadeOutMessage() {
|
||||
if (this._message.opacity == 0)
|
||||
if (this._message.opacity === 0)
|
||||
return;
|
||||
this._message.remove_all_transitions();
|
||||
this._message.ease({
|
||||
@@ -549,12 +549,12 @@ export const AuthPrompt = GObject.registerClass({
|
||||
}
|
||||
|
||||
setMessage(message, type, wiggleParameters = {duration: 0}) {
|
||||
if (type == GdmUtil.MessageType.ERROR)
|
||||
if (type === GdmUtil.MessageType.ERROR)
|
||||
this._message.add_style_class_name('login-dialog-message-warning');
|
||||
else
|
||||
this._message.remove_style_class_name('login-dialog-message-warning');
|
||||
|
||||
if (type == GdmUtil.MessageType.HINT)
|
||||
if (type === GdmUtil.MessageType.HINT)
|
||||
this._message.add_style_class_name('login-dialog-message-hint');
|
||||
else
|
||||
this._message.remove_style_class_name('login-dialog-message-hint');
|
||||
@@ -627,14 +627,14 @@ export const AuthPrompt = GObject.registerClass({
|
||||
this._updateEntry(true);
|
||||
this.stopSpinning();
|
||||
|
||||
if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
|
||||
if (oldStatus === AuthPromptStatus.VERIFICATION_FAILED)
|
||||
this.emit('failed');
|
||||
else if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
|
||||
this.emit('cancelled');
|
||||
|
||||
let beginRequestType;
|
||||
|
||||
if (this._mode == AuthPromptMode.UNLOCK_ONLY) {
|
||||
if (this._mode === AuthPromptMode.UNLOCK_ONLY) {
|
||||
// The user is constant at the unlock screen, so it will immediately
|
||||
// respond to the request with the username
|
||||
if (oldStatus === AuthPromptStatus.VERIFICATION_CANCELLED)
|
||||
@@ -694,7 +694,7 @@ export const AuthPrompt = GObject.registerClass({
|
||||
}
|
||||
|
||||
cancel() {
|
||||
if (this.verificationStatus == AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
if (this.verificationStatus === AuthPromptStatus.VERIFICATION_SUCCEEDED)
|
||||
return;
|
||||
|
||||
if (this.verificationStatus === AuthPromptStatus.VERIFICATION_IN_PROGRESS) {
|
||||
|
@@ -94,7 +94,7 @@ export class Hold extends Task {
|
||||
release() {
|
||||
this._acquisitions--;
|
||||
|
||||
if (this._acquisitions == 0)
|
||||
if (this._acquisitions === 0)
|
||||
this.emit('release');
|
||||
}
|
||||
|
||||
|
@@ -194,7 +194,7 @@ const UserList = GObject.registerClass({
|
||||
if (!hasItems)
|
||||
return;
|
||||
|
||||
if (global.stage.get_key_focus() != this)
|
||||
if (global.stage.get_key_focus() !== this)
|
||||
return;
|
||||
|
||||
let focusSet = this.navigate_focus(null, St.DirectionType.TAB_FORWARD, false);
|
||||
@@ -364,7 +364,7 @@ const SessionMenuButton = GObject.registerClass({
|
||||
_updateOrnament() {
|
||||
let itemIds = Object.keys(this._items);
|
||||
for (let i = 0; i < itemIds.length; i++) {
|
||||
if (itemIds[i] == this._activeSessionId)
|
||||
if (itemIds[i] === this._activeSessionId)
|
||||
this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.DOT);
|
||||
else
|
||||
this._items[itemIds[i]].setOrnament(PopupMenu.Ornament.NONE);
|
||||
@@ -372,7 +372,7 @@ const SessionMenuButton = GObject.registerClass({
|
||||
}
|
||||
|
||||
setActiveSession(sessionId) {
|
||||
if (sessionId == this._activeSessionId)
|
||||
if (sessionId === this._activeSessionId)
|
||||
return;
|
||||
|
||||
this._activeSessionId = sessionId;
|
||||
@@ -774,13 +774,13 @@ export const LoginDialog = GObject.registerClass({
|
||||
let disableUserList = this._settings.get_boolean(GdmUtil.DISABLE_USER_LIST_KEY);
|
||||
|
||||
// Disable user list when there are no users.
|
||||
if (this._userListLoaded && this._userList.numItems() == 0)
|
||||
if (this._userListLoaded && this._userList.numItems() === 0)
|
||||
disableUserList = true;
|
||||
|
||||
if (disableUserList != this._disableUserList) {
|
||||
if (disableUserList !== this._disableUserList) {
|
||||
this._disableUserList = disableUserList;
|
||||
|
||||
if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||
if (this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||
this._authPrompt.reset();
|
||||
|
||||
if (this._disableUserList && this._timedLoginUserListHold)
|
||||
@@ -793,7 +793,8 @@ export const LoginDialog = GObject.registerClass({
|
||||
|
||||
// Hide the cancel button if the user list is disabled and we're asking for
|
||||
// a username
|
||||
if (this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING && this._disableUserList)
|
||||
if (this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING &&
|
||||
this._disableUserList)
|
||||
cancelVisible = false;
|
||||
else
|
||||
cancelVisible = true;
|
||||
@@ -860,7 +861,7 @@ export const LoginDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
_resetGreeterProxy() {
|
||||
if (GLib.getenv('GDM_GREETER_TEST') != '1') {
|
||||
if (GLib.getenv('GDM_GREETER_TEST') !== '1') {
|
||||
if (this._greeter)
|
||||
this._greeter.run_dispose();
|
||||
|
||||
@@ -904,8 +905,8 @@ export const LoginDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
_shouldShowSessionMenuButton() {
|
||||
if (this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFYING &&
|
||||
this._authPrompt.verificationStatus != AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
|
||||
if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.VERIFYING &&
|
||||
this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.VERIFICATION_FAILED)
|
||||
return false;
|
||||
|
||||
if (this._user && this._user.is_loaded && this._user.is_logged_in())
|
||||
@@ -968,7 +969,7 @@ export const LoginDialog = GObject.registerClass({
|
||||
|
||||
_bindOpacity() {
|
||||
this._bindings = Main.layoutManager.uiGroup.get_children()
|
||||
.filter(c => c != Main.layoutManager.screenShieldGroup)
|
||||
.filter(c => c !== Main.layoutManager.screenShieldGroup)
|
||||
.map(c => this.bind_property('opacity', c, 'opacity', 0));
|
||||
}
|
||||
|
||||
@@ -977,7 +978,8 @@ export const LoginDialog = GObject.registerClass({
|
||||
}
|
||||
|
||||
_loginScreenSessionActivated() {
|
||||
if (this.opacity == 255 && this._authPrompt.verificationStatus == AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||
if (this.opacity === 255 &&
|
||||
this._authPrompt.verificationStatus === AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||
return;
|
||||
|
||||
if (this._authPrompt.verificationStatus !== AuthPrompt.AuthPromptStatus.NOT_VERIFYING)
|
||||
@@ -1152,8 +1154,8 @@ export const LoginDialog = GObject.registerClass({
|
||||
|
||||
// Restart timed login on user interaction
|
||||
global.stage.connect('captured-event', (actor, event) => {
|
||||
if (event.type() == Clutter.EventType.KEY_PRESS ||
|
||||
event.type() == Clutter.EventType.BUTTON_PRESS)
|
||||
if (event.type() === Clutter.EventType.KEY_PRESS ||
|
||||
event.type() === Clutter.EventType.BUTTON_PRESS)
|
||||
this._startTimedLogin(userName, seconds);
|
||||
|
||||
return Clutter.EVENT_PROPAGATE;
|
||||
|
@@ -84,7 +84,7 @@ export class Manager extends Signals.EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
if (this._loginFormat != newLoginFormat) {
|
||||
if (this._loginFormat !== newLoginFormat) {
|
||||
this._loginFormat = newLoginFormat;
|
||||
this.emit('login-format-changed', newLoginFormat);
|
||||
}
|
||||
|
@@ -289,7 +289,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
|
||||
}
|
||||
|
||||
_queueMessageTimeout() {
|
||||
if (this._messageQueueTimeoutId != 0)
|
||||
if (this._messageQueueTimeoutId !== 0)
|
||||
return;
|
||||
|
||||
const message = this.currentMessage;
|
||||
@@ -337,7 +337,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
|
||||
_clearMessageQueue() {
|
||||
this.finishMessageQueue();
|
||||
|
||||
if (this._messageQueueTimeoutId != 0) {
|
||||
if (this._messageQueueTimeoutId !== 0) {
|
||||
GLib.source_remove(this._messageQueueTimeoutId);
|
||||
this._messageQueueTimeoutId = 0;
|
||||
}
|
||||
@@ -383,12 +383,12 @@ export class ShellUserVerifier extends Signals.EventEmitter {
|
||||
else
|
||||
smartcardDetected = this._smartcardManager.hasInsertedTokens();
|
||||
|
||||
if (smartcardDetected != this.smartcardDetected) {
|
||||
if (smartcardDetected !== this.smartcardDetected) {
|
||||
this.smartcardDetected = smartcardDetected;
|
||||
|
||||
if (this.smartcardDetected)
|
||||
this._preemptingService = SMARTCARD_SERVICE_NAME;
|
||||
else if (this._preemptingService == SMARTCARD_SERVICE_NAME)
|
||||
else if (this._preemptingService === SMARTCARD_SERVICE_NAME)
|
||||
this._preemptingService = null;
|
||||
|
||||
this.emit('smartcard-status-changed');
|
||||
@@ -504,7 +504,7 @@ export class ShellUserVerifier extends Signals.EventEmitter {
|
||||
}
|
||||
|
||||
serviceIsDefault(serviceName) {
|
||||
return serviceName == this._defaultService;
|
||||
return serviceName === this._defaultService;
|
||||
}
|
||||
|
||||
serviceIsFingerprint(serviceName) {
|
||||
|
Reference in New Issue
Block a user