@@ -11,6 +11,10 @@ import { pathExists } from '~/utils/files';
1111import { extractZip } from '~/utils/zip' ;
1212import { extensions , _setFallbackSession } from 'electron-extensions' ;
1313import { requestPermission } from './dialogs/permissions' ;
14+ import * as rimraf from 'rimraf' ;
15+ import { promisify } from 'util' ;
16+
17+ const rf = promisify ( rimraf ) ;
1418
1519// TODO: sessions should be separate. This structure actually doesn't make sense.
1620export class SessionsService {
@@ -29,9 +33,6 @@ export class SessionsService {
2933 this . clearCache ( 'incognito' ) ;
3034
3135 if ( process . env . ENABLE_EXTENSIONS ) {
32- // TODO: remove this after fix for e.sender.session
33- _setFallbackSession ( this . view ) ;
34-
3536 extensions . initializeSession (
3637 this . view ,
3738 `${ app . getAppPath ( ) } /build/extensions-preload.bundle.js` ,
@@ -331,6 +332,17 @@ export class SessionsService {
331332 this . extensionsLoaded = true ;
332333 }
333334
335+ async uninstallExtension ( id : string ) {
336+ if ( ! process . env . ENABLE_EXTENSIONS ) return ;
337+
338+ const extension = this . view . getExtension ( id ) ;
339+ if ( ! extension ) return ;
340+
341+ await this . view . removeExtension ( id ) ;
342+
343+ await rf ( extension . path ) ;
344+ }
345+
334346 public onCreateTab = async ( details : chrome . tabs . CreateProperties ) => {
335347 const view = Application . instance . windows . list
336348 . find ( ( x ) => x . win . id === details . windowId )
0 commit comments