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

Commit

Permalink
Preserve session/private for open image
Browse files Browse the repository at this point in the history
Auditors: @diracdeltas

Fix #2746
  • Loading branch information
bbondy committed Jul 28, 2016
1 parent cb3c161 commit 066adc4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
8 changes: 6 additions & 2 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,16 @@ class Main extends ImmutableComponent {
const activeFrame = FrameStateUtil.getActiveFrame(self.props.windowState)

let openInForeground = getSetting(settings.SWITCH_TO_NEW_TABS) === true || options.openInForeground
windowActions.newFrame({
const frameOpts = {
location: url || config.defaultUrl,
isPrivate: !!options.isPrivate,
isPartitioned: !!options.isPartitioned,
parentFrameKey: activeFrame.get('key')
}, openInForeground)
}
if (options.partitionNumber !== undefined) {
frameOpts.partitionNumber = options.partitionNumber
}
windowActions.newFrame(frameOpts, openInForeground)
})

ipc.on(messages.NEW_POPUP_WINDOW, function (evt, extensionId, src, props) {
Expand Down
2 changes: 1 addition & 1 deletion js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ function mainTemplateInit (nodeProps, frame) {
click: (item, focusedWindow) => {
if (focusedWindow && nodeProps.srcURL) {
// TODO: open this in the next tab instead of last tab
focusedWindow.webContents.send(messages.SHORTCUT_NEW_FRAME, nodeProps.srcURL)
focusedWindow.webContents.send(messages.SHORTCUT_NEW_FRAME, nodeProps.srcURL, { isPrivate: frame.get('isPrivate'), partitionNumber: frame.get('partitionNumber') })
}
}
},
Expand Down
20 changes: 20 additions & 0 deletions test/components/tabTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@ describe('tabs', function () {
})
})

describe('specific session tab signal', function () {
Brave.beforeAll(this)
before(function * () {
yield setup(this.app.client)
var url = Brave.server.url('page1.html')
yield this.app
.client.ipcSend(messages.SHORTCUT_NEW_FRAME, url, { partitionNumber: 3 })
.waitForUrl(url)
.windowByUrl(Brave.browserWindowUrl)
})
it('creates a new session tab', function * () {
yield this.app.client
.waitForExist('.tab[data-frame-key="2"]')
})
it('makes the new session webview visible', function * () {
yield this.app.client
.waitForVisible('webview[partition="persist:partition-3"]')
})
})

describe('close tab', function () {
var tabCountBeforeTabClose = 2
var tabCountAfterTabClose = 1
Expand Down

1 comment on commit 066adc4

@diracdeltas
Copy link
Member

Choose a reason for hiding this comment

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

++

Please sign in to comment.