Skip to content

Commit

Permalink
Fix for #781
Browse files Browse the repository at this point in the history
  • Loading branch information
deanoemcke committed Nov 14, 2018
1 parent a047151 commit e2d748c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/js/gsSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,22 +385,30 @@ var gsSession = (function() {
// Match against all tabIds from last session here, not just non-extension tabs
// as there is a chance during tabInitialisation of a suspended tab getting reloaded
// directly and hence keeping its tabId (ie: file:// tabs)
function matchingTabExists(tab) {
if (tab.url.indexOf('chrome://newtab') === 0 && tab.index === 0)
return false;
return lastSessionTabs.some(o => o.id === tab.id && o.url === tab.url);
}
const matchingTabIdsCount = currentSessionNonExtensionTabs.reduce(
(a, o) => (lastSessionTabs.some(p => p.id === o.id) ? a + 1 : a),
(a, o) => (matchingTabExists(o) ? a + 1 : a),
0
);
const maxTabCount = Math.max(
const maxMatchableTabsCount = Math.max(
lastSessionNonExtensionTabs.length,
currentSessionNonExtensionTabs.length
);
gsUtils.log(
'gsSession',
matchingTabIdsCount +
' / ' +
maxTabCount +
maxMatchableTabsCount +
' tabs have the same id between the last session and the current session.'
);
if (maxTabCount - matchingTabIdsCount > 1) {
if (
matchingTabIdsCount === 0 ||
maxMatchableTabsCount - matchingTabIdsCount > 1
) {
gsUtils.log('gsSession', 'Aborting tab recovery. Tab IDs do not match.');
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_ext_extension_name__",
"description": "__MSG_ext_extension_description__",
"version": "7.0.142",
"version": "7.0.143",
"default_locale": "en",
"permissions": [
"tabs",
Expand Down

0 comments on commit e2d748c

Please sign in to comment.