diff --git a/app/renderer/components/main/main.js b/app/renderer/components/main/main.js index 350c4accb90..4e16136404a 100644 --- a/app/renderer/components/main/main.js +++ b/app/renderer/components/main/main.js @@ -67,6 +67,7 @@ const cx = require('../../../../js/lib/classSet') const eventUtil = require('../../../../js/lib/eventUtil') const siteSettings = require('../../../../js/state/siteSettings') const debounce = require('../../../../js/lib/debounce') +const {isSourceAboutUrl} = require('../../../../js/lib/appUrlUtil') const {getCurrentWindowId, isMaximized, isFocused, isFullScreen} = require('../../currentWindow') const {isDarwin, isWindows} = require('../../../common/lib/platformUtil') @@ -687,7 +688,7 @@ class Main extends ImmutableComponent { const btbMode = getSetting(settings.BOOKMARKS_TOOLBAR_MODE) const showFavicon = (btbMode === bookmarksToolbarMode.TEXT_AND_FAVICONS || btbMode === bookmarksToolbarMode.FAVICONS_ONLY) const showOnlyFavicon = btbMode === bookmarksToolbarMode.FAVICONS_ONLY - const siteInfoIsVisible = this.props.windowState.getIn(['ui', 'siteInfo', 'isVisible']) + const siteInfoIsVisible = this.props.windowState.getIn(['ui', 'siteInfo', 'isVisible']) && !isSourceAboutUrl(activeFrame.get('location')) const braveryPanelIsVisible = shieldState.braveShieldsEnabled(activeFrame) && this.props.windowState.get('braveryPanelDetail') const clearBrowsingDataPanelIsVisible = this.props.windowState.getIn(['ui', 'isClearBrowsingDataPanelVisible']) diff --git a/app/renderer/components/main/siteInfo.js b/app/renderer/components/main/siteInfo.js index 545d4367bc6..7870c2154d8 100644 --- a/app/renderer/components/main/siteInfo.js +++ b/app/renderer/components/main/siteInfo.js @@ -3,235 +3,250 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ const React = require('react') -const PropTypes = require('prop-types') +const Immutable = require('immutable') const {StyleSheet, css} = require('aphrodite/no-important') // Components -const ImmutableComponent = require('../immutableComponent') +const ReduxComponent = require('../reduxComponent') const Dialog = require('../common/dialog') const Button = require('../common/button') // Actions const appActions = require('../../../../js/actions/appActions') const webviewActions = require('../../../../js/actions/webviewActions') +const windowActions = require('../../../../js/actions/windowActions') + +// State +const tabState = require('../../../common/state/tabState') // Utils const cx = require('../../../../js/lib/classSet') const {isPotentialPhishingUrl} = require('../../../../js/lib/urlutil') -const {isSourceAboutUrl} = require('../../../../js/lib/appUrlUtil') const siteUtil = require('../../../../js/state/siteUtil') const platformUtil = require('../../../common/lib/platformUtil') +const frameStateUtil = require('../../../../js/state/frameStateUtil') // Styles const globalStyles = require('../styles/global') const commonStyles = require('../styles/commonStyles') -class SiteInfo extends ImmutableComponent { - constructor () { - super() +class SiteInfo extends React.Component { + constructor (props) { + super(props) this.onAllowRunInsecureContent = this.onAllowRunInsecureContent.bind(this) this.onDenyRunInsecureContent = this.onDenyRunInsecureContent.bind(this) this.onViewCertificate = this.onViewCertificate.bind(this) } + onAllowRunInsecureContent () { - appActions.changeSiteSetting(siteUtil.getOrigin(this.location), - 'runInsecureContent', true, this.isPrivate) - appActions.loadURLRequested(this.props.frameProps.get('tabId'), this.location) - this.props.onHide() + appActions.changeSiteSetting(siteUtil.getOrigin(this.props.location), + 'runInsecureContent', true, this.props.isPrivate) + appActions.loadURLRequested(this.props.activeTabId, this.props.location) + this.onHide() } + onDenyRunInsecureContent () { - appActions.removeSiteSetting(siteUtil.getOrigin(this.location), - 'runInsecureContent', this.isPrivate) - appActions.loadURLRequested(this.props.frameProps.get('tabId'), this.location) - this.props.onHide() + appActions.removeSiteSetting(siteUtil.getOrigin(this.props.location), + 'runInsecureContent', this.props.isPrivate) + appActions.loadURLRequested(this.props.activeTabId, this.props.location) + this.onHide() } + onViewCertificate () { - this.props.onHide() + this.onHide() webviewActions.showCertificate() } - get isExtendedValidation () { - return this.props.frameProps.getIn(['security', 'isExtendedValidation']) - } - get isSecure () { - return this.props.frameProps.getIn(['security', 'isSecure']) - } - get isPrivate () { - return this.props.frameProps.getIn(['isPrivate']) - } - get runInsecureContent () { - return this.props.frameProps.getIn(['security', 'runInsecureContent']) - } - get isBlockedRunInsecureContent () { - return this.props.frameProps.getIn(['security', 'blockedRunInsecureContent']) - } - get partitionNumber () { - return this.props.frameProps.getIn(['partitionNumber']) - } - get location () { - return this.props.frameProps.getIn(['location']) - } - get maybePhishingLocation () { - return isPotentialPhishingUrl(this.props.frameProps.getIn(['location'])) - } - render () { - if (isSourceAboutUrl(this.location)) { - return null - } - // Figure out the partition info display - let l10nArgs = { - partitionNumber: this.partitionNumber - } + onHide () { + windowActions.setSiteInfoVisible(false) + } - let secureIcon - if (this.isSecure === true && !this.runInsecureContent) { + get secureIcon () { + if (this.props.isFullySecured) { // fully secure - secureIcon = -