-
Notifications
You must be signed in to change notification settings - Fork 973
More robust next tab selection after closing an active tab #12193
Conversation
d2db4c6
to
dd96de6
Compare
dd96de6
to
bf11d30
Compare
bf11d30
to
0acef5a
Compare
0acef5a
to
30dc2f1
Compare
@@ -0,0 +1,57 @@ | |||
// static |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we put the standard preamble at the top of this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, and rebased
const {app, BrowserWindow, extensions, session, ipcMain} = require('electron') | ||
const {makeImmutable, makeJS} = require('../common/state/immutableUtil') | ||
const {getTargetAboutUrl, getSourceAboutUrl, isSourceAboutUrl, newFrameUrl, isTargetAboutUrl, isIntermediateAboutPage, isTargetMagnetUrl, getSourceMagnetUrl} = require('../../js/lib/appUrlUtil') | ||
const {isURL, getUrlFromInput, toPDFJSLocation, getDefaultFaviconUrl, isHttpOrHttps, getLocationIfPDF} = require('../../js/lib/urlutil') | ||
const {isSessionPartition} = require('../../js/state/frameStateUtil') | ||
const {getOrigin} = require('../../js/lib/urlutil') | ||
const {getSetting} = require('../../js/settings') | ||
const settingsStore = require('../../js/settings') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason for changing this? (just curious - I didn't see any other functions from settingsStore being called)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bsclifton I changed this so I could register a stub for getSetting
. I couldn't see another way to do it unfortunately, but if there's a way to do it whilst preserving the ability to directly reference the child function of the settingsStore
object in the module, I'd be keen to learn. The function is stubbed with the following:
+ this.stubGetSettings = sinon.stub(this.settings, 'getSetting',
+ (settingKey, settingsCollection, value) => {
+ if (settingKey === settings.TAB_CLOSE_ACTION) {
+ return tabCloseSettingValue
+ }
+ return false
+ }
+ )
+ })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left two questions- otherwise looks great 😄 I ran through STR for both issues and confirmed it works as expected. Code looks great too! Nice to have all the logic in app/browser/tabs
now (instead of being split up)
30dc2f1
to
b714140
Compare
Codecov Report
@@ Coverage Diff @@
## master #12193 +/- ##
==========================================
- Coverage 55.36% 55.07% -0.29%
==========================================
Files 276 277 +1
Lines 26764 26803 +39
Branches 4315 4325 +10
==========================================
- Hits 14819 14763 -56
- Misses 11945 12040 +95
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 😄 👍
More robust next tab selection after closing an active tab
Set next active tab before closing, instead of after. Avoids race-condition with muon's index-change and active-change tab update events.
Fix #11981
Fix #11526
Notable changes:
Submitter Checklist:
git rebase -i
to squash commits (if needed).Test Plan:
Automatic Tests
npm run unittest -- --grep "tabs API"
Manual Tests
Manual steps (perform on all platforms since this bug was timing-specific and affected Windows mostly).
All automatic tab active changes should be observed as immediate, without visually seeing one tab become active and then quickly another tab getting focus.
Parent tab
Next tab
Last active tab
Detached parent tab
Reviewer Checklist:
Tests