diff --git a/.eslintrc.js b/.eslintrc.js index f973206d168319..36dc6d489f5cfb 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,6 +15,7 @@ module.exports = { // Enabled checks. 'brace-style': ['error', '1tbs'], 'curly': ['error', 'multi-line', 'consistent'], + 'no-extra-boolean-cast': 'error', 'no-extra-semi': 'error', 'no-new-wrappers': 'error', 'no-restricted-properties': [ diff --git a/chrome/browser/resources/bookmarks/item.js b/chrome/browser/resources/bookmarks/item.js index 18fb94f0ad0c34..82dd723fa33459 100644 --- a/chrome/browser/resources/bookmarks/item.js +++ b/chrome/browser/resources/bookmarks/item.js @@ -59,9 +59,9 @@ Polymer({ /** @override */ attached: function() { - this.watch('item_', (store) => store.nodes[this.itemId]); + this.watch('item_', store => store.nodes[this.itemId]); this.watch( - 'isSelectedItem_', (store) => !!store.selection.items.has(this.itemId)); + 'isSelectedItem_', store => store.selection.items.has(this.itemId)); this.updateFromStore(); }, diff --git a/chrome/browser/resources/chromeos/chromevox/common/dom_util.js b/chrome/browser/resources/chromeos/chromevox/common/dom_util.js index 47a4aa7b8cbb4e..70cd5a280b396a 100644 --- a/chrome/browser/resources/chromeos/chromevox/common/dom_util.js +++ b/chrome/browser/resources/chromeos/chromevox/common/dom_util.js @@ -371,7 +371,7 @@ cvox.DomUtil.isLeafNode = function(node, opt_allowHidden) { return true; } - if (!!cvox.DomPredicates.linkPredicate([element])) { + if (cvox.DomPredicates.linkPredicate([element])) { return !cvox.DomUtil.findNode(element, function(node) { return !!cvox.DomPredicates.headingPredicate([node]); }); @@ -584,9 +584,9 @@ cvox.DomUtil.getName = function( * @private */ cvox.DomUtil.hasChildrenBasedName_ = function(node, opt_allowHidden) { - if (!!cvox.DomPredicates.linkPredicate([node]) || - !!cvox.DomPredicates.headingPredicate([node]) || - node.tagName == 'BUTTON' || cvox.AriaUtil.isControlWidget(node) || + if (cvox.DomPredicates.linkPredicate([node]) || + cvox.DomPredicates.headingPredicate([node]) || node.tagName == 'BUTTON' || + cvox.AriaUtil.isControlWidget(node) || !cvox.DomUtil.isLeafNode(node, opt_allowHidden)) { return true; } else { @@ -1112,7 +1112,7 @@ cvox.DomUtil.computeHasContent_ = function(node) { } } - if (!!cvox.DomPredicates.linkPredicate([node])) { + if (cvox.DomPredicates.linkPredicate([node])) { return true; } diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js index 4b1591c349926b..44bbe88b3938f1 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/automation_predicate.js @@ -440,12 +440,12 @@ AutomationPredicate.shouldIgnoreNode = function(node) { // Ignore nodes acting as labels for another control, that don't // have actionable descendants. - if (!!node.labelFor && node.labelFor.length > 0 && + if (node.labelFor && node.labelFor.length > 0 && !hasActionableDescendant(node)) return true; // Similarly, ignore nodes acting as descriptions. - if (!!node.descriptionFor && node.descriptionFor.length > 0 && + if (node.descriptionFor && node.descriptionFor.length > 0 && !hasActionableDescendant(node)) return true; diff --git a/chrome/browser/resources/chromeos/internet_detail_dialog/internet_detail_dialog.js b/chrome/browser/resources/chromeos/internet_detail_dialog/internet_detail_dialog.js index 5ecdaa20177937..32372f42b22242 100644 --- a/chrome/browser/resources/chromeos/internet_detail_dialog/internet_detail_dialog.js +++ b/chrome/browser/resources/chromeos/internet_detail_dialog/internet_detail_dialog.js @@ -126,7 +126,7 @@ Polymer({ * @private */ getNetworkDetails_: function() { - assert(!!this.guid); + assert(this.guid); this.networkingPrivate.getManagedProperties( this.guid, this.getPropertiesCallback_.bind(this)); }, @@ -167,7 +167,7 @@ Polymer({ if (!this.networkPropertiesReceived_) return; - assert(!!this.guid); + assert(this.guid); this.networkingPrivate.setProperties(this.guid, onc, () => { if (chrome.runtime.lastError) { // An error typically indicates invalid input; request the properties @@ -487,7 +487,7 @@ Polymer({ getInfoFields_: function() { /** @type {!Array} */ var fields = []; var type = this.networkProperties.Type; - if (type == CrOnc.Type.CELLULAR && !!this.networkProperties.Cellular) { + if (type == CrOnc.Type.CELLULAR && this.networkProperties.Cellular) { fields.push( 'Cellular.HomeProvider.Name', 'Cellular.ServingOperator.Name', 'Cellular.ActivationState', 'Cellular.RoamingState', diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js index 35ffb173a1ae5c..4e6e21b86a57c7 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/event_page.js @@ -310,7 +310,7 @@ chrome.storage.onChanged.addListener(function(changes, namespace) { var wpDocument = wallpaperPickerWindow.contentWindow.document; var messageContainer = wpDocument.querySelector('#message-container'); - if (!!appName) { + if (appName) { chrome.wallpaperPrivate.getStrings(function(strings) { var message = strings.currentWallpaperSetByMessage.replace(/\$1/g, appName); diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js index 8e0926ecbbfda3..5f856017ee5cd7 100644 --- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js +++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js @@ -379,7 +379,7 @@ WallpaperManager.prototype.postDownloadDomInit_ = function() { }; getThirdPartyAppName(function(appName) { - if (!!appName) { + if (appName) { $('message-container').textContent = loadTimeData.getStringF('currentWallpaperSetByMessage', appName); $('message-container').style.visibility = 'visible'; diff --git a/chrome/browser/resources/hangout_services/thunk.js b/chrome/browser/resources/hangout_services/thunk.js index e2b2042297e78c..788ba4d741b728 100644 --- a/chrome/browser/resources/hangout_services/thunk.js +++ b/chrome/browser/resources/hangout_services/thunk.js @@ -287,7 +287,7 @@ function onProcessCpu(port) { } else if (process.type == 'gpu') { gpuProcessCpu = process.cpu; } - if (!!browserProcessCpu && !!gpuProcessCpu) { + if (browserProcessCpu && gpuProcessCpu) { break; } } diff --git a/chrome/browser/resources/local_ntp/custom_links_edit.js b/chrome/browser/resources/local_ntp/custom_links_edit.js index 485222881fb849..d512f33619bedc 100644 --- a/chrome/browser/resources/local_ntp/custom_links_edit.js +++ b/chrome/browser/resources/local_ntp/custom_links_edit.js @@ -152,7 +152,7 @@ function finishEditLink() { } // Update the link only if a field was changed. - if (!!newUrl || !!newTitle) { + if (newUrl || newTitle) { chrome.embeddedSearch.newTabPage.updateCustomLink( prepopulatedLink.rid, newUrl, newTitle); } diff --git a/chrome/browser/resources/local_ntp/doodles.js b/chrome/browser/resources/local_ntp/doodles.js index 9708c8a7d8143b..89ec7af9f9d963 100644 --- a/chrome/browser/resources/local_ntp/doodles.js +++ b/chrome/browser/resources/local_ntp/doodles.js @@ -396,7 +396,7 @@ doodles.showLogoOrDoodle = function(fromCache) { .classList.remove(doodles.CLASSES.SHOW_LOGO); // Log the impression in Chrome metrics. - var isCta = !!doodles.targetDoodle.metadata.animatedUrl; + var isCta = doodles.targetDoodle.metadata.animatedUrl; var eventType = isCta ? (fromCache ? doodles.LOG_TYPE.NTP_CTA_LOGO_SHOWN_FROM_CACHE : doodles.LOG_TYPE.NTP_CTA_LOGO_SHOWN_FRESH) : diff --git a/chrome/browser/resources/local_ntp/voice.js b/chrome/browser/resources/local_ntp/voice.js index 7d34f80a791cbb..106dfe7d0743b1 100644 --- a/chrome/browser/resources/local_ntp/voice.js +++ b/chrome/browser/resources/local_ntp/voice.js @@ -538,7 +538,7 @@ speech.handleRecognitionResult_ = function(responseEvent) { // Force-stop long queries. if (speech.interimResult_.length > speech.QUERY_LENGTH_LIMIT_) { - if (!!speech.finalResult_) { + if (speech.finalResult_) { speech.submitFinalResult_(); } else { speech.onErrorReceived_(RecognitionError.NO_MATCH); @@ -749,7 +749,7 @@ speech.onKeyDown = function(event) { * @private */ speech.onIdleTimeout_ = function() { - if (!!speech.finalResult_) { + if (speech.finalResult_) { speech.submitFinalResult_(); return; } @@ -1167,7 +1167,7 @@ text.showErrorMessage = function(error) { const linkElement = text.getErrorLink_(error); // Setting textContent removes all children (no need to clear link elements). - if (!!linkElement) { + if (linkElement) { text.interim_.textContent += ' '; text.interim_.appendChild(linkElement); } diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js index 9788ae48a2eb7e..830b41b4517e16 100644 --- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js +++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.js @@ -799,7 +799,7 @@ Polymer({ * @private */ computeIssueBannerClass_: function(issue) { - return !!issue && !issue.isBlocking ? 'non-blocking' : ''; + return issue && !issue.isBlocking ? 'non-blocking' : ''; }, /** @@ -1374,7 +1374,7 @@ Polymer({ * @private */ maybeShowIssueView_: function(issue) { - if (!!issue) { + if (issue) { if (issue.isBlocking) { this.currentView_ = media_router.MediaRouterView.ISSUE; } else if (this.currentView_ == media_router.MediaRouterView.SINK_LIST) { @@ -1389,7 +1389,7 @@ Polymer({ this.showSinkList_(); } - if (!!this.pendingCreatedRouteId_ && !!issue && + if (this.pendingCreatedRouteId_ && issue && issue.routeId == this.pendingCreatedRouteId_) { this.resetRouteCreationProperties_(false); } diff --git a/chrome/browser/resources/print_preview/new/destination_dialog.js b/chrome/browser/resources/print_preview/new/destination_dialog.js index 9cceebda4a5ae9..2aae2bd227be5c 100644 --- a/chrome/browser/resources/print_preview/new/destination_dialog.js +++ b/chrome/browser/resources/print_preview/new/destination_dialog.js @@ -214,7 +214,7 @@ Polymer({ 'Failed to resolve provisional destination: ' + destination.id); }) .then(() => { - if (this.$.dialog.open && !!listItem && !listItem.hidden) { + if (this.$.dialog.open && listItem && !listItem.hidden) { listItem.focus(); } }); diff --git a/chrome/browser/resources/print_preview/new/model.js b/chrome/browser/resources/print_preview/new/model.js index 5c646aeb5a39cb..e1fe997724f418 100644 --- a/chrome/browser/resources/print_preview/new/model.js +++ b/chrome/browser/resources/print_preview/new/model.js @@ -369,7 +369,7 @@ Polymer({ this.lastDestinationCapabilities_ = this.destination.capabilities; - const caps = !!this.destination.capabilities ? + const caps = this.destination.capabilities ? this.destination.capabilities.printer : null; this.updateSettingsAvailabilityFromDestination_(caps); @@ -386,8 +386,8 @@ Polymer({ * @private */ updateSettingsAvailabilityFromDestination_: function(caps) { - this.set('settings.copies.available', !!caps && !!(caps.copies)); - this.set('settings.collate.available', !!caps && !!(caps.collate)); + this.set('settings.copies.available', !!caps && !!caps.copies); + this.set('settings.collate.available', !!caps && !!caps.collate); this.set('settings.layout.available', this.isLayoutAvailable_(caps)); this.set('settings.color.available', this.destination.hasColorCapability); @@ -424,7 +424,7 @@ Polymer({ 'settings.fitToPage.available', !knownSizeToSaveAsPdf && !this.documentSettings.isModifiable); this.set('settings.scaling.available', !knownSizeToSaveAsPdf); - const caps = (!!this.destination && !!this.destination.capabilities) ? + const caps = this.destination && this.destination.capabilities ? this.destination.capabilities.printer : null; this.set( @@ -602,17 +602,17 @@ Polymer({ const vendorSettings = {}; for (const item of caps.vendor_capability) { let defaultValue = null; - if (item.type == 'SELECT' && !!item.select_cap && - !!item.select_cap.option) { + if (item.type == 'SELECT' && item.select_cap && + item.select_cap.option) { const defaultOption = item.select_cap.option.find(o => !!o.is_default); - defaultValue = !!defaultOption ? defaultOption.value : null; + defaultValue = defaultOption ? defaultOption.value : null; } else if (item.type == 'RANGE') { - if (!!item.range_cap) { + if (item.range_cap) { defaultValue = item.range_cap.default || null; } } else if (item.type == 'TYPED_VALUE') { - if (!!item.typed_value_cap) { + if (item.typed_value_cap) { defaultValue = item.typed_value_cap.default || null; } } diff --git a/chrome/browser/resources/print_preview/new/preview_area.js b/chrome/browser/resources/print_preview/new/preview_area.js index cf769837acde9b..a975619aa00cc6 100644 --- a/chrome/browser/resources/print_preview/new/preview_area.js +++ b/chrome/browser/resources/print_preview/new/preview_area.js @@ -570,7 +570,7 @@ Polymer({ const newValue = /** @type {!print_preview.MarginsSetting} */ ( this.getSettingValue('customMargins')); - if (!!this.lastCustomMargins_ && + if (this.lastCustomMargins_ && this.lastCustomMargins_.marginTop !== undefined && this.getSettingValue('margins') == print_preview.ticket_items.MarginsTypeValue.CUSTOM && @@ -588,7 +588,7 @@ Polymer({ const newValue = /** @type {!print_preview_new.MediaSizeValue} */ ( this.getSettingValue('mediaSize')); - if (!!this.lastMediaSize_ && + if (this.lastMediaSize_ && (newValue.height_microns != this.lastMediaSize_.height_microns || newValue.width_microns != this.lastMediaSize_.width_microns)) { this.onSettingsChanged_(); diff --git a/chrome/browser/resources/print_preview/new/settings_behavior.js b/chrome/browser/resources/print_preview/new/settings_behavior.js index f85f5b15461e7a..5935aa4ae058db 100644 --- a/chrome/browser/resources/print_preview/new/settings_behavior.js +++ b/chrome/browser/resources/print_preview/new/settings_behavior.js @@ -60,7 +60,7 @@ const SettingsBehavior = { getSetting: function(settingName) { const setting = /** @type {print_preview_new.Setting} */ ( this.get(settingName, this.settings)); - assert(!!setting, 'Setting is missing: ' + settingName); + assert(setting, 'Setting is missing: ' + settingName); return setting; }, diff --git a/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js b/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js index 2ac79b56322660..094f607d63340d 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js +++ b/chrome/browser/resources/settings/autofill_page/passwords_export_dialog.js @@ -125,7 +125,7 @@ Polymer({ // time (|delayedCompletionToken_| is not null) progress should be cached // for consumption when the blocking time ends. const progressBlocked = - !this.progressTaskToken_ && !!this.delayedCompletionToken_; + !this.progressTaskToken_ && this.delayedCompletionToken_; if (!progressBlocked) { clearTimeout(this.progressTaskToken_); this.progressTaskToken_ = null; @@ -245,4 +245,4 @@ Polymer({ this.close(); }, }); -})(); \ No newline at end of file +})(); diff --git a/chrome/browser/resources/settings/device_page/stylus.js b/chrome/browser/resources/settings/device_page/stylus.js index b394aedf27ec38..1ee8863dbdfcf2 100644 --- a/chrome/browser/resources/settings/device_page/stylus.js +++ b/chrome/browser/resources/settings/device_page/stylus.js @@ -141,7 +141,7 @@ Polymer({ * @private */ toggleLockScreenSupport_: function() { - assert(!!this.selectedApp_); + assert(this.selectedApp_); if (this.selectedApp_.lockScreenSupport != settings.NoteAppLockScreenSupport.ENABLED && this.selectedApp_.lockScreenSupport != diff --git a/chrome/browser/resources/settings/internet_page/internet_detail_page.js b/chrome/browser/resources/settings/internet_page/internet_detail_page.js index e9542a6a11c3d1..5d6af27b9670cf 100644 --- a/chrome/browser/resources/settings/internet_page/internet_detail_page.js +++ b/chrome/browser/resources/settings/internet_page/internet_detail_page.js @@ -350,7 +350,7 @@ Polymer({ * @private */ getNetworkDetails_: function() { - assert(!!this.guid); + assert(this.guid); if (this.isSecondaryUser_) { this.networkingPrivate.getState( this.guid, this.getStateCallback_.bind(this)); @@ -434,7 +434,7 @@ Polymer({ return; } - assert(!!this.guid); + assert(this.guid); this.networkingPrivate.setProperties(this.guid, onc, () => { if (chrome.runtime.lastError) { // An error typically indicates invalid input; request the properties diff --git a/chrome/browser/resources/settings/internet_page/internet_page.js b/chrome/browser/resources/settings/internet_page/internet_page.js index 8b500c43d00df2..827a46e169d7f0 100644 --- a/chrome/browser/resources/settings/internet_page/internet_page.js +++ b/chrome/browser/resources/settings/internet_page/internet_page.js @@ -394,7 +394,7 @@ Polymer({ onDeviceStatesChanged_: function(newValue, oldValue) { const wifiDeviceState = this.getDeviceState_(CrOnc.Type.WI_FI, newValue); let managedNetworkAvailable = false; - if (!!wifiDeviceState) { + if (wifiDeviceState) { managedNetworkAvailable = !!wifiDeviceState.ManagedNetworkAvailable; } diff --git a/chrome/browser/resources/settings/internet_page/internet_subpage.js b/chrome/browser/resources/settings/internet_page/internet_subpage.js index 4ca60595eb0f5f..82ddb712e80f13 100644 --- a/chrome/browser/resources/settings/internet_page/internet_subpage.js +++ b/chrome/browser/resources/settings/internet_page/internet_subpage.js @@ -545,6 +545,7 @@ Polymer({ /** * @param {!CrOnc.NetworkStateProperties} state The network state. + * @return {boolean} * @private */ isBlockedByPolicy_: function(state) { diff --git a/chrome/browser/resources/settings/languages_page/languages.js b/chrome/browser/resources/settings/languages_page/languages.js index 2bf2bbd00685fb..5408936fd7e38e 100644 --- a/chrome/browser/resources/settings/languages_page/languages.js +++ b/chrome/browser/resources/settings/languages_page/languages.js @@ -348,10 +348,10 @@ Polymer({ const languageState = this.languages.enabled[i]; this.set( `languages.enabled.${i}.spellCheckEnabled`, - !!spellCheckSet.has(languageState.language.code)); + spellCheckSet.has(languageState.language.code)); this.set( `languages.enabled.${i}.isManaged`, - !!spellCheckForcedSet.has(languageState.language.code)); + spellCheckForcedSet.has(languageState.language.code)); } this.set( @@ -547,11 +547,11 @@ Polymer({ } const languageState = /** @type {LanguageState} */ ({}); languageState.language = language; - languageState.spellCheckEnabled = !!spellCheckSet.has(code); + languageState.spellCheckEnabled = spellCheckSet.has(code); languageState.translateEnabled = this.isTranslateEnabled_( code, !!language.supportsTranslate, translateBlockedSet, translateTarget, prospectiveUILanguage); - languageState.isManaged = !!spellCheckForcedSet.has(code); + languageState.isManaged = spellCheckForcedSet.has(code); languageState.downloadDictionaryFailureCount = 0; enabledLanguageStates.push(languageState); } diff --git a/chrome/browser/resources/settings/people_page/people_page.js b/chrome/browser/resources/settings/people_page/people_page.js index bdff0413abe500..fd39f74b526ae5 100644 --- a/chrome/browser/resources/settings/people_page/people_page.js +++ b/chrome/browser/resources/settings/people_page/people_page.js @@ -494,8 +494,8 @@ Polymer({ * @return {Element|null} */ getAdvancedSyncSettingsAssociatedControl_: function() { - return !!this.unifiedConsentEnabled_ ? this.$$('#sync-setup') : - this.$$('#sync-status'); + return this.unifiedConsentEnabled_ ? this.$$('#sync-setup') : + this.$$('#sync-status'); }, /** diff --git a/chrome/browser/resources/settings/people_page/sync_account_control.js b/chrome/browser/resources/settings/people_page/sync_account_control.js index 0d00c38d41592a..d3f4d1cf275dea 100644 --- a/chrome/browser/resources/settings/people_page/sync_account_control.js +++ b/chrome/browser/resources/settings/people_page/sync_account_control.js @@ -190,7 +190,7 @@ Polymer({ * @private */ getPromoHeaderClass_: function() { - return !!this.subLabel_ ? 'two-line': ''; + return this.subLabel_ ? 'two-line' : ''; }, /** @@ -210,7 +210,7 @@ Polymer({ * @private */ getAccountLabel_: function(label, account) { - if(!!this.unifiedConsentEnabled && !!this.syncStatus.setupInProgress) { + if (this.unifiedConsentEnabled && this.syncStatus.setupInProgress) { return this.syncStatus.statusText || account; } return this.syncStatus.signedIn && !this.syncStatus.hasError && @@ -235,16 +235,16 @@ Polymer({ * @private */ getSyncIconStyle_: function() { - if (!!this.syncStatus.hasUnrecoverableError) { + if (this.syncStatus.hasUnrecoverableError) { return 'sync-problem'; } - if (!!this.syncStatus.hasError) { + if (this.syncStatus.hasError) { return this.syncStatus.statusAction == settings.StatusAction.REAUTHENTICATE ? 'sync-paused' : 'sync-problem'; } - if (!!this.syncStatus.disabled) { + if (this.syncStatus.disabled) { return 'sync-disabled'; } return 'sync'; diff --git a/chrome/browser/resources/settings/people_page/sync_controls.js b/chrome/browser/resources/settings/people_page/sync_controls.js index 5ba595a4a03eec..c3642e29af1ed9 100644 --- a/chrome/browser/resources/settings/people_page/sync_controls.js +++ b/chrome/browser/resources/settings/people_page/sync_controls.js @@ -171,8 +171,8 @@ Polymer({ // Navigate to main sync page when the sync controls page should *not* be // available. - if (!syncStatus.signedIn || !!syncStatus.disabled || - (!!syncStatus.hasError && + if (!syncStatus.signedIn || syncStatus.disabled || + (syncStatus.hasError && syncStatus.statusAction !== settings.StatusAction.ENTER_PASSPHRASE)) { settings.navigateTo(settings.routes.SYNC); } diff --git a/chrome/browser/resources/settings/people_page/sync_page.js b/chrome/browser/resources/settings/people_page/sync_page.js index ae8ffa13afe80a..98bb18b5b9104e 100644 --- a/chrome/browser/resources/settings/people_page/sync_page.js +++ b/chrome/browser/resources/settings/people_page/sync_page.js @@ -295,7 +295,7 @@ Polymer({ // When the user is about to cancel the sync setup, but hasn't confirmed // the cancellation, navigate back and show the 'Cancel sync?' dialog. if (this.unifiedConsentEnabled && this.syncStatus && - !!this.syncStatus.setupInProgress && this.didAbort_ && + this.syncStatus.setupInProgress && this.didAbort_ && !this.setupCancelConfirmed_) { chrome.metricsPrivate.recordUserAction( 'Signin_Signin_BackOnAdvancedSyncSettings'); @@ -346,7 +346,7 @@ Polymer({ // When the user tries to leave the sync setup, show the 'Leave site' // dialog. if (this.unifiedConsentEnabled && this.syncStatus && - !!this.syncStatus.setupInProgress) { + this.syncStatus.setupInProgress) { event.preventDefault(); event.returnValue = ''; diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js index 8d46e3b0d72a50..74f3bc6b704e14 100644 --- a/chrome/browser/resources/settings/route.js +++ b/chrome/browser/resources/settings/route.js @@ -528,7 +528,7 @@ cr.define('settings', function() { Object.keys(this.routes_) .find((key) => this.routes_[key].path == canonicalPath); - return !!matchingKey ? this.routes_[matchingKey] : null; + return matchingKey ? this.routes_[matchingKey] : null; } /** diff --git a/chrome/browser/resources/settings/settings_page/settings_animated_pages.js b/chrome/browser/resources/settings/settings_page/settings_animated_pages.js index df3e811554b0fc..4f0bd127e1a098 100644 --- a/chrome/browser/resources/settings/settings_page/settings_animated_pages.js +++ b/chrome/browser/resources/settings/settings_page/settings_animated_pages.js @@ -61,9 +61,9 @@ Polymer({ // 1) Not a direct navigation (such that the search box stays focused), and // 2) Not a "back" navigation, in which case the anchor element should be // focused (further below in this function). - if (!!this.previousRoute_ && !settings.lastRouteChangeWasPopstate()) { + if (this.previousRoute_ && !settings.lastRouteChangeWasPopstate()) { const subpage = this.querySelector('settings-subpage.iron-selected'); - if (!!subpage) { + if (subpage) { subpage.initialFocus(); return; } diff --git a/chrome/browser/resources/settings/settings_page/settings_subpage.js b/chrome/browser/resources/settings/settings_page/settings_subpage.js index 132cfcbf6c80b0..13a61bdfe08751 100644 --- a/chrome/browser/resources/settings/settings_page/settings_subpage.js +++ b/chrome/browser/resources/settings/settings_page/settings_subpage.js @@ -64,7 +64,7 @@ Polymer({ /** @override */ attached: function() { - if (!!this.searchLabel) { + if (this.searchLabel) { // |searchLabel| should not change dynamically. this.listen(this, 'clear-subpage-search', 'onClearSubpageSearch_'); } @@ -72,7 +72,7 @@ Polymer({ /** @override */ detached: function() { - if (!!this.searchLabel) { + if (this.searchLabel) { // |searchLabel| should not change dynamically. this.unlisten(this, 'clear-subpage-search', 'onClearSubpageSearch_'); } diff --git a/chrome/test/data/webui/print_preview/cloud_print_interface_stub.js b/chrome/test/data/webui/print_preview/cloud_print_interface_stub.js index ba88658a24cb8c..0e68050dd851cc 100644 --- a/chrome/test/data/webui/print_preview/cloud_print_interface_stub.js +++ b/chrome/test/data/webui/print_preview/cloud_print_interface_stub.js @@ -95,7 +95,7 @@ cr.define('print_preview', function() { this.initialized_ = true; } } - if (!!printer) { + if (printer) { printer.capabilities = print_preview_test_utils.getCddTemplate(printerId); this.eventTarget_.dispatchEvent(new CustomEvent( diff --git a/ui/webui/resources/js/cr/ui/focus_row_behavior.js b/ui/webui/resources/js/cr/ui/focus_row_behavior.js index dab933ddea43c3..66ddbf96465e9c 100644 --- a/ui/webui/resources/js/cr/ui/focus_row_behavior.js +++ b/ui/webui/resources/js/cr/ui/focus_row_behavior.js @@ -125,7 +125,7 @@ cr.define('cr.ui', function() { Polymer.RenderStatus.afterNextRender(this, function() { const rowContainer = this.root.querySelector('[focus-row-container]'); - assert(!!rowContainer); + assert(rowContainer); this.row_ = new VirtualFocusRow( rowContainer, new FocusRowBehaviorDelegate(this)); this.ironListTabIndexChanged_(); diff --git a/ui/webui/resources/js/cr/ui/menu.js b/ui/webui/resources/js/cr/ui/menu.js index 7d320f508b1726..bdc855eaede26d 100644 --- a/ui/webui/resources/js/cr/ui/menu.js +++ b/ui/webui/resources/js/cr/ui/menu.js @@ -199,7 +199,7 @@ cr.define('cr.ui', function() { if (menuItem.hidden) { return false; } - if (!!menuItem.offsetParent) { + if (menuItem.offsetParent) { return true; } // A "position: fixed" element won't have an offsetParent, so we have to