Skip to content

Commit

Permalink
Optimize usage of window.TrackingProtection
Browse files Browse the repository at this point in the history
  • Loading branch information
Infocatcher committed Dec 9, 2015
1 parent b2be6ac commit 5914ede
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,13 @@ var privateTab = {
var identityPopup = document.getElementById("identity-popup");
identityPopup && identityPopup.removeEventListener("popupshowing", this, true);
if(reason != WINDOW_CLOSED) try {
window.TrackingProtection.updateEnabled();
if(!window.TrackingProtection.enabled)
window.TrackingProtection.icon.removeAttribute("state");
if(window.XULBrowserWindow && "_state" in window.XULBrowserWindow)
window.TrackingProtection.onSecurityChange(window.XULBrowserWindow._state, true /*aIsSimulated*/);
var TrackingProtection = window.TrackingProtection;
TrackingProtection.updateEnabled();
if(!TrackingProtection.enabled)
TrackingProtection.icon.removeAttribute("state");
var XULBrowserWindow = window.XULBrowserWindow;
if(XULBrowserWindow && "_state" in XULBrowserWindow)
TrackingProtection.onSecurityChange(XULBrowserWindow._state, true /*aIsSimulated*/);
}
catch(e) {
Components.utils.reportError(e);
Expand Down Expand Up @@ -3777,11 +3779,9 @@ var privateTab = {
if(prefs.get("patchDownloads"))
this.updateDownloadPanel(window, isPrivate);
if(!isPrivate && "TrackingProtection" in window) window.setTimeout(function() { // Firefox 42+
if(
!window.TrackingProtection.enabled
&& window.TrackingProtection.icon.hasAttribute("state")
) {
window.TrackingProtection.icon.removeAttribute("state");
var TrackingProtection = window.TrackingProtection;
if(!TrackingProtection.enabled && TrackingProtection.icon.hasAttribute("state")) {
TrackingProtection.icon.removeAttribute("state");
_log("Hide tracking protection icon");
}
}, 0);
Expand Down

0 comments on commit 5914ede

Please sign in to comment.