mirror of
https://github.com/electron/electron.git
synced 2026-01-27 16:28:23 -05:00
fixup: catch exception when loading extension
This commit is contained in:
@@ -359,15 +359,22 @@ app.on('will-quit', function () {
|
||||
app.once('ready', function () {
|
||||
// The public API to add/remove extensions.
|
||||
BrowserWindow.addExtension = function (srcDirectory) {
|
||||
const manifest = getManifestFromPath(srcDirectory)
|
||||
if (manifest) {
|
||||
loadExtension(manifest)
|
||||
for (const webContents of getAllWebContents()) {
|
||||
if (isWindowOrWebView(webContents)) {
|
||||
loadDevToolsExtensions(webContents, [manifest])
|
||||
try {
|
||||
const manifest = getManifestFromPath(srcDirectory)
|
||||
if (manifest) {
|
||||
loadExtension(manifest)
|
||||
for (const webContents of getAllWebContents()) {
|
||||
if (isWindowOrWebView(webContents)) {
|
||||
loadDevToolsExtensions(webContents, [manifest])
|
||||
}
|
||||
}
|
||||
return manifest.name
|
||||
}
|
||||
} catch (error) {
|
||||
if (process.env.ELECTRON_ENABLE_LOGGING) {
|
||||
console.error('Failed to load browser extension from directory:', srcDirectory)
|
||||
console.error(error)
|
||||
}
|
||||
return manifest.name
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user