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

Commit

Permalink
Allow Brave extension in private tabs
Browse files Browse the repository at this point in the history
Fix #7912

- Main frame loads are not allowed with spanning incognito mode, so
  changed to split.
  Sync shouldn't be allowed in incognito, so disabled that.
- Added handling in ledger to not log pages for private tabs.

Auditors: @bridiver
  • Loading branch information
bbondy authored and bridiver committed Apr 4, 2017
1 parent 27bfd1a commit 7c79c0a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ let generateBraveManifest = () => {
web_accessible_resources: [
'img/favicon.ico'
],
incognito: 'spanning',
incognito: 'split',
key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAupOLMy5Fd4dCSOtjcApsAQOnuBdTs+OvBVt/3P93noIrf068x0xXkvxbn+fpigcqfNamiJ5CjGyfx9zAIs7zcHwbxjOw0Uih4SllfgtK+svNTeE0r5atMWE0xR489BvsqNuPSxYJUmW28JqhaSZ4SabYrRx114KcU6ko7hkjyPkjQa3P+chStJjIKYgu5tWBiMJp5QVLelKoM+xkY6S7efvJ8AfajxCViLGyDQPDviGr2D0VvIBob0D1ZmAoTvYOWafcNCaqaejPDybFtuLFX3pZBqfyOCyyzGhucyCmfBXJALKbhjRAqN5glNsUmGhhPK87TuGATQfVuZtenMvXMQIDAQAB'
}

Expand Down Expand Up @@ -250,7 +250,7 @@ let generateSyncManifest = () => {
48: 'img/sync-48.png',
16: 'img/sync-16.png'
},
incognito: 'spanning',
incognito: 'not_allowed',
key: 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxOmBmOVzntEY6zrcrGSAyrhzL2FJt4FaP12nb899+SrV0LgpOgyqDjytuXT5IlHS74j7ZK2zTOTQy5/E9hqo6ioi1GA3PQU8E71DTaN6kW+XzP+VyZmgPoQHIxPg8jkYk/H4erfP9kMhkVOtu/XqDTqluNhOT0BvVlBpWd4unTQFWdgpCYlPrI6PsYya4FSuIDe6rCKtJABfuKFEr7U9d9MNAOJEnRS8vdBHWCuhWHqsfAaAPyKHQhnwFSFZ4eB+JznBQf7cQtB3EpOoBElyR9QvmbWFrYu87eGL5XxsojKHCrxlQ4X5ANsALa1Mdd2DHDMVqLMIiEEU42DVB0ZDewIDAQAB'
}
}
Expand Down
5 changes: 5 additions & 0 deletions app/extensions/brave/content/scripts/pageInformation.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@

if (window.top !== window.self) return

// Don't allow ledger to run in incognito
if (chrome.extension.inIncognitoContext) {
return
}

var results = { timestamp: new Date().getTime(), protocol: document.location.protocol }

var node = document.head.querySelector("link[rel='icon']")
Expand Down
5 changes: 5 additions & 0 deletions js/about/newtab.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ class NewTabPage extends React.Component {
if (this.state.showEmptyPage) {
return <div className='empty' />
}

if (window.chrome.extension.inIncognitoContext) {
return <div className='empty' />
}

// don't render until object is found
if (!this.state.newTabData) {
return null
Expand Down
4 changes: 3 additions & 1 deletion js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ class Frame extends ImmutableComponent {
prevProps.adblockCount !== this.props.adblockCount ||
prevProps.httpsUpgradedCount !== this.props.httpsUpgradedCount ||
!Immutable.is(prevProps.newTabDetail, this.props.newTabDetail)) {
const showEmptyPage = getSetting(settings.NEWTAB_MODE) === newTabMode.EMPTY_NEW_TAB
const showEmptyPage = getSetting(settings.NEWTAB_MODE) === newTabMode.EMPTY_NEW_TAB ||
// TODO: This can be removed once we're on muon 2.57.8 or above
this.props.isPrivate
const showImages = getSetting(settings.SHOW_DASHBOARD_IMAGES) && !showEmptyPage
this.webview.send(messages.NEWTAB_DATA_UPDATED, {
showEmptyPage,
Expand Down
8 changes: 7 additions & 1 deletion js/stores/eventStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const EventEmitter = require('events').EventEmitter
const Immutable = require('immutable')
const windowConstants = require('../constants/windowConstants')
const debounce = require('../lib/debounce')
const tabs = require('../../app/browser/tabs')
const {isSourceAboutUrl} = require('../lib/appUrlUtil')
const {responseHasContent} = require('../../app/common/lib/httpUtil')

Expand Down Expand Up @@ -48,7 +49,12 @@ let lastActivePageUrl = null
let lastActiveTabId = null

const addPageView = (url, tabId) => {
if (url && isSourceAboutUrl(url)) {
const tab = tabs.getWebContents(tabId)
const isPrivate = !tab ||
tab.isDestroyed() ||
!tab.session.partition.startsWith('persist:')

if (url && isSourceAboutUrl(url) || isPrivate) {
url = null
}

Expand Down

0 comments on commit 7c79c0a

Please sign in to comment.