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

Commit

Permalink
Fix issue where tabs opened via `right click > open in new private ta…
Browse files Browse the repository at this point in the history
…b` were not opening in a private tab.

During app/browser/tab::create(), `isPrivate` is set to true. However, there is no partition set.
If this is missing, I believe the code is checking the opener (which is not correct in this case).

When handler `add-new-contents` fired, the `incognito` property was always set to false. Partition `default`
seems to match picking "New private tab" from file menu and hitting + button > New private tab in tabs bar

After review by @bbondy, this also makes sure to assign partition if isPartitioned/partitionNumber are set (same conditions as checked in getPartition)

Fixes #8271

Auditors: @bbondy, @bridiver

Test Plan:
1. Go to https://slashdot.org/
2. Right click any link and pick (from the context menu) `Open Link in New Private Tab`
3. Confirm tab that opens is private
4. Close private tab, go back to slashdot.org
5. Right click a link and pick (from the context menu) `Open Link in New Session Tab`
6. Go back to slashdot.org and repeat step 5
7. You should now have two session tabs opened, each with a different ID
  • Loading branch information
bsclifton committed Apr 13, 2017
1 parent bc3259a commit 48e66c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ const getPartition = (createProperties) => {
return partition
}

const needsPartitionAssigned = (createProperties) => {
return !createProperties.openerTabId ||
createProperties.isPrivate ||
createProperties.isPartitioned ||
createProperties.partitionNumber ||
createProperties.partition
}

const api = {
init: (state, action) => {
process.on('open-url-from-tab', (e, source, targetUrl, disposition) => {
Expand Down Expand Up @@ -370,7 +378,7 @@ const api = {
createProperties.url = newFrameUrl()
}
createProperties.url = normalizeUrl(createProperties.url)
if (!createProperties.openerTabId) {
if (needsPartitionAssigned(createProperties)) {
createProperties.partition = getPartition(createProperties)
if (isSessionPartition(createProperties.partition)) {
createProperties.parent_partition = ''
Expand Down

0 comments on commit 48e66c5

Please sign in to comment.