mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 15:26:07 +00:00
Bug 1351980 - Initialize and uninitialize UserAgentOverrides.jsm for Firefox; r=mconley
This commit is contained in:
parent
7d75784cbc
commit
929501a6eb
@ -247,8 +247,6 @@ var whitelist = new Set([
|
||||
{file: "resource://gre/modules/PropertyListUtils.jsm", platforms: ["linux", "win"]},
|
||||
// Bug 1351093
|
||||
{file: "resource://gre/modules/Sntp.jsm"},
|
||||
// Bug 1351980
|
||||
{file: "resource://gre/modules/UserAgentOverrides.jsm"},
|
||||
// Bug 1351097
|
||||
{file: "resource://gre/modules/accessibility/AccessFu.jsm"},
|
||||
// Bug 1351099
|
||||
|
@ -89,6 +89,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
|
||||
["WebChannel", "resource://gre/modules/WebChannel.jsm"],
|
||||
["WindowsRegistry", "resource://gre/modules/WindowsRegistry.jsm"],
|
||||
["webrtcUI", "resource:///modules/webrtcUI.jsm"],
|
||||
["UserAgentOverrides", "resource://gre/modules/UserAgentOverrides.jsm"],
|
||||
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
|
||||
|
||||
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||
@ -431,6 +432,8 @@ BrowserGlue.prototype = {
|
||||
// and e10s are active together.
|
||||
E10SAccessibilityCheck.init();
|
||||
}
|
||||
|
||||
UserAgentOverrides.init();
|
||||
},
|
||||
|
||||
// cleanup (called on application shutdown)
|
||||
@ -470,6 +473,8 @@ BrowserGlue.prototype = {
|
||||
os.removeObserver(this, "browser-search-engine-modified");
|
||||
os.removeObserver(this, "flash-plugin-hang");
|
||||
os.removeObserver(this, "xpi-signature-changed");
|
||||
|
||||
UserAgentOverrides.uninit();
|
||||
},
|
||||
|
||||
_onAppDefaults: function BG__onAppDefaults() {
|
||||
|
@ -231,11 +231,6 @@ function testOverrides(callback) {
|
||||
});
|
||||
}
|
||||
|
||||
SpecialPowers.loadChromeScript(_ => {
|
||||
Components.utils.import("resource://gre/modules/UserAgentOverrides.jsm");
|
||||
UserAgentOverrides.init();
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestCompleteLog();
|
||||
SimpleTest.requestLongerTimeout(5);
|
||||
|
@ -200,15 +200,13 @@ SpecialPowers.pushPrefEnv({
|
||||
[PREF_APP_UPDATE_TIMERMINIMUMDELAY, 0]
|
||||
]
|
||||
}, function () {
|
||||
chromeScript.sendSyncMessage("UAO-uninit");
|
||||
|
||||
// Sets the OVERRIDES var in the chrome script.
|
||||
// We do this to avoid code duplication.
|
||||
chromeScript.sendSyncMessage("set-overrides", OVERRIDES);
|
||||
|
||||
// testProfileLoad, testDownload, and testProfileSave must run in this order
|
||||
// because testDownload depends on testProfileLoad to call UAO.init()
|
||||
// and testProfileSave depends on testDownload to save overrides to the profile
|
||||
// because testDownload depends on testProfileLoad and testProfileSave depends
|
||||
// on testDownload to save overrides to the profile
|
||||
chromeScript.sendAsyncMessage("testProfileLoad", location.hostname);
|
||||
});
|
||||
|
||||
@ -218,13 +216,8 @@ const chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
Components.classes["@mozilla.org/updates/timer-manager;1"].getService(
|
||||
Components.interfaces.nsIObserver).observe(null, "utm-test-init", "");
|
||||
|
||||
Components.utils.import("resource://gre/modules/UserAgentOverrides.jsm");
|
||||
|
||||
var _notifyOnUpdate = false;
|
||||
|
||||
var UAO = UserAgentOverrides;
|
||||
UAO.uninit();
|
||||
|
||||
Components.utils.import("resource://gre/modules/FileUtils.jsm");
|
||||
var FU = FileUtils;
|
||||
|
||||
@ -318,8 +311,6 @@ const chromeScript = SpecialPowers.loadChromeScript(_ => {
|
||||
addMessageListener("testProfileSave", testProfileSave);
|
||||
addMessageListener("testProfileLoad", testProfileLoad);
|
||||
addMessageListener("set-overrides", function(overrides) { OVERRIDES = overrides});
|
||||
addMessageListener("UAO-init", function() { UAO.init(); });
|
||||
addMessageListener("UAO-uninit", function() { UAO.uninit(); });
|
||||
addMessageListener("notify-on-update", () => { _notifyOnUpdate = true });
|
||||
});
|
||||
|
||||
@ -328,9 +319,6 @@ chromeScript.addMessageListener("testProfileLoadDone", function() {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [[PREF_UPDATES_ENABLED, true]]
|
||||
}, function () {
|
||||
// initialize UserAgentOverrides.jsm and
|
||||
// UserAgentUpdates.jsm and load saved file
|
||||
chromeScript.sendSyncMessage("UAO-init");
|
||||
(function waitForLoad() {
|
||||
var ifr = document.createElement('IFRAME');
|
||||
ifr.src = location.origin;
|
||||
|
Loading…
x
Reference in New Issue
Block a user