Add BrowserWindow.isDevToolsExtensionInstalled API

This commit is contained in:
Kevin Sawicki 2016-06-09 10:04:02 -07:00
parent e824603f37
commit 0a26075699
2 changed files with 6 additions and 0 deletions

View file

@ -339,4 +339,8 @@ app.once('ready', function () {
delete manifestMap[manifest.extensionId] delete manifestMap[manifest.extensionId]
delete manifestNameMap[name] delete manifestNameMap[name]
} }
BrowserWindow.isDevToolsExtensionInstalled = function (name) {
return manifestNameMap.hasOwnProperty(name)
}
}) })

View file

@ -838,9 +838,11 @@ describe('browser-window module', function () {
beforeEach(function () { beforeEach(function () {
BrowserWindow.removeDevToolsExtension('foo') BrowserWindow.removeDevToolsExtension('foo')
assert.equal(BrowserWindow.isDevToolsExtensionInstalled('foo'), false)
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo') var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
BrowserWindow.addDevToolsExtension(extensionPath) BrowserWindow.addDevToolsExtension(extensionPath)
assert.equal(BrowserWindow.isDevToolsExtensionInstalled('foo'), true)
w.webContents.on('devtools-opened', function () { w.webContents.on('devtools-opened', function () {
var showPanelIntevalId = setInterval(function () { var showPanelIntevalId = setInterval(function () {