File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
webextension/js/background Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,12 @@ const backgroundLogic = {
2525 return false ;
2626 } ,
2727
28- async deleteContainer ( userContextId ) {
28+ async deleteContainer ( userContextId , removed = false ) {
2929 await this . _closeTabs ( userContextId ) ;
30- await browser . contextualIdentities . remove ( this . cookieStoreId ( userContextId ) ) ;
30+ if ( ! removed ) {
31+ await browser . contextualIdentities . remove ( this . cookieStoreId ( userContextId ) ) ;
32+ }
3133 assignManager . deleteContainer ( userContextId ) ;
32- await browser . runtime . sendMessage ( {
33- method : "forgetIdentityAndRefresh"
34- } ) ;
3534 return { done : true , userContextId} ;
3635 } ,
3736
@@ -158,13 +157,13 @@ const backgroundLogic = {
158157 const cookieStoreId = this . cookieStoreId ( userContextId ) ;
159158 let tabs ;
160159 /* if we have no windowId we are going to close all this container (used for deleting) */
161- if ( windowId ) {
160+ if ( windowId !== false ) {
162161 tabs = await browser . tabs . query ( {
163162 cookieStoreId,
164163 windowId
165164 } ) ;
166165 } else {
167- await browser . tabs . query ( {
166+ tabs = await browser . tabs . query ( {
168167 cookieStoreId
169168 } ) ;
170169 }
Original file line number Diff line number Diff line change @@ -75,6 +75,13 @@ const messageHandler = {
7575 return response ;
7676 } ) ;
7777
78+ if ( browser . contextualIdentities . onRemoved ) {
79+ browser . contextualIdentities . onRemoved . addListener ( ( { contextualIdentity} ) => {
80+ const userContextId = backgroundLogic . getUserContextIdFromCookieStoreId ( contextualIdentity . cookieStoreId ) ;
81+ backgroundLogic . deleteContainer ( userContextId , true ) ;
82+ } ) ;
83+ }
84+
7885 // Handles messages from sdk code
7986 const port = browser . runtime . connect ( ) ;
8087 port . onMessage . addListener ( m => {
You can’t perform that action at this time.
0 commit comments