diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-03-24 21:11:53 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-03-24 21:11:53 +0100 |
commit | cd2ffb4b8f78caf7ccfe29bfa8e85ea806b7e6b0 (patch) | |
tree | 415515c0045a4670368c6cb91052e6f723a1d4d6 | |
parent | df9ab936f298037212f8f8f759e0de9ffed153d2 (diff) | |
download | UXP-cd2ffb4b8f78caf7ccfe29bfa8e85ea806b7e6b0.tar UXP-cd2ffb4b8f78caf7ccfe29bfa8e85ea806b7e6b0.tar.gz UXP-cd2ffb4b8f78caf7ccfe29bfa8e85ea806b7e6b0.tar.lz UXP-cd2ffb4b8f78caf7ccfe29bfa8e85ea806b7e6b0.tar.xz UXP-cd2ffb4b8f78caf7ccfe29bfa8e85ea806b7e6b0.zip |
Revert "Issue #1482 - Give dynamic SSUAO rules priority over static ones"
This reverts commit a20f208834b87dfdd10dee3267056a8492a2b649.
-rw-r--r-- | netwerk/protocol/http/UserAgentOverrides.jsm | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/netwerk/protocol/http/UserAgentOverrides.jsm b/netwerk/protocol/http/UserAgentOverrides.jsm index 425bdfd72..aa1325a64 100644 --- a/netwerk/protocol/http/UserAgentOverrides.jsm +++ b/netwerk/protocol/http/UserAgentOverrides.jsm @@ -30,7 +30,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "ppmm", var gPrefBranch; var gOverrides = new Map; var gUpdatedOverrides; -var gOldDynOverrides; var gOverrideForHostCache = new Map; var gInitialized = false; var gOverrideFunctions = [ @@ -56,10 +55,7 @@ this.UserAgentOverrides = { } UserAgentUpdates.init(function(overrides) { - if (overrides == gOldDynOverrides) { - return; - } - gOldDynOverrides = overrides; + gOverrideForHostCache.clear(); if (overrides) { for (let domain in overrides) { overrides[domain] = getUserAgentFromOverride(overrides[domain]); @@ -67,7 +63,6 @@ this.UserAgentOverrides = { overrides.get = function(key) { return this[key]; }; } gUpdatedOverrides = overrides; - buildOverrides(); }); buildOverrides(); @@ -164,22 +159,15 @@ function buildOverrides() { if (!Services.prefs.getBoolPref(PREF_OVERRIDES_ENABLED)) return; + let builtUAs = new Map; let domains = gPrefBranch.getChildList(""); - // Since the static override map has the highest priority, we build it so - // that it includes only domains with user-set overrides and domains with - // default pre-set overrides that are not overridden by dynamic updates. for (let domain of domains) { - if (!(gUpdatedOverrides && gUpdatedOverrides.get(domain)) || - gPrefBranch.prefHasUserValue(domain)) { - // Here we selected domains that are not dynamically overridden - // or have a user-set override. - let override = gPrefBranch.getCharPref(domain); - let userAgent = getUserAgentFromOverride(override); - - if (userAgent != DEFAULT_UA) { - gOverrides.set(domain, userAgent); - } + let override = gPrefBranch.getCharPref(domain); + let userAgent = getUserAgentFromOverride(override); + + if (userAgent != DEFAULT_UA) { + gOverrides.set(domain, userAgent); } } } |