Bug 896114 - Don't initialize UserAgentOverrides on desktop. r=dolske

This commit is contained in:
Dão Gottwald 2013-07-30 22:51:25 +02:00
Родитель dd55cc6303
Коммит 60765a4876
3 изменённых файлов: 3 добавлений и 27 удалений

Просмотреть файл

@ -223,8 +223,6 @@ pref("general.autoScroll", false);
pref("general.autoScroll", true);
#endif
pref("general.useragent.complexOverride.moodle", false); // bug 797703
// At startup, check if we're the default browser and prompt user if not.
pref("browser.shell.checkDefaultBrowser", true);
pref("browser.shell.shortcutFavicons",true);

Просмотреть файл

@ -20,9 +20,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
"resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides",
"resource://gre/modules/UserAgentOverrides.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
@ -456,8 +453,6 @@ BrowserGlue.prototype = {
// handle any UI migration
this._migrateUI();
this._setUpUserAgentOverrides();
this._syncSearchEngines();
webappsUI.init();
@ -471,22 +466,6 @@ BrowserGlue.prototype = {
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
},
_setUpUserAgentOverrides: function BG__setUpUserAgentOverrides() {
UserAgentOverrides.init();
if (Services.prefs.getBoolPref("general.useragent.complexOverride.moodle")) {
UserAgentOverrides.addComplexOverride(function (aHttpChannel, aOriginalUA) {
let cookies;
try {
cookies = aHttpChannel.getRequestHeader("Cookie");
} catch (e) { /* no cookie sent */ }
if (cookies && cookies.indexOf("MoodleSession") > -1)
return aOriginalUA.replace(/Gecko\/[^ ]*/, "Gecko/20100101");
return null;
});
}
},
_trackSlowStartup: function () {
if (Services.startup.interrupted ||
Services.prefs.getBoolPref("browser.slowStartup.notificationDisabled"))
@ -613,7 +592,6 @@ BrowserGlue.prototype = {
*/
_onProfileShutdown: function BG__onProfileShutdown() {
BrowserNewTabPreloader.uninit();
UserAgentOverrides.uninit();
webappsUI.uninit();
SignInToWebsiteUX.uninit();
webrtcUI.uninit();

Просмотреть файл

@ -50,9 +50,9 @@ this.UserAgentOverrides = {
},
getOverrideForURI: function uao_getOverrideForURI(aURI) {
if (!gInitialized)
return null;
if (!(aURI instanceof Ci.nsIStandardURL))
if (!gInitialized ||
!gOverrides.size ||
!(aURI instanceof Ci.nsIStandardURL))
return null;
let host = aURI.asciiHost;