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

Commit

Permalink
route basic auth by tabId
Browse files Browse the repository at this point in the history
auditors: @bbondy @BrendanEich
fixes #3354
  • Loading branch information
bridiver committed Aug 24, 2016
1 parent 021c73a commit 1be45d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
10 changes: 5 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ app.on('ready', () => {
app.on('login', (e, webContents, request, authInfo, cb) => {
e.preventDefault()
authCallbacks[request.url] = cb
BrowserWindow.getAllWindows().map((win) => {
win.webContents.send(messages.LOGIN_REQUIRED, {
url: request.url,
authInfo
})
let sender = webContents.hostWebContents || webContents
sender.send(messages.LOGIN_REQUIRED, {
url: request.url,
tabId: webContents.getId(),
authInfo
})
})
app.on('window-all-closed', () => {
Expand Down
12 changes: 4 additions & 8 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const windowActions = require('../actions/windowActions')
const webviewActions = require('../actions/webviewActions')
const contextMenus = require('../contextMenus')
const getSetting = require('../settings').getSetting
const getOrigin = require('../state/siteUtil').getOrigin

// Components
const NavigationBar = require('./navigationBar')
Expand Down Expand Up @@ -55,7 +54,6 @@ const searchProviders = require('../data/searchProviders')
const cx = require('../lib/classSet.js')
const eventUtil = require('../lib/eventUtil')
const { isIntermediateAboutPage, getBaseUrl, isNavigatableAboutPage } = require('../lib/appUrlUtil')
const { getBaseDomain } = require('../lib/baseDomain')
const siteSettings = require('../state/siteSettings')
const urlParse = require('url').parse
const debounce = require('../lib/debounce.js')
Expand Down Expand Up @@ -366,12 +364,10 @@ class Main extends ImmutableComponent {
})

ipc.on(messages.LOGIN_REQUIRED, (e, detail) => {
const frames = self.props.windowState.get('frames')
.filter((frame) => frame.get('location') === detail.url ||
getOrigin(frame.get('location')) === getOrigin(detail.url) ||
getBaseDomain(getOrigin(frame.get('location'))) === getBaseDomain(getOrigin(detail.url)))
frames.forEach((frame) =>
windowActions.setLoginRequiredDetail(frame, detail))
const frame = FrameStateUtil.getFrameByTabId(self.props.windowState, detail.tabId)
if (frame) {
windowActions.setLoginRequiredDetail(frame, detail)
}
})

ipc.on(messages.SHOW_USERNAME_LIST, (e, usernames, origin, action, boundingRect) => {
Expand Down

2 comments on commit 1be45d5

@bbondy
Copy link
Member

@bbondy bbondy commented on 1be45d5 Aug 24, 2016

Choose a reason for hiding this comment

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

can you also do this for bravery stat messages?

@bbondy
Copy link
Member

@bbondy bbondy commented on 1be45d5 Aug 24, 2016

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.