From 5d30039ce59e91bd2af3ad2b82cc343a771fc607 Mon Sep 17 00:00:00 2001 From: Steven Yuan Date: Fri, 22 Sep 2017 00:05:58 -0700 Subject: [PATCH] Remove perWindowState from immutableData if there are no frames in it Fix #10768 --- app/sessionStore.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/sessionStore.js b/app/sessionStore.js index b6dd3417a59..b877e4f00a7 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -39,7 +39,7 @@ const autofill = require('./autofill') const {navigatableTypes} = require('../js/lib/appUrlUtil') const Channel = require('./channel') const BuildConfig = require('./buildConfig') -const {isImmutable, makeImmutable, deleteImmutablePaths} = require('./common/state/immutableUtil') +const {isImmutable, isMap, makeImmutable, deleteImmutablePaths} = require('./common/state/immutableUtil') const {getSetting} = require('../js/settings') const platformUtil = require('./common/lib/platformUtil') const historyUtil = require('./common/lib/historyUtil') @@ -430,6 +430,19 @@ module.exports.cleanAppData = (immutableData, isShutdown) => { immutableData = immutableData.deleteIn(['ledger', 'locations']) } + // Remove windowState from perWindowState if there are no frames + if (perWindowStateList) { + perWindowStateList.forEach((immutablePerWindowState, i) => { + if (isMap(immutablePerWindowState)) { + if (immutablePerWindowState.has('frames')) { + if (!immutablePerWindowState.get('frames').size) { + immutableData = immutableData.deleteIn(['perWindowState', i]) + } + } + } + }) + } + return immutableData }