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

"Select its parent tab" setting now works as expected #9400

Merged
merged 2 commits into from
Jun 16, 2017
Merged

"Select its parent tab" setting now works as expected #9400

merged 2 commits into from
Jun 16, 2017

Conversation

bsclifton
Copy link
Member

"Select its parent tab" setting now works as expected

  • Properly get openerTabId; it's located in the frame (not the tab)
  • Don't consider if tab was active or not

Fixes #9395

Auditors: @bridiver, @BrendanEich

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@bsclifton bsclifton added this to the 0.17.x (Frozen, only critical adds from here) milestone Jun 12, 2017
@bsclifton bsclifton self-assigned this Jun 12, 2017
@bsclifton
Copy link
Member Author

Requires brave/muon#214 before this can be merged

- Don't consider if tab was active or not
- Validate tabId before returning

requires brave/muon#214
Fixes #9395

Auditors: @bridiver, @BrendanEich
@bsclifton
Copy link
Member Author

ping @bridiver

const openerTabId = tabState.getTabPropertyByTabId(state, tabId, 'openerTabId', tabState.TAB_ID_NONE)
if (openerTabId !== tabState.TAB_ID_NONE) {
// Validate that tabId exists
const index = getTabInternalIndexByTabId(state, openerTabId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably use getByTabId here and it already handles TAB_ID_NONE by returning null. getTabInternalIndex is just a temporary hack until we can re-organize the tab state so best to limit its usage to the smallest set of methods possible

@@ -51,15 +51,14 @@ const updateActiveTab = (state, closeTabId) => {
case tabCloseAction.PARENT:
{
const openerTabId = tabState.getOpenerTabId(state, closeTabId)
const lastActiveTabId = tabState.getLastActiveTabId(state, windowId)
if (openerTabId === lastActiveTabId) {
if (openerTabId && openerTabId !== tabState.TAB_ID_NONE) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the null check here necessary?

Copy link
Collaborator

@bridiver bridiver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ a few nits, but lgtm

@bsclifton
Copy link
Member Author

nits fixed 😄 merging

@bsclifton bsclifton merged commit bf34c40 into brave:master Jun 16, 2017
@bsclifton bsclifton deleted the fix-close-tab-behavior branch June 16, 2017 00:01
bsclifton added a commit that referenced this pull request Jun 16, 2017
"Select its parent tab" setting now works as expected
bsclifton added a commit that referenced this pull request Jun 16, 2017
"Select its parent tab" setting now works as expected
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants