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

Commit 94721e3

Browse files
committed
Tweak bitcoin handler to new api
Auditors: @bridiver Fix #3625 Test Plan: Test that bitcoin handler still works. Backup your Brave appdata user dir. Remove it. Make sure you can successfully register a bitcoin handler.
1 parent ad3c405 commit 94721e3

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

app/ledger.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const util = require('util')
2727
const electron = require('electron')
2828
const app = electron.app
2929
const ipc = electron.ipcMain
30-
const protocolHandler = electron.protocol
3130
const session = electron.session
3231

3332
const acorn = require('acorn')
@@ -159,10 +158,11 @@ var boot = () => {
159158
*/
160159

161160
if (ipc) {
162-
ipc.on(messages.CHECK_BITCOIN_HANDLER, () => {
161+
ipc.on(messages.CHECK_BITCOIN_HANDLER, (event, partition) => {
162+
const protocolHandler = session.fromPartition(partition).protocol
163163
// TODO: https://github.com/brave/browser-laptop/issues/3625
164164
if (typeof protocolHandler.isNavigatorProtocolHandled === 'function') {
165-
ledgerInfo.hasBitcoinHandler = protocolHandler.isNavigatorProtocolHandled('', 'bitcoin')
165+
ledgerInfo.hasBitcoinHandler = protocolHandler.isNavigatorProtocolHandled('bitcoin')
166166
appActions.updateLedgerInfo(underscore.omit(ledgerInfo, [ '_internal' ]))
167167
}
168168
})

js/components/frame.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Frame extends ImmutableComponent {
7676
updateAboutDetails () {
7777
let location = getBaseUrl(this.props.location)
7878
if (location === 'about:preferences') {
79-
ipc.send(messages.CHECK_BITCOIN_HANDLER)
79+
ipc.send(messages.CHECK_BITCOIN_HANDLER, FrameStateUtil.getPartition(this.frame))
8080
const ledgerData = this.props.ledgerInfo.merge(this.props.publisherInfo).toJS()
8181
this.webview.send(messages.LEDGER_UPDATED, ledgerData)
8282
this.webview.send(messages.SETTINGS_UPDATED, this.props.settings ? this.props.settings.toJS() : null)

0 commit comments

Comments
 (0)