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

Commit 2ba0492

Browse files
Adds support for Honey, and resolves a couple bugs
1 parent 68f1c42 commit 2ba0492

File tree

8 files changed

+33
-6
lines changed

8 files changed

+33
-6
lines changed

app/common/state/extensionState.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const extensionState = {
7676

7777
browserActionBackgroundImage: (browserAction, tabId) => {
7878
tabId = tabId ? tabId.toString() : '-1'
79-
let path = browserAction.get('path')
79+
let path = browserAction.getIn(['tabs', tabId, 'path']) || browserAction.get('path')
8080
let basePath = browserAction.get('base_path')
8181
if (path && basePath) {
8282
// Older extensions may provide a string path

app/extensions.js

+6
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ module.exports.init = () => {
516516
disableExtension(config.vimiumExtensionId)
517517
}
518518

519+
if (getSetting(settings.HONEY_ENABLED)) {
520+
registerComponent(config.honeyExtensionId)
521+
} else {
522+
disableExtension(config.honeyExtensionId)
523+
}
524+
519525
if (appStore.getState().getIn(['widevine', 'enabled'])) {
520526
registerComponent(config.widevineComponentId)
521527
}

app/renderer/components/navigation/navigator.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,17 @@ class Navigator extends ImmutableComponent {
102102
.map((extension) => extensionState.getBrowserActionByTabId(this.props.appState, extension.get('id'), activeTabId))
103103
.filter((browserAction) => browserAction)
104104

105-
let buttons = extensionBrowserActions.map((browserAction, id) =>
106-
<BrowserAction
107-
browserAction={browserAction}
105+
let buttons = extensionBrowserActions.map((browserAction, id) => {
106+
let tabAction = browserAction.getIn(['tabs', activeTabId.toString()])
107+
if (tabAction) {
108+
tabAction = tabAction.set('base_path', browserAction.get('base_path'))
109+
}
110+
return <BrowserAction
111+
browserAction={tabAction || browserAction}
108112
extensionId={id}
109113
tabId={activeTabId}
110114
popupWindowSrc={this.props.windowState.getIn(['popupWindowDetail', 'src'])} />
111-
).values()
115+
}).values()
112116
buttons = Array.from(buttons)
113117
if (buttons.length > 0) {
114118
buttons.push(<span className='buttonSeparator' />)

docs/state.md

+1
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ AppStore
172172
'bookmarks.toolbar.showOnlyFavicon': boolean, // true if only favicons should be shown on the bookmarks toolbar
173173
'extensions.pocket.enabled': boolean, // true if pocket is enabled
174174
'extensions.vimium.enabled': boolean, // true if vimium is enabled
175+
'extensions.honey.enabled': boolean, // true if Honey is enabled
175176
'general.autohide-menu': boolean, // true if the Windows menu should be autohidden
176177
'general.bookmarks-toolbar-mode': boolean, // true to show bookmakrs toolbar
177178
'general.check-default-on-startup': boolean, // true to check whether brave is default browser on startup

js/constants/appConfig.js

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ module.exports = {
198198
'shutdown.clear-site-settings': false,
199199
'extensions.pocket.enabled': false,
200200
'extensions.vimium.enabled': false,
201+
'extensions.honey.enabled': false,
201202
'general.bookmarks-toolbar-mode': null,
202203
'general.is-default-browser': null,
203204
'notification-add-funds-timestamp': null,

js/constants/config.js

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ module.exports = {
5050
PDFJSExtensionId: 'jdbefljfgobbmcidnmpjamcbhnbphjnb',
5151
PocketExtensionId: 'niloccemoadcdkdjlinkgdfekeahmflj',
5252
vimiumExtensionId: 'dbepggeogbaibhgnhhndojpepiihcmeb',
53+
honeyExtensionId: 'bmnlcjabgnpnenekpadlanbbkooimhnj',
5354
widevineComponentId: 'oimompecagnajdejgnnjijobebaeigek',
5455
coinbaseOrigin: 'https://buy.coinbase.com',
5556
newtab: {

js/constants/settings.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ const settings = {
9494
SHOW_BOOKMARKS_TOOLBAR_FAVICON: 'bookmarks.toolbar.showFavicon',
9595
SHOW_BOOKMARKS_TOOLBAR_ONLY_FAVICON: 'bookmarks.toolbar.showOnlyFavicon',
9696
POCKET_ENABLED: 'extensions.pocket.enabled',
97-
VIMIUM_ENABLED: 'extensions.vimium.enabled'
97+
VIMIUM_ENABLED: 'extensions.vimium.enabled',
98+
HONEY_ENABLED: 'extensions.honey.enabled'
9899
}
99100

100101
module.exports = settings

test/about/extensionsTest.js

+13
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,19 @@ describe('about:extensions', function () {
4949
.url(pocketURL)
5050
})
5151
})
52+
describe('Honey', function () {
53+
Brave.beforeAll(this)
54+
before(function * () {
55+
yield setup(this.app.client)
56+
})
57+
it('installs when preference is enabled', function * () {
58+
yield this.app.client
59+
.windowByUrl(Brave.browserWindowUrl)
60+
.changeSetting(settingsConst.HONEY_ENABLED, true)
61+
.tabByIndex(0)
62+
.waitForVisible('[data-extension-id="bmnlcjabgnpnenekpadlanbbkooimhnj"]', extensionDownloadWaitTime)
63+
})
64+
})
5265
describe('Vimium', function () {
5366
Brave.beforeAll(this)
5467
before(function * () {

0 commit comments

Comments
 (0)