From 1ae0c8beacb186f03960b421ac04cbd77c9c9928 Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Tue, 4 Apr 2017 00:17:01 +0200 Subject: [PATCH] Linter fixes Resolves #8061 --- app/browser/ads/adBlockUtil.js | 29 +++++++++++++------ app/localShortcuts.js | 20 ++++++------- .../preferences/payment/ledgerTable.js | 1 - js/stores/eventStore.js | 2 +- test/unit/about/newTabPageTest.js | 3 +- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/browser/ads/adBlockUtil.js b/app/browser/ads/adBlockUtil.js index 0b28a69e308..c054af5f5b0 100644 --- a/app/browser/ads/adBlockUtil.js +++ b/app/browser/ads/adBlockUtil.js @@ -31,16 +31,27 @@ const mapFilterType = { const shouldDoAdBlockCheck = (resourceType, firstPartyUrl, url, shouldCheckMainFrame) => firstPartyUrl.protocol && // By default first party hosts are allowed, but enable the check if a flag is specified in siteHacks + ( shouldCheckMainFrame || - (resourceType !== 'mainFrame' && - isThirdPartyHost(firstPartyUrl.hostname || '', url.hostname) || - siteHacks[firstPartyUrl.hostname] && siteHacks[firstPartyUrl.hostname].allowFirstPartyAdblockChecks) && - // Only check http and https for now - firstPartyUrl.protocol.startsWith('http') && - // Only do adblock if the host isn't in the whitelist - !whitelistHosts.find((whitelistHost) => whitelistHost === url.hostname || url.hostname.endsWith('.' + whitelistHost)) && - // Make sure there's a valid resource type before trying to use adblock - mapFilterType[resourceType] !== undefined + ( + ( + ( + resourceType !== 'mainFrame' && + isThirdPartyHost(firstPartyUrl.hostname || '', url.hostname) + ) || + ( + siteHacks[firstPartyUrl.hostname] && + siteHacks[firstPartyUrl.hostname].allowFirstPartyAdblockChecks + ) + ) && + // Only check http and https for now + firstPartyUrl.protocol.startsWith('http') && + // Only do adblock if the host isn't in the whitelist + !whitelistHosts.find((whitelistHost) => whitelistHost === url.hostname || url.hostname.endsWith('.' + whitelistHost)) && + // Make sure there's a valid resource type before trying to use adblock + mapFilterType[resourceType] !== undefined + ) + ) module.exports = { mapFilterType, diff --git a/app/localShortcuts.js b/app/localShortcuts.js index f285cb01316..06d3a8501df 100644 --- a/app/localShortcuts.js +++ b/app/localShortcuts.js @@ -42,18 +42,18 @@ module.exports.register = (win) => { } else { // Different shorcut for View Source as is common for Chrome/Safari on macOS // See #7702 + simpleWebContentEvents.push( + ['Cmd+Alt+U', messages.SHORTCUT_ACTIVE_FRAME_VIEW_SOURCE] + ) + + if (process.env.NODE_ENV !== 'development') { + // We're in Darwin and release or test mode... + // We disable for development mode because Browser level dev tools copy doesn't work. + // Workaround for #1060 simpleWebContentEvents.push( - ['Cmd+Alt+U', messages.SHORTCUT_ACTIVE_FRAME_VIEW_SOURCE] + ['Cmd+C', messages.SHORTCUT_ACTIVE_FRAME_COPY] ) - - if (process.env.NODE_ENV !== 'development') { - // We're in Darwin and release or test mode... - // We disable for development mode because Browser level dev tools copy doesn't work. - // Workaround for #1060 - simpleWebContentEvents.push( - ['Cmd+C', messages.SHORTCUT_ACTIVE_FRAME_COPY] - ) - } + } } // Tab ordering shortcuts diff --git a/app/renderer/components/preferences/payment/ledgerTable.js b/app/renderer/components/preferences/payment/ledgerTable.js index 6bfae1cdc52..a366e7e8651 100644 --- a/app/renderer/components/preferences/payment/ledgerTable.js +++ b/app/renderer/components/preferences/payment/ledgerTable.js @@ -27,7 +27,6 @@ const aboutActions = require('../../../../../js/about/aboutActions') const {SettingCheckbox, SiteSettingCheckbox} = require('../../settings') class LedgerTable extends ImmutableComponent { - get synopsis () { return this.props.ledgerData.get('synopsis') } diff --git a/js/stores/eventStore.js b/js/stores/eventStore.js index 27face354dd..8b03a2eb279 100644 --- a/js/stores/eventStore.js +++ b/js/stores/eventStore.js @@ -54,7 +54,7 @@ const addPageView = (url, tabId) => { tab.isDestroyed() || !tab.session.partition.startsWith('persist:') - if (url && isSourceAboutUrl(url) || isPrivate) { + if (url && (isSourceAboutUrl(url) || isPrivate)) { url = null } diff --git a/test/unit/about/newTabPageTest.js b/test/unit/about/newTabPageTest.js index 632576af26c..7d2a086c144 100644 --- a/test/unit/about/newTabPageTest.js +++ b/test/unit/about/newTabPageTest.js @@ -109,7 +109,8 @@ describe('NewTab component unit tests', function () { describe('randomBackgroundImage', function () { it('calls random to get a random index', function () { randomSpy.reset() - wrapper.instance().randomBackgroundImage + const result = wrapper.instance().randomBackgroundImage + assert.notEqual(result, undefined) assert.equal(randomSpy.calledOnce, true) })