Skip to content

Commit

Permalink
Merge pull request #2798
Browse files Browse the repository at this point in the history
Work around welcome page disappearing post install.

Happens when the user allows Privacy Badger to run in Private windows
using the post-install Private browsing permission hanger in Firefox
before reviewing the welcome page.

Related Mozilla bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1558336
  • Loading branch information
ghostwords committed Sep 22, 2021
2 parents 053760b + 3126e4b commit 819e9f0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/js/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ function Badger() {
// set up periodic fetching of hashes from eff.org
setInterval(self.updateDntPolicyHashes.bind(self), utils.oneDay() * 4);

let privateStore = self.getPrivateSettings();
if (self.isFirstRun) {
// work around the welcome page getting closed by an extension restart
// such as in response to being granted Private Browsing permission
// from the post-install doorhanger on Firefox
setTimeout(function () {
privateStore.setItem("firstRunTimerFinished", true);
}, utils.oneMinute());

self.showFirstRunPage();

} else if (!privateStore.getItem("firstRunTimerFinished")) {
privateStore.setItem("firstRunTimerFinished", true);
self.showFirstRunPage();
}
});
Expand Down Expand Up @@ -880,8 +892,14 @@ Badger.prototype = {
}

// initialize any other private store (not-for-export) settings
if (!privateStore.hasItem("showLearningPrompt")) {
privateStore.setItem("showLearningPrompt", false);
let privateDefaultSettings = {
firstRunTimerFinished: false,
showLearningPrompt: false,
};
for (let key of Object.keys(privateDefaultSettings)) {
if (!privateStore.hasItem(key)) {
privateStore.setItem(key, privateDefaultSettings[key]);
}
}
badger.initDeprecations();

Expand Down

0 comments on commit 819e9f0

Please sign in to comment.