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

Commit e5f0724

Browse files
diracdeltasbsclifton
authored andcommitted
fix tor-related webtorrent issues
* re-enable webtorrent in private tabs * stop page loading indicator after torrent warning is shown in a tor tab fix #14472 fix #14524 Test Plan: 1. open brave and make sure webtorrent is enabled 2. go to https://webtorrent.io/torrents/sintel.torrent in a private tab. it should load webtorrent. 3. go to https://webtorrent.io/torrents/sintel.torrent in a tor tab. it should show a privacy warning. 4. click 'ok'. the page loading indicator should stop.
1 parent ca30824 commit e5f0724

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

app/extensions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ let generateTorrentManifest = () => {
289289
48: 'img/webtorrent-48.png',
290290
16: 'img/webtorrent-16.png'
291291
},
292-
incognito: 'not_allowed',
292+
incognito: 'split',
293293
key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyWl+wMvL0wZX3JUs7GeZAvxMP+LWEh2bwMV1HyuBra/lGZIq3Fmh0+AFnvFPXz1NpQkbLS3QWyqhdIn/lepGwuc2ma0glPzzmieqwctUurMGSGManApGO1MkcbSPhb+R1mx8tMam5+wbme4WoW37PI3oATgOs2NvHYuP60qol3U7b/zB3IWuqtwtqKe2Q1xY17btvPuz148ygWWIHneedt0jwfr6Zp+CSLARB9Heq/jqGXV4dPSVZ5ebBHLQ452iZkHxS6fm4Z+IxjKdYs3HNj/s8xbfEZ2ydnArGdJ0lpSK9jkDGYyUBugq5Qp3FH6zV89WqBvoV1dqUmL9gxbHsQIDAQAB'
294294
}
295295
}

app/filtering.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function registerForBeforeRequest (session, partition) {
122122
}
123123

124124
if ((isMagnetURL(details)) && partition === appConfig.tor.partition) {
125-
showTorrentBlockedInTorWarning(details)
125+
showTorrentBlockedInTorWarning(details, muonCb)
126126
return
127127
}
128128

@@ -357,13 +357,16 @@ function registerForBeforeSendHeaders (session, partition) {
357357
})
358358
}
359359

360-
function showTorrentBlockedInTorWarning (details) {
360+
function showTorrentBlockedInTorWarning (details, muonCb) {
361+
const cb = () => muonCb({cancel: true})
361362
if (details.tabId) {
362363
tabMessageBox.show(details.tabId, {
363364
message: `${locale.translation('torrentBlockedInTor')}`,
364365
title: 'Brave',
365366
buttons: [locale.translation('torrentWarningOk')]
366-
})
367+
}, cb)
368+
} else {
369+
cb()
367370
}
368371
}
369372

@@ -381,7 +384,7 @@ function registerForHeadersReceived (session, partition) {
381384
return
382385
}
383386
if ((isTorrentFile(details)) && partition === appConfig.tor.partition) {
384-
showTorrentBlockedInTorWarning(details)
387+
showTorrentBlockedInTorWarning(details, muonCb)
385388
return
386389
}
387390
const firstPartyUrl = module.exports.getMainFrameUrl(details)
@@ -670,7 +673,10 @@ function registerForDownloadListener (session) {
670673
})
671674
}
672675

673-
function registerForMagnetHandler (session) {
676+
function registerForMagnetHandler (session, partition) {
677+
if (partition === appConfig.tor.partition) {
678+
return
679+
}
674680
const webtorrentUrl = appUrlUtil.getTorrentExtUrl('webtorrent.html')
675681
try {
676682
if (getSetting(settings.TORRENT_VIEWER_ENABLED)) {

0 commit comments

Comments
 (0)