Basically there were 3 main entry points where UI could be added in a private window:
Inside WindowWatchers.jsm; I now check for PB mode and don't add any window listeners to existing or new windows that are private.
Inside WebRequest.onBeforeRequest: I now check for PB mode and don't call showPageAction or setPageActionCounter in private windows.
Inside every frame script (Services.mm.loadFrameScript()); I now check for PB mode before any new tab page content is added.
Added 'win' argument to setPageActionCounter and showPageAction methods to check for PB mode within, as there are cases when both a private and non-private window are open and these methods can get called from the non-private window.
Though there is no UI in PB and no data collection, we do still block requests in PB and those blocked resources/ads/time saved quantities get added to the session totals visible in non-PB mode new tab pages.
Before:
After:
Also I noticed that in private windows, the 'new tab' page is 'about:privatebrowsing' instead of 'about:newtab'. This page shows users in our experimental branch (where we tell them TP is on) that TP is off. This can be confusing, and I should check and see if there's an easy way to override the new tab page in PB mode.
Basically there were 3 main entry points where UI could be added in a private window:
Added 'win' argument to setPageActionCounter and showPageAction methods to check for PB mode within, as there are cases when both a private and non-private window are open and these methods can get called from the non-private window.
Though there is no UI in PB and no data collection, we do still block requests in PB and those blocked resources/ads/time saved quantities get added to the session totals visible in non-PB mode new tab pages.
Before:
After:
Also I noticed that in private windows, the 'new tab' page is 'about:privatebrowsing' instead of 'about:newtab'. This page shows users in our experimental branch (where we tell them TP is on) that TP is off. This can be confusing, and I should check and see if there's an easy way to override the new tab page in PB mode.
Before:
After: