diff --git a/app/browser/menu.js b/app/browser/menu.js index 27a3b01f4a0..c7df374b941 100644 --- a/app/browser/menu.js +++ b/app/browser/menu.js @@ -36,7 +36,9 @@ const menuUtil = require('../common/lib/menuUtil') const {getSetting} = require('../../js/settings') const locale = require('../locale') const {isLocationBookmarked} = require('../../js/state/siteUtil') -const {isDarwin, isLinux} = require('../common/lib/platformUtil') +const platformUtil = require('../common/lib/platformUtil') +const isDarwin = platformUtil.isDarwin() +const isLinux = platformUtil.isLinux() let appMenu = null let closedFrames = new Immutable.OrderedMap() diff --git a/app/common/lib/platformUtil.js b/app/common/lib/platformUtil.js index 7a79b1a89a3..a1b75065875 100644 --- a/app/common/lib/platformUtil.js +++ b/app/common/lib/platformUtil.js @@ -35,12 +35,12 @@ module.exports.getPathFromFileURI = (fileURI) => { module.exports.isDarwin = () => { return process.platform === 'darwin' || - navigator.platform === 'MacIntel' + (navigator && navigator.platform === 'MacIntel') } module.exports.isWindows = () => { return process.platform === 'win32' || - navigator.platform === 'Win32' + (navigator && navigator.platform === 'Win32') } module.exports.isLinux = () => { diff --git a/app/common/state/menuBarState.js b/app/common/state/menuBarState.js index 9da54ae3374..37d2952ab3b 100644 --- a/app/common/state/menuBarState.js +++ b/app/common/state/menuBarState.js @@ -2,13 +2,13 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -const {isWindows} = require('../lib/platformUtil') +const isWindows = require('../lib/platformUtil').isWindows() const {getSetting} = require('../../../js/settings') const settings = require('../../../js/constants/settings') const api = { isMenuBarVisible: (windowState) => { - return isWindows() && (!getSetting(settings.AUTO_HIDE_MENU) || windowState.getIn(['ui', 'menubar', 'isVisible'])) + return isWindows && (!getSetting(settings.AUTO_HIDE_MENU) || windowState.getIn(['ui', 'menubar', 'isVisible'])) } } diff --git a/app/renderer/components/bookmarks/bookmarksToolbar.js b/app/renderer/components/bookmarks/bookmarksToolbar.js index 17f5f009247..a1016f44d91 100644 --- a/app/renderer/components/bookmarks/bookmarksToolbar.js +++ b/app/renderer/components/bookmarks/bookmarksToolbar.js @@ -29,7 +29,7 @@ const contextMenus = require('../../../../js/contextMenus') const cx = require('../../../../js/lib/classSet') const dnd = require('../../../../js/dnd') const dndData = require('../../../../js/dndData') -const {isWindows} = require('../../../common/lib/platformUtil') +const isWindows = require('../../../common/lib/platformUtil').isWindows() const frameStateUtil = require('../../../../js/state/frameStateUtil') const bookmarkUtil = require('../../../common/lib/bookmarkUtil') @@ -145,7 +145,7 @@ class BookmarksToolbar extends React.Component { props.showOnlyFavicon = bookmarkUtil.showOnlyFavicon() props.showFavicon = bookmarkUtil.showFavicon() props.shouldAllowWindowDrag = windowState.shouldAllowWindowDrag(state, currentWindow, activeFrame, isFocused()) && - !isWindows() + !isWindows props.visibleBookmarks = bookmarks.visibleBookmarks props.hiddenBookmarks = bookmarks.hiddenBookmarks diff --git a/app/renderer/components/main/main.js b/app/renderer/components/main/main.js index abbddd338fb..5504295141d 100644 --- a/app/renderer/components/main/main.js +++ b/app/renderer/components/main/main.js @@ -66,7 +66,10 @@ const cx = require('../../../../js/lib/classSet') const eventUtil = require('../../../../js/lib/eventUtil') const {isSourceAboutUrl} = require('../../../../js/lib/appUrlUtil') const {getCurrentWindowId, isMaximized, isFocused, isFullScreen} = require('../../currentWindow') -const {isDarwin, isWindows, isLinux} = require('../../../common/lib/platformUtil') +const platformUtil = require('../../../common/lib/platformUtil') +const isDarwin = platformUtil.isDarwin() +const isWindows = platformUtil.isWindows() +const isLinux = platformUtil.isLinux() class Main extends React.Component { constructor (props) { @@ -85,7 +88,7 @@ class Main extends React.Component { this.exitFullScreen() break case keyCodes.F12: - if (!isDarwin()) { + if (!isDarwin) { ipc.emit(messages.SHORTCUT_ACTIVE_FRAME_TOGGLE_DEV_TOOLS) } break @@ -530,7 +533,7 @@ class Main extends React.Component { // used in renderer props.isFullScreen = activeFrame.get('isFullScreen', false) props.isMaximized = isMaximized() || isFullScreen() - props.captionButtonsVisible = isWindows() + props.captionButtonsVisible = isWindows props.showContextMenu = !!currentWindow.get('contextMenuDetail') props.showPopupWindow = !!currentWindow.get('popupWindowDetail') props.showSiteInfo = currentWindow.getIn(['ui', 'siteInfo', 'isVisible']) && @@ -539,7 +542,7 @@ class Main extends React.Component { !!currentWindow.get('braveryPanelDetail') props.showClearData = !!currentWindow.getIn(['ui', 'isClearBrowsingDataPanelVisible']) props.showImportData = !!currentWindow.get('importBrowserDataDetail') - props.showWidevine = currentWindow.getIn(['widevinePanelDetail', 'shown']) && !isLinux() + props.showWidevine = currentWindow.getIn(['widevinePanelDetail', 'shown']) && !isLinux props.showAutoFillAddress = !!currentWindow.get('autofillAddressDetail') props.showAutoFillCC = !!currentWindow.get('autofillCreditCardDetail') props.showLogin = !!loginRequiredDetails @@ -568,7 +571,7 @@ class Main extends React.Component { // used in other functions props.menubarSelectedIndex = currentWindow.getIn(['ui', 'menubar', 'selectedIndex']) - props.showCustomTitleBar = isWindows() + props.showCustomTitleBar = isWindows props.menubarVisible = menuBarState.isMenuBarVisible(currentWindow) props.mouseInFrame = currentWindow.getIn(['ui', 'mouseInFrame']) props.braveShieldEnabled = shieldState.braveShieldsEnabled(activeFrame) diff --git a/app/renderer/components/main/siteInfo.js b/app/renderer/components/main/siteInfo.js index ae16ba4de62..a333093be3c 100644 --- a/app/renderer/components/main/siteInfo.js +++ b/app/renderer/components/main/siteInfo.js @@ -23,7 +23,7 @@ const tabState = require('../../../common/state/tabState') const cx = require('../../../../js/lib/classSet') const {isPotentialPhishingUrl} = require('../../../../js/lib/urlutil') const siteUtil = require('../../../../js/state/siteUtil') -const platformUtil = require('../../../common/lib/platformUtil') +const isLinux = require('../../../common/lib/platformUtil').isLinux() const frameStateUtil = require('../../../../js/state/frameStateUtil') // Styles @@ -135,7 +135,7 @@ class SiteInfo extends React.Component { get viewCertificateButton () { // TODO(Anthony): Hide it until muon support linux - if (!platformUtil.isLinux()) { + if (!isLinux) { return