Merge pull request #5859 from electron/felix-extension-warning
Log a warning if an extension has already been loaded
This commit is contained in:
commit
8847af0e54
2 changed files with 7 additions and 1 deletions
|
@ -380,7 +380,11 @@ Find a window according to its ID.
|
||||||
Adds DevTools extension located at `path`, and returns extension's name.
|
Adds DevTools extension located at `path`, and returns extension's name.
|
||||||
|
|
||||||
The extension will be remembered so you only need to call this API once, this
|
The extension will be remembered so you only need to call this API once, this
|
||||||
API is not for programming use.
|
API is not for programming use. If you try to add an extension that has already
|
||||||
|
been loaded, this method will not return and instead log a warning to the
|
||||||
|
console.
|
||||||
|
|
||||||
|
Method will also not return if the extension's manifest is missing or incomplete.
|
||||||
|
|
||||||
### `BrowserWindow.removeDevToolsExtension(name)`
|
### `BrowserWindow.removeDevToolsExtension(name)`
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ const getManifestFromPath = function (srcDirectory) {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return manifest
|
return manifest
|
||||||
|
} else if (manifest && manifest.name) {
|
||||||
|
console.warn(`Attempted to load extension "${manifest.name}", but extension was already loaded!`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue