Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Don't allow tab preview after close if config is off
Browse files Browse the repository at this point in the history
Fix #9536
Auditors: @bsclifton
  • Loading branch information
cezaraugusto committed Jun 17, 2017
1 parent 2bc6b7f commit 43cbd50
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/renderer/reducers/frameReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const frameStateUtil = require('../../../js/state/frameStateUtil')
const {getCurrentWindowId} = require('../currentWindow')
const {getSourceAboutUrl, getSourceMagnetUrl} = require('../../../js/lib/appUrlUtil')
const {isURL, isPotentialPhishingUrl, getUrlFromInput} = require('../../../js/lib/urlutil')
const settings = require('../../../js/constants/settings')
const {getSetting} = require('../../../js/settings')

const setFullScreen = (state, action) => {
const index = frameStateUtil.getFrameIndex(state, action.frameProps.get('key'))
Expand All @@ -37,6 +39,7 @@ const closeFrame = (state, action) => {

const frameProps = frameStateUtil.getFrameByKey(state, action.frameKey)
const hoverState = state.getIn(['frames', index, 'hoverState'])
const framePreviewEnabled = getSetting(settings.SHOW_TAB_PREVIEWS)

state = state.merge(frameStateUtil.removeFrame(
state,
Expand All @@ -52,14 +55,14 @@ const closeFrame = (state, action) => {

const nextFrame = frameStateUtil.getFrameByIndex(state, index)

if (nextFrame) {
// After closing a tab, preview the next frame as long as there is one
windowActions.setPreviewFrame(nextFrame.get('key'))
if (nextFrame && hoverState) {
// Copy the hover state if tab closed with mouse as long as we have a next frame
// This allow us to have closeTab button visible for sequential frames closing,
// until onMouseLeave event happens.
if (hoverState) {
windowActions.setTabHoverState(nextFrame.get('key'), hoverState)
windowActions.setTabHoverState(nextFrame.get('key'), hoverState)
if (framePreviewEnabled && index !== nextFrame) {
// After closing a tab, preview the next frame as long as there is one
windowActions.setPreviewFrame(nextFrame.get('key'))
}
}

Expand Down

0 comments on commit 43cbd50

Please sign in to comment.