Skip to content

Commit

Permalink
Fix mozilla#177: Disable price polling in Private Browsing windows
Browse files Browse the repository at this point in the history
Update `shouldUpdatePrices` with a check for whether or not the active window is a private window.

I did not add a check for `isActiveWindowPrivate` in `shouldExtract` in `./src/privacy.js`, despite the fact that `browser.extension.inIncognitoContext` returns the "wrong" value for background extraction, because background extraction is gated by the `shouldUpdatePrices` check.
  • Loading branch information
biancadanforth committed Nov 20, 2018
1 parent 836dfaa commit 6da5218
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/privacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ export async function shouldCollectTelemetry(method) {
* @return {boolean}
*/
export async function shouldUpdatePrices() {
// TODO (bdanforth): Add private browsing check per #177
return true;
return !isActiveWindowPrivate();
}

async function trackingProtectionEnabled() {
Expand All @@ -69,3 +68,8 @@ async function cookiesBlocked() {

return true;
}

async function isActiveWindowPrivate() {
const activeWindow = await browser.windows.getCurrent();
return activeWindow.incognito;
}

0 comments on commit 6da5218

Please sign in to comment.