Skip to content

Commit

Permalink
Store container id to re-use after update or something similar
Browse files Browse the repository at this point in the history
(we still unable to track disablig/uninstalling…)
  • Loading branch information
Infocatcher committed Oct 5, 2017
1 parent fb833d8 commit 938e7a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ browser.storage.local.get().then(function(o) {
prefs[key] = changes[key].newValue;
});
Object.assign(prefs, o);
privateContainerId = prefs.privateContainerId || null;

for(var key in o)
return; // Prefs already saved
Expand Down Expand Up @@ -122,6 +123,7 @@ browser.tabs.onRemoved.addListener(function(tabId, removeInfo) {
!count && browser.contextualIdentities.remove(privateContainerId).then(function() {
_log("Removed last private tab => remove container");
privateContainerId = null;
browser.storage.local.remove("privateContainerId");
});
}, tabId);
});
Expand All @@ -143,8 +145,12 @@ function validateContainer(sId, callback) {
}
function createAndStoreContainer(callback) {
createContainer(function(sId) {
if(sId)
if(sId) {
privateContainerId = sId;
browser.storage.local.set({
privateContainerId: sId
});
}
callback(sId);
});
}
Expand Down

0 comments on commit 938e7a1

Please sign in to comment.