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

Commit

Permalink
Address conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathansampson committed May 11, 2017
2 parents efb0eb2 + c708af7 commit 8e3edef
Show file tree
Hide file tree
Showing 308 changed files with 6,738 additions and 5,016 deletions.
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
Submitter Checklist:

- [ ] Submitted a [ticket](https://github.com/brave/browser-laptop/issues) for my issue if one did not already exist.
- [ ] Used Github [auto-closing keywords](https://help.github.com/articles/closing-issues-via-commit-messages/) in the commit message.
- [ ] Added/updated tests for this change (for new code or code which already has tests).
- [ ] Ran `git rebase -i` to squash commits (if needed).

Test Plan:


Reviewer Checklist:

Tests


- [ ] Adequate test coverage exists to prevent regressions
- [ ] Tests should be independent and work correctly when run indivually or as a suite [ref](https://github.com/brave/browser-laptop/wiki/Code-Guidelines#test-dependencies)


6 changes: 3 additions & 3 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
runtime = electron
target_arch = x64
brave_electron_version = 2.58.8
brave_electron_version = 3.0.100
chromedriver_version = 2.27
target = v2.58.8
disturl=http://brave-laptop-binaries.s3.amazonaws.com/atom-shell/dist/
target = v3.0.1
disturl=https://brave-laptop-binaries.s3.amazonaws.com/atom-shell/dist/
build_from_source = true
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.15.300](https://github.com/brave/browser-laptop/releases/v0.15.300dev)
- Update muon to 3.0.1. ([#8445](https://github.com/brave/browser-laptop/issues/8445))

## [0.15.2](https://github.com/brave/browser-laptop/releases/v0.15.2dev)
- Update libchromiumcontent to 58.0.3029.96. ([#8638](https://github.com/brave/browser-laptop/issues/8638))
- Update muon to 2.58.9. ([#8660](https://github.com/brave/browser-laptop/issues/8660))

## [0.15.1](https://github.com/brave/browser-laptop/releases/v0.15.1dev)
- Fixed navigating to a PDF may crash the tab. ([#8422](https://github.com/brave/browser-laptop/issues/8422))
- Fixed crash on startup (possibly related to recovering tabs). ([#8552](https://github.com/brave/browser-laptop/issues/8552))
Expand Down
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Follow [@brave](https://twitter.com/brave) on Twitter for important news and ann

For other versions of our browser, please see:
* iPhone - [brave/browser-ios](https://github.com/brave/browser-ios)
* Android - [brave/browser-android](https://github.com/brave/browser-android-tabs)
* Android - [brave/browser-android-tabs](https://github.com/brave/browser-android-tabs)

## Downloads

Expand Down Expand Up @@ -114,19 +114,23 @@ Now actually run Brave in another terminal

npm start

To run the webdriver tests:

npm run watch-test or npm run watch-all

npm test

Some errors related to [brave/electron](https://github.com/brave/electron) update can be fixed by doing a clean install:

rm -rf node_modules/
npm install

If this does not work, please clear out your ~/.electron first and try again.

### Running webdriver tests

To run the webdriver tests

npm run watch-test or npm run watch-all

Now run tests in another terminal

npm test

### Port

Brave uses port 8080 to communicate between its client and server sides by default. If you are using port 8080 for something else (e.g. a web proxy) then you can set the node config to make it use a different one.
Expand Down
2 changes: 1 addition & 1 deletion app/browser/electronDownloadItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const downloadMap = {}

module.exports.updateElectronDownloadItem = (downloadId, item, state) => {
if (state === downloadStates.INTERRUPTED || state === downloadStates.CANCELLED || state === downloadStates.COMPLETED) {
if (state === downloadStates.COMPLETED) {
if (app.dock && state === downloadStates.COMPLETED) {
app.dock.downloadFinished(item.getSavePath())
}
delete downloadMap[downloadId]
Expand Down
25 changes: 13 additions & 12 deletions app/browser/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const {getByTabId} = require('../common/state/tabState')
const getSetting = require('../../js/settings').getSetting
const locale = require('../locale')
const {isSiteBookmarked, siteSort} = require('../../js/state/siteUtil')
const tabState = require('../../app/common/state/tabState')
const isDarwin = process.platform === 'darwin'
const isLinux = process.platform === 'linux'

Expand Down Expand Up @@ -70,16 +71,14 @@ const createFileSubmenu = () => {
},
CommonMenu.separatorMenuItem,
{
// this should be disabled when
// no windows are active
// This should be disabled when no windows are active.
label: locale.translation('closeTab'),
accelerator: 'CmdOrCtrl+W',
click: function (item, focusedWindow) {
CommonMenu.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_CLOSE_FRAME])
appActions.tabCloseRequested(tabState.TAB_ID_ACTIVE)
}
}, {
// this should be disabled when
// no windows are active
// This should be disabled when no windows are active.
label: locale.translation('closeWindow'),
accelerator: 'CmdOrCtrl+Shift+W',
click: function (item, focusedWindow) {
Expand All @@ -98,7 +97,7 @@ const createFileSubmenu = () => {
}, {
label: locale.translation('share'),
submenu: [
CommonMenu.simpleShareActiveTabMenuItem('emailPageLink', 'email', 'CmdOrCtrl+Shift+I'),
CommonMenu.simpleShareActiveTabMenuItem('emailPageLink', 'email'),
CommonMenu.separatorMenuItem,
CommonMenu.simpleShareActiveTabMenuItem('tweetPageLink', 'twitter'),
CommonMenu.simpleShareActiveTabMenuItem('facebookPageLink', 'facebook'),
Expand Down Expand Up @@ -260,8 +259,10 @@ const createViewSubmenu = () => {
{
label: locale.translation('toggleDeveloperTools'),
accelerator: isDarwin ? 'Cmd+Alt+I' : 'Ctrl+Shift+I',
click: function (item, focusedWindow) {
CommonMenu.sendToFocusedWindow(focusedWindow, [messages.SHORTCUT_ACTIVE_FRAME_TOGGLE_DEV_TOOLS])
click: function (item) {
const win = BrowserWindow.getActiveWindow()
const activeTab = tabState.getActiveTabValue(appStore.getState(), win.id)
appActions.toggleDevTools(activeTab.get('tabId'))
}
},
CommonMenu.separatorMenuItem,
Expand Down Expand Up @@ -628,10 +629,10 @@ const doAction = (action) => {
createMenu()
})
break
case appConstants.APP_TAB_CLOSED:
case appConstants.APP_TAB_CLOSE_REQUESTED:
appDispatcher.waitFor([appStore.dispatchToken], () => {
action = makeImmutable(action)
const tab = getByTabId(appStore.getState(), action.getIn(['tabValue', 'tabId']))
const tab = getByTabId(appStore.getState(), action.get('tabId'))
if (tab && !tab.get('incognito') && tab.get('url') !== 'about:newtab') {
if (tab.get('frame')) {
lastClosedUrl = tab.get('url')
Expand Down Expand Up @@ -675,8 +676,8 @@ const doAction = (action) => {
})
}
break
case appConstants.APP_CLEAR_HISTORY:
if (action.tag === siteTags.BOOKMARK) {
case appConstants.APP_ON_CLEAR_BROWSING_DATA:
if (action.clearDataDetail.get('browserHistory')) {
appDispatcher.waitFor([appStore.dispatchToken], () => {
createMenu()
})
Expand Down
76 changes: 76 additions & 0 deletions app/browser/reducers/autoplayReducer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

'use strict'

const appConstants = require('../../../js/constants/appConstants')
const {makeImmutable} = require('../../common/state/immutableUtil')
const {ipcMain, webContents} = require('electron')
const AppStore = require('../../../js/stores/appStore')
const siteSettings = require('../../../js/state/siteSettings')
const appActions = require('../../../js/actions/appActions')
const {getOrigin} = require('../../../js/state/siteUtil')
const locale = require('../../locale')
const messages = require('../../../js/constants/messages')
const urlParse = require('../../common/urlParse')

const showAutoplayMessageBox = (tabId) => {
const tab = webContents.fromTabID(tabId)
if (!tab || tab.isDestroyed()) {
return
}
const location = tab.getURL()
const origin = getOrigin(location)
const originSettings = siteSettings.getSiteSettingsForURL(AppStore.getState().get('siteSettings'), origin)
if (originSettings && originSettings.get('noAutoplay') === true) {
return
}
const message = locale.translation('allowAutoplay', {origin})

appActions.showNotification({
buttons: [
{text: locale.translation('yes')},
{text: locale.translation('no')}
],
message,
frameOrigin: origin,
options: {
persist: true
}
})

ipcMain.once(messages.NOTIFICATION_RESPONSE, (e, msg, buttonIndex, persist) => {
if (msg === message) {
appActions.hideNotification(message)
let ruleKey = origin
const parsedUrl = urlParse(location)
if ((parsedUrl.protocol === 'https:' || parsedUrl.protocol === 'http:')) {
ruleKey = `https?://${parsedUrl.host}`
}
if (buttonIndex === 0) {
appActions.changeSiteSetting(ruleKey, 'noAutoplay', false)

if (tab && !tab.isDestroyed()) {
tab.reload()
}
} else {
if (persist) {
appActions.changeSiteSetting(ruleKey, 'noAutoplay', true)
}
}
}
})
}

const autoplayReducer = (state, action, immutableAction) => {
action = immutableAction || makeImmutable(action)
switch (action.get('actionType')) {
case appConstants.APP_AUTOPLAY_BLOCKED:
showAutoplayMessageBox(action.get('tabId'))
break
}
return state
}

module.exports = autoplayReducer
4 changes: 2 additions & 2 deletions app/browser/reducers/extensionsReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const extensionState = require('../../common/state/extensionState')
const ExtensionConstants = require('../../common/constants/extensionConstants')
const {makeImmutable} = require('../../common/state/immutableUtil')

const extensionsReducer = (state, action) => {
action = makeImmutable(action)
const extensionsReducer = (state, action, immutableAction) => {
action = immutableAction || makeImmutable(action)
switch (action.get('actionType')) {
case ExtensionConstants.EXTENSION_UNINSTALLED:
let extensionId = action.get('extensionId').toString()
Expand Down
4 changes: 2 additions & 2 deletions app/browser/reducers/flashReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const appConstants = require('../../../js/constants/appConstants')
const flash = require('../../../js/flash')
const {makeImmutable} = require('../../common/state/immutableUtil')

const flashReducer = (state, action) => {
action = makeImmutable(action)
const flashReducer = (state, action, immutableAction) => {
action = immutableAction || makeImmutable(action)
switch (action.get('actionType')) {
case appConstants.APP_SET_STATE:
flash.init()
Expand Down
4 changes: 2 additions & 2 deletions app/browser/reducers/passwordManagerReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ const init = () => {
})
}

const passwordManagerReducer = (state, action) => {
action = makeImmutable(action)
const passwordManagerReducer = (state, action, immutableAction) => {
action = immutableAction || makeImmutable(action)
switch (action.get('actionType')) {
case appConstants.APP_SET_STATE:
init()
Expand Down
4 changes: 2 additions & 2 deletions app/browser/reducers/shareReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const appConstants = require('../../../js/constants/appConstants')
const {makeImmutable} = require('../../common/state/immutableUtil')
const {simpleShareActiveTab} = require('../share')

const shareReducer = (state, action) => {
action = makeImmutable(action)
const shareReducer = (state, action, immutableAction) => {
action = immutableAction || makeImmutable(action)
switch (action.get('actionType')) {
case appConstants.APP_SIMPLE_SHARE_ACTIVE_TAB_REQUESTED:
state = simpleShareActiveTab(state, action.get('windowId'), action.get('shareType'))
Expand Down
50 changes: 29 additions & 21 deletions app/browser/reducers/sitesReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
'use strict'

const appConstants = require('../../../js/constants/appConstants')
const filtering = require('../../filtering')
const siteTags = require('../../../js/constants/siteTags')
const siteUtil = require('../../../js/state/siteUtil')
const syncActions = require('../../../js/actions/syncActions')
const syncUtil = require('../../../js/state/syncUtil')
const Immutable = require('immutable')
const {makeImmutable} = require('../../common/state/immutableUtil')
const settings = require('../../../js/constants/settings')
const {getSetting} = require('../../../js/settings')
const writeActions = require('../../../js/constants/sync/proto').actions
Expand All @@ -19,10 +19,16 @@ const syncEnabled = () => {
return getSetting(settings.SYNC_ENABLED) === true
}

const sitesReducer = (state, action, emitChanges) => {
const sitesReducer = (state, action, immutableAction) => {
switch (action.actionType) {
case appConstants.APP_ON_CLEAR_BROWSING_DATA:
if (immutableAction.getIn(['clearDataDetail', 'browserHistory'])) {
state = state.set('sites', siteUtil.clearHistory(state.get('sites')))
filtering.clearHistory()
}
break
case appConstants.APP_ADD_SITE:
if (action.siteDetail.constructor === Immutable.List) {
if (Immutable.List.isList(action.siteDetail)) {
action.siteDetail.forEach((s) => {
state = state.set('sites', siteUtil.addSite(state.get('sites'), s, action.tag, undefined, action.skipSync))
})
Expand Down Expand Up @@ -91,27 +97,29 @@ const sitesReducer = (state, action, emitChanges) => {
state = syncUtil.updateSiteCache(state, siteDetail)
})
break
case appConstants.APP_TAB_PINNED:
const tab = state.get('tabs').find((tab) => tab.get('tabId') === action.tabId)
if (!tab) {
console.warn('Trying to pin a tabId which does not exist:', action.tabId, 'tabs: ', state.get('tabs').toJS())
break
}
const siteDetail = siteUtil.getDetailFromTab(tab, siteTags.PINNED)
if (action.pinned) {
state = state.set('sites', siteUtil.addSite(state.get('sites'), siteDetail, siteTags.PINNED))
} else {
state = state.set('sites', siteUtil.removeSite(state.get('sites'), siteDetail, siteTags.PINNED))
}
if (syncEnabled()) {
state = syncUtil.updateSiteCache(state, siteDetail)
case appConstants.APP_TAB_UPDATED:
if (immutableAction.getIn(['changeInfo', 'pinned']) != null) {
const pinned = immutableAction.getIn(['changeInfo', 'pinned'])
const tabId = immutableAction.getIn(['tabValue', 'tabId'])
const tab = state.get('tabs').find((tab) => tab.get('tabId') === tabId)
if (!tab) {
console.warn('Trying to pin a tabId which does not exist:', tabId, 'tabs: ', state.get('tabs').toJS())
break
}
const sites = state.get('sites')
const siteDetail = siteUtil.getDetailFromTab(tab, siteTags.PINNED, sites)
if (pinned) {
state = state.set('sites', siteUtil.addSite(sites, siteDetail, siteTags.PINNED))
} else {
state = state.set('sites', siteUtil.removeSite(sites, siteDetail, siteTags.PINNED))
}
if (syncEnabled()) {
state = syncUtil.updateSiteCache(state, siteDetail)
}
}
break

case appConstants.APP_MAYBE_CREATE_TAB_REQUESTED:
case appConstants.APP_CREATE_TAB_REQUESTED: {
action = makeImmutable(action)
const createProperties = action.get('createProperties')
const createProperties = immutableAction.get('createProperties')
if (createProperties.get('pinned')) {
state = state.set('sites', siteUtil.addSite(state.get('sites'),
siteUtil.getDetailFromCreateProperties(createProperties), siteTags.PINNED))
Expand Down
4 changes: 2 additions & 2 deletions app/browser/reducers/spellCheckReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const appConstants = require('../../../js/constants/appConstants')
const tabs = require('../tabs')
const {makeImmutable} = require('../../common/state/immutableUtil')

const spellCheckReducer = (state, action) => {
action = makeImmutable(action)
const spellCheckReducer = (state, action, immutableAction) => {
action = immutableAction || makeImmutable(action)
switch (action.get('actionType')) {
case appConstants.APP_ADD_WORD:
tabs.sendToAll('add-word', action.get('word'))
Expand Down
Loading

0 comments on commit 8e3edef

Please sign in to comment.