From 0a0ca5dabb9ccbef7504030d514147048dd011c3 Mon Sep 17 00:00:00 2001 From: Alexei Date: Fri, 3 Sep 2021 15:02:00 -0400 Subject: [PATCH] Work around welcome page disappearing post install --- src/js/background.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/js/background.js b/src/js/background.js index 59060ddc23..38d3e2cb4b 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -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(); } }); @@ -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();