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

always use the correct partition for extensions #2311

Merged
merged 1 commit into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,6 @@ module.exports.init = () => {
}
}

process.emit('load-extension-blacklist', [
getIndexHTML()
])

enableExtensions()

AppStore.addChangeListener(() => {
Expand Down
4 changes: 2 additions & 2 deletions app/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ function registerForHeadersReceived (session) {
* @param {string} partition name of the partition
*/
function registerPermissionHandler (session, partition) {
const isPrivate = !partition.startsWith('persist:') && partition !== 'main-1'
const isPrivate = !partition.startsWith('persist:')
// Keep track of per-site permissions granted for this session.
let permissions = null
session.setPermissionRequestHandler((webContents, permission, cb) => {
Expand Down Expand Up @@ -462,7 +462,7 @@ function shouldIgnoreUrl (url) {
}

module.exports.init = () => {
['main-1'].forEach((partition) => {
['default'].forEach((partition) => {
initForPartition(partition)
})
ipcMain.on(messages.INITIALIZE_PARTITION, (e, partition) => {
Expand Down
10 changes: 2 additions & 8 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const ImmutableComponent = require('./immutableComponent')
const Immutable = require('immutable')
const cx = require('../lib/classSet.js')
const siteUtil = require('../state/siteUtil')
const FrameStateUtil = require('../state/frameStateUtil')
const UrlUtil = require('../lib/urlutil')
const { getZoomValuePercentage, getNextZoomLevel } = require('../lib/zoom')
const messages = require('../constants/messages.js')
Expand Down Expand Up @@ -124,14 +125,7 @@ class Frame extends ImmutableComponent {
}
this.webview = document.createElement('webview')

let partition
if (this.props.frame.get('isPrivate')) {
partition = 'default'
} else if (this.props.frame.get('partitionNumber')) {
partition = `persist:partition-${this.props.frame.get('partitionNumber')}`
} else {
partition = 'persist:default'
}
let partition = FrameStateUtil.getPartition(this.props.frame)
ipc.sendSync(messages.INITIALIZE_PARTITION, partition)
this.webview.setAttribute('partition', partition)

Expand Down
2 changes: 2 additions & 0 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ class Main extends ImmutableComponent {
windowActions.setPopupWindowDetail(Immutable.fromJS({
left: props.x,
top: props.y + 100,
height: props.height,
width: props.width,
maxHeight: window.innerHeight - 100,
minHeight: 400,
src
Expand Down
37 changes: 27 additions & 10 deletions js/components/popupWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const React = require('react')
const ReactDOM = require('react-dom')
const ImmutableComponent = require('./immutableComponent')
const cx = require('../lib/classSet.js')
const windowActions = require('../actions/windowActions')

/**
* Represents a popup window
Expand All @@ -17,32 +18,48 @@ class PopupWindow extends ImmutableComponent {
if (src) {
let webview = document.createElement('webview')
webview.setAttribute('src', src)
if (parseInt(this.props.detail.get('height'))) {
console.log('got height')
webview.style.height = this.props.detail.get('height') + 'px'
}
if (parseInt(this.props.detail.get('width'))) {
webview.style.width = this.props.detail.get('width') + 'px'
}
webview.addEventListener('destroyed', () => {
windowActions.setPopupWindowDetail()
})
webview.addEventListener('close', () => {
windowActions.setPopupWindowDetail()
})
ReactDOM.findDOMNode(this).appendChild(webview)
}
}

render () {
const styles = {}
if (this.props.detail.get('left') !== undefined) {
if (parseInt(this.props.detail.get('left'))) {
styles.left = this.props.detail.get('left')
}
if (this.props.detail.get('right') !== undefined) {
if (parseInt(this.props.detail.get('right'))) {
styles.right = this.props.detail.get('right')
}
if (this.props.detail.get('top') !== undefined) {
if (parseInt(this.props.detail.get('top'))) {
styles.top = this.props.detail.get('top')
}
if (this.props.detail.get('bottom') !== undefined) {
if (parseInt(this.props.detail.get('bottom'))) {
styles.bottom = this.props.detail.get('bottom')
}
if (this.props.detail.get('width') !== undefined) {
styles.width = this.props.detail.get('width')
if (parseInt(this.props.detail.get('height'))) {
styles.height = this.props.detail.get('height') + 2
}
if (this.props.detail.get('minHeight')) {
styles.minHeight = this.props.detail.get('minHeight')
if (parseInt(this.props.detail.get('width'))) {
styles.width = this.props.detail.get('width') + 2
}
if (this.props.detail.get('maxHeight')) {
styles.maxHeight = this.props.detail.get('maxHeight')
if (parseInt(this.props.detail.get('minHeight'))) {
styles.minHeight = this.props.detail.get('minHeight') + 2
}
if (parseInt(this.props.detail.get('maxHeight'))) {
styles.maxHeight = this.props.detail.get('maxHeight') + 2
}

return <div
Expand Down
4 changes: 3 additions & 1 deletion js/components/urlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ class UrlBar extends ImmutableComponent {

get hostValue () {
const parsed = urlParse(this.props.activeFrameProps.get('location'))
return parsed.host && parsed.protocol !== 'about:' ? parsed.host : ''
return parsed.host &&
parsed.protocol !== 'about:' &&
parsed.protocol !== 'chrome-extension:' ? parsed.host : ''
}

get titleValue () {
Expand Down
4 changes: 2 additions & 2 deletions js/contextMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ function mainTemplateInit (nodeProps, frame) {
label: '1Password',
click: (item, focusedWindow) => {
if (focusedWindow) {
ipc.send('chrome-browser-action-clicked', 'aomjjhallfgjeglblehebfpbcfeobpgk', '1Password', nodeProps)
ipc.send('chrome-browser-action-clicked', 'aomjjhallfgjeglblehebfpbcfeobpgk', frame.get('tabId'), '1Password', nodeProps)
}
}
})
Expand All @@ -828,7 +828,7 @@ function mainTemplateInit (nodeProps, frame) {
label: 'Dashlane',
click: (item, focusedWindow) => {
if (focusedWindow) {
ipc.send('chrome-browser-action-clicked', 'fdjamakpfbbddfjaooikfcpapjohcfmg', 'Dashlane', nodeProps)
ipc.send('chrome-browser-action-clicked', 'fdjamakpfbbddfjaooikfcpapjohcfmg', frame.get('tabId'), 'Dashlane', nodeProps)
}
}
})
Expand Down
10 changes: 10 additions & 0 deletions js/state/frameStateUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,15 @@ function isAncestorFrameKey (frames, frame, parentFrameKey) {
return isAncestorFrameKey(frames, parentFrame, parentFrameKey)
}

function getPartition (frameOpts) {
let partition = 'persist:default'
if (frameOpts.get('isPrivate')) {
partition = 'default'
} else if (frameOpts.get('partitionNumber')) {
partition = `persist:partition-${frameOpts.get('partitionNumber')}`
}
return partition
}
/**
* Adds a frame specified by frameOpts and newKey and sets the activeFrameKey
* @return Immutable top level application state ready to merge back in
Expand Down Expand Up @@ -415,6 +424,7 @@ module.exports = {
getFramePropsIndex,
getFrameKeysByDisplayIndex,
getFeatures,
getPartition,
addFrame,
undoCloseFrame,
removeFrame,
Expand Down
2 changes: 1 addition & 1 deletion js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function windowDefaults () {
windowOffset: 20,
webPreferences: {
sharedWorker: true,
partition: 'main-1'
partition: 'default'
}
}
}
Expand Down
1 change: 0 additions & 1 deletion less/popupWindow.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@import "variables.less";

.popupWindow {
border-radius: @borderRadius;
box-sizing: border-box;
color: black;
cursor: default;
Expand Down