diff --git a/app/extensions.js b/app/extensions.js index ce530a92172..b2fe1b1ce4a 100644 --- a/app/extensions.js +++ b/app/extensions.js @@ -9,6 +9,8 @@ const settings = require('../js/constants/settings') const {passwordManagers, extensionIds} = require('../js/constants/passwordManagers') const appStore = require('../js/stores/appStore') const extensionState = require('./common/state/extensionState') +const fs = require('fs') +const path = require('path') let generateBraveManifest = () => { let baseManifest = { @@ -173,7 +175,7 @@ module.exports.init = () => { const extensionPath = extensions.getIn([extensionId, 'filePath']) // If we don't have info on the extension yet, check for an update / install if (!extensionPath) { - defaultSession.updateClient.install(extensionId) + defaultSession.updateClient.checkNow(extensionId) } else { installExtension(extensionId, extensionPath) } @@ -192,9 +194,24 @@ module.exports.init = () => { enableExtension(installInfo.id) } - let installExtension = (extensionId, path, options = {}) => { + let installExtension = (extensionId, extensionPath, options = {}) => { if (!installedExtensions[extensionId]) { - process.emit('load-extension', path, options, extensionInstalled) + if (extensionId === config.braveExtensionId) { + process.emit('load-extension', extensionPath, options, extensionInstalled) + return + } + // Verify we don't have info about an extension which doesn't exist + // on disk anymore. It will crash if it doesn't exist, so this is + // just a safety net. + fs.exists(path.join(extensionPath, 'manifest.json'), (exists) => { + console.log('paht exists', extensionPath, exists) + if (exists) { + process.emit('load-extension', extensionPath, options, extensionInstalled) + } else { + delete installedExtensions[extensionId] + defaultSession.updateClient.checkNow(extensionId) + } + }) } else { enableExtension(extensionId) } diff --git a/app/renderer/components/browserActionButton.js b/app/renderer/components/browserActionButton.js index d1a856d1e65..acd42a0fe23 100644 --- a/app/renderer/components/browserActionButton.js +++ b/app/renderer/components/browserActionButton.js @@ -39,6 +39,7 @@ class BrowserActionButton extends ImmutableComponent { backgroundRepeat: 'no-repeat', backgroundPosition: 'center' }} + dataButtonValue={this.props.extensionId} onClick={this.onClicked.bind(this, this.props.extensionId, this.props.browserAction.get('title'))} /> } } diff --git a/js/components/button.js b/js/components/button.js index bd9c2e7974e..bce5a99d10f 100644 --- a/js/components/button.js +++ b/js/components/button.js @@ -12,6 +12,7 @@ class Button extends ImmutableComponent { return