diff --git a/app/browser/reducers/tabsReducer.js b/app/browser/reducers/tabsReducer.js index 4a00d8388c0..a0e1fa8152e 100644 --- a/app/browser/reducers/tabsReducer.js +++ b/app/browser/reducers/tabsReducer.js @@ -23,7 +23,7 @@ const Immutable = require('immutable') const dragTypes = require('../../../js/constants/dragTypes') const tabActionConsts = require('../../common/constants/tabAction') const flash = require('../../../js/flash') -const {frameOptsFromFrame} = require('../../../js/state/frameStateUtil') +const {frameOptsFromFrame, isTor} = require('../../../js/state/frameStateUtil') const {isSourceAboutUrl, isTargetAboutUrl, isNavigatableAboutPage} = require('../../../js/lib/appUrlUtil') const {shouldDebugTabEvents} = require('../../cmdLine') @@ -35,6 +35,9 @@ const getWebRTCPolicy = (state, tabId) => { if (tabValue == null) { return WEBRTC_DEFAULT } + if (isTor(tabValue)) { + return WEBRTC_DISABLE_NON_PROXY + } const allSiteSettings = siteSettingsState.getAllSiteSettings(state, tabValue.get('incognito') === true) const tabSiteSettings = siteSettings.getSiteSettingsForURL(allSiteSettings, tabValue.get('url')) diff --git a/app/extensions/brave/locales/en-US/bravery.properties b/app/extensions/brave/locales/en-US/bravery.properties index dd85d0bd28a..2228e33503c 100644 --- a/app/extensions/brave/locales/en-US/bravery.properties +++ b/app/extensions/brave/locales/en-US/bravery.properties @@ -13,7 +13,8 @@ blockAllCookies=Block all cookies blockAllFingerprinting=Block all fingerprinting blockPopups=Block Popups cookieControl=Cookie Control -editBraveryGlobalSettings=Edit default shield settingsā€¦ +editBraveryGlobalSettings=Edit default shield settingsā€¦ +braveryTorWarning=For your protection, some sites will not work fully in Tor mode. fingerprintingBlocked={[plural(blockedFingerprintCount)]} fingerprintingBlocked[one]=Fingerprinting Method Blocked fingerprintingBlocked[other]=Fingerprinting Methods Blocked @@ -28,4 +29,4 @@ safeBrowsing=Block Phishing / Malware scriptsBlockedNumber={[plural(blockedScriptCount)]} scriptsBlockedNumber[one]=Script Blocked scriptsBlockedNumber[other]=Scripts Blocked -showBraveAds=Show Brave Ads \ No newline at end of file +showBraveAds=Show Brave Ads diff --git a/app/renderer/components/main/braveryPanel.js b/app/renderer/components/main/braveryPanel.js index 735868526c7..aea813f70be 100644 --- a/app/renderer/components/main/braveryPanel.js +++ b/app/renderer/components/main/braveryPanel.js @@ -232,6 +232,7 @@ class BraveryPanel extends React.Component { props.isBlockedScriptsShown = braveryPanelDetail.get('expandNoScript') props.isBlockingFingerprinting = props.blockedFingerprinting.size > 0 props.isFpShown = braveryPanelDetail.get('expandFp') + props.isTor = frameStateUtil.isTor(activeFrame) // used in other functions props.lastCommittedURL = lastCommittedURL @@ -623,6 +624,16 @@ class BraveryPanel extends React.Component { : null } + { + this.props.isTor + ?
+ : null + }
{ if (!favicon) { diff --git a/js/state/frameStateUtil.js b/js/state/frameStateUtil.js index de0ab5e6886..d68cb9cf8af 100644 --- a/js/state/frameStateUtil.js +++ b/js/state/frameStateUtil.js @@ -6,6 +6,7 @@ const Immutable = require('immutable') // Constants const config = require('../constants/config') +const appConfig = require('../constants/appConfig') const settings = require('../constants/settings') // Actions @@ -480,10 +481,10 @@ const isFirstFrameKeyInTabPage = (state, frameKey) => { } /** - * Check if frame is tor private tab + * Check if frame or tab object is associated with a tor private tab */ function isTor (frame) { - return !!(frame && frame.get('isPrivate') && getSetting(settings.USE_TOR_PRIVATE_TABS)) + return !!(frame && frame.get('partition') === appConfig.tor.partition) } const getTabPageIndex = (state) => { diff --git a/test/unit/state/frameStateUtilTest.js b/test/unit/state/frameStateUtilTest.js index 1088e678649..d5bcc40818b 100644 --- a/test/unit/state/frameStateUtilTest.js +++ b/test/unit/state/frameStateUtilTest.js @@ -494,11 +494,8 @@ describe('frameStateUtil', function () { }) describe('isTor', function () { - before(function () { - getSettingsValue = true - }) - const frame1 = Immutable.Map({isPrivate: true}) - const frame2 = Immutable.Map({isPrivate: false}) + const frame1 = Immutable.Map({partition: 'persist:tor'}) + const frame2 = Immutable.Map({partition: ''}) const frame3 = Immutable.Map({foobar: false}) it('null frame case', function () { assert.equal(frameStateUtil.isTor(null), false) @@ -512,9 +509,5 @@ describe('frameStateUtil', function () { it('tor frame case', function () { assert.equal(frameStateUtil.isTor(frame1), true) }) - it('tor disabled case', function () { - getSettingsValue = false - assert.equal(frameStateUtil.isTor(frame1), false) - }) }) })