* Installs a new addon with the current session. This function will return an * ID that may later be used to plain #uninstallAddon uninstall the * addon. * * * @param {string} path Path on the local filesystem to the web extension to * install. * @param {boolean} temp
(path, temporary = false)
| 652 | * @see #uninstallAddon |
| 653 | */ |
| 654 | async installAddon(path, temporary = false) { |
| 655 | let stats = fs.statSync(path) |
| 656 | let buf |
| 657 | if (stats.isDirectory()) { |
| 658 | let zip = new Zip() |
| 659 | await zip.addDir(path) |
| 660 | buf = await zip.toBuffer('DEFLATE') |
| 661 | } else { |
| 662 | buf = await io.read(path) |
| 663 | } |
| 664 | return this.execute( |
| 665 | new command.Command(ExtensionCommand.INSTALL_ADDON) |
| 666 | .setParameter('addon', buf.toString('base64')) |
| 667 | .setParameter('temporary', temporary), |
| 668 | ) |
| 669 | } |
| 670 | |
| 671 | /** |
| 672 | * Uninstalls an addon from the current browser session's profile. |
no test coverage detected