[Pkg-mozext-commits] [requestpolicy] 114/280: [refact] tidy up: compat.rules -> RequestProcessor
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:30:08 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 25f0a18e02121031c8ab37a04b4e4fafe8bbf213
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Jan 6 02:27:33 2015 +0100
[refact] tidy up: compat.rules -> RequestProcessor
Compatibility-related code has been moved to a new file and is
now part of RequestProcessor.
requestpolicy-service.jsm now has less than 300 LOC, compared to
>2000 before forking.
---
.../request-processor.compat.js} | 291 +++------------------
src/content/lib/request-processor.jsm | 4 +-
src/content/lib/request-processor.redirects.js | 2 +-
src/content/main/requestpolicy-service.jsm | 269 -------------------
src/content/ui/menu.js | 2 +-
src/content/ui/overlay.js | 4 +-
6 files changed, 40 insertions(+), 532 deletions(-)
diff --git a/src/content/main/requestpolicy-service.jsm b/src/content/lib/request-processor.compat.js
similarity index 56%
copy from src/content/main/requestpolicy-service.jsm
copy to src/content/lib/request-processor.compat.js
index 6a18252..1cb0e15 100644
--- a/src/content/main/requestpolicy-service.jsm
+++ b/src/content/lib/request-processor.compat.js
@@ -21,44 +21,40 @@
* ***** END LICENSE BLOCK *****
*/
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-const Cu = Components.utils;
-
-let EXPORTED_SYMBOLS = ["rpService"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("chrome://requestpolicy/content/lib/script-loader.jsm");
ScriptLoader.importModules([
"lib/logger",
- "lib/prefs",
- "lib/utils/domains",
- "lib/policy-manager",
- "lib/request-processor",
- "lib/subscription",
"lib/utils",
- "lib/utils/constants",
"lib/process-environment"
], this);
-let rpService = (function() {
- let self;
+let RequestProcessor = (function(self) {
+ let internal = Utils.moduleInternal(self);
- // /////////////////////////////////////////////////////////////////////////
- // Internal Data
- // /////////////////////////////////////////////////////////////////////////
let conflictingExtensions = [];
let compatibilityRules = [];
let topLevelDocTranslationRules = {};
- let subscriptions = null;
+ ProcessEnvironment.enqueueStartupFunction(function() {
+ // Detect other installed extensions and the current application and do
+ // what is needed to allow their requests.
+ initializeExtensionCompatibility();
+ initializeApplicationCompatibility();
+
+ AddonManager.addAddonListener(addonListener);
+ });
+
+ // stop observers / listeners
+ ProcessEnvironment.pushShutdownFunction(function() {
+ AddonManager.removeAddonListener(addonListener);
+ });
+ // TODO: update compatibility rules etc. when addons are enabled/disabled
let addonListener = {
onDisabling : function(addon, needsRestart) {},
onUninstalling : function(addon, needsRestart) {},
@@ -66,29 +62,6 @@ let rpService = (function() {
};
- // /////////////////////////////////////////////////////////////////////////
- // Utility
- // /////////////////////////////////////////////////////////////////////////
-
- function handleUninstallOrDisable() {
- Logger.debug(Logger.TYPE_INTERNAL, "Performing 'disable' operations.");
- var resetLinkPrefetch = rpPrefBranch.getBoolPref(
- "prefetch.link.restoreDefaultOnUninstall");
- var resetDNSPrefetch = rpPrefBranch.getBoolPref(
- "prefetch.dns.restoreDefaultOnUninstall");
-
- if (resetLinkPrefetch) {
- if (rootPrefBranch.prefHasUserValue("network.prefetch-next")) {
- rootPrefBranch.clearUserPref("network.prefetch-next");
- }
- }
- if (resetDNSPrefetch) {
- if (rootPrefBranch.prefHasUserValue("network.dns.disablePrefetch")) {
- rootPrefBranch.clearUserPref("network.dns.disablePrefetch");
- }
- }
- Services.prefs.savePrefFile(null);
- }
function initializeExtensionCompatibility() {
@@ -119,6 +92,9 @@ let rpService = (function() {
}
}
+
+
+
function initializeExtCompatCallback(ext) {
if (!ext) {
return;
@@ -211,6 +187,9 @@ let rpService = (function() {
}
}
+
+
+
function initializeApplicationCompatibility() {
var appInfo = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo);
@@ -319,226 +298,22 @@ let rpService = (function() {
}
}
- function loadConfigAndRules() {
- subscriptions = new UserSubscriptions();
- PolicyManager.loadUserRules();
-
- Prefs.isDefaultAllow;
- var defaultPolicy = rpPrefBranch.defaultAllow ? 'allow' : 'deny';
-
- var failures = PolicyManager.loadSubscriptionRules(
- subscriptions.getSubscriptionInfo(defaultPolicy));
- // TODO: check a preference that indicates the last time we checked for
- // updates. Don't do it if we've done it too recently.
- // TODO: Maybe we should probably ship snapshot versions of the official
- // rulesets so that they can be available immediately after installation.
- var serials = {};
- for (var listName in failures) {
- serials[listName] = {};
- for (var subName in failures[listName]) {
- serials[listName][subName] = -1;
- }
- }
- var loadedSubs = PolicyManager.getSubscriptionRulesets();
- for (var listName in loadedSubs) {
- for (var subName in loadedSubs[listName]) {
- if (!serials[listName]) {
- serials[listName] = {};
- }
- var rawRuleset = loadedSubs[listName][subName].rawRuleset;
- serials[listName][subName] = rawRuleset._metadata['serial'];
- }
- }
- function updateCompleted(result) {
- Logger.info(Logger.TYPE_INTERNAL,
- 'Subscription updates completed: ' + result);
- }
- subscriptions.update(updateCompleted, serials, defaultPolicy);
- }
-
- // TODO: fix this
- function initializePrivateBrowsing() {
- try {
- var pbs = Cc["@mozilla.org/privatebrowsing;1"].
- getService(Ci.nsIPrivateBrowsingService);
- self._privateBrowsingEnabled = pbs.privateBrowsingEnabled;
- } catch (e) {
- // Ignore exceptions from browsers that do not support private browsing.
- }
- }
-
- function showWelcomeWindow() {
- if (!rpPrefBranch.getBoolPref("welcomeWindowShown")) {
- var url = "about:requestpolicy?setup";
-
- var wm = Cc['@mozilla.org/appshell/window-mediator;1'].
- getService(Ci.nsIWindowMediator);
- var windowtype = 'navigator:browser';
- var mostRecentWindow = wm.getMostRecentWindow(windowtype);
-
- // the gBrowser object of the firefox window
- var _gBrowser = mostRecentWindow.getBrowser();
-
- if (typeof(_gBrowser.addTab) != "function") return;
-
- _gBrowser.selectedTab = _gBrowser.addTab(url);
-
- rpPrefBranch.setBoolPref("welcomeWindowShown", true);
- Services.prefs.savePrefFile(null);
- }
- }
-
-
-
-
-
- // /////////////////////////////////////////////////////////////////////////
- // startup and shutdown functions
- // /////////////////////////////////////////////////////////////////////////
-
- // prepare back-end
- ProcessEnvironment.enqueueStartupFunction(function() {
- loadConfigAndRules();
- // Detect other installed extensions and the current application and do
- // what is needed to allow their requests.
- initializeExtensionCompatibility();
- initializeApplicationCompatibility();
- });
-
- // start observers / listeners
- ProcessEnvironment.enqueueStartupFunction(function() {
- ProcessEnvironment.obMan.observe({
- "http-on-modify-request": self.observe,
- "sessionstore-windows-restored": self.observe,
- "private-browsing": self.observe,
- SUBSCRIPTION_UPDATED_TOPIC: self.observe,
- SUBSCRIPTION_ADDED_TOPIC: self.observe,
- SUBSCRIPTION_REMOVED_TOPIC: self.observe
- });
- AddonManager.addAddonListener(addonListener);
- });
-
- // stop observers / listeners
- ProcessEnvironment.pushShutdownFunction(function() {
- AddonManager.removeAddonListener(addonListener);
- });
-
- ProcessEnvironment.pushShutdownFunction(function(data, reason) {
- if (reason == C.ADDON_DISABLE || reason == C.ADDON_UNINSTALL) {
- // TODO: Handle uninstallation in bootstrap.js, not here, RP might be
- // disabled when being uninstalled.
- handleUninstallOrDisable();
- }
- });
-
+ self.getCompatibilityRules = function() {
+ return compatibilityRules;
+ };
+ self.getConflictingExtensions = function() {
+ return conflictingExtensions;
+ };
- self = {
- // TODO: private windows instead.
- _privateBrowsingEnabled : false,
-
-
- isPrivateBrowsingEnabled: function() {
- return self._privateBrowsingEnabled;
- },
- getSubscriptions: function() {
- return subscriptions;
- },
- getCompatibilityRules: function() {
- return compatibilityRules;
- },
-
-
-
-
- // /////////////////////////////////////////////////////////////////////////
- // nsIRequestPolicy interface
- // /////////////////////////////////////////////////////////////////////////
-
- getConflictingExtensions : function() {
- return conflictingExtensions;
- },
-
- getTopLevelDocTranslation : function(uri) {
- // We're not sure if the array will be fully populated during init. This
- // is especially a concern given the async addon manager API in Firefox 4.
- return topLevelDocTranslationRules[uri] || null;
- },
-
-
-
-
- // /////////////////////////////////////////////////////////////////////////
- // nsIObserver interface
- // /////////////////////////////////////////////////////////////////////////
-
- observe: function(subject, topic, data) {
- switch (topic) {
- case "http-on-modify-request" :
- // TODO: observe "http-on-modify-request" not here, but in
- // RequestProcessor
- RequestProcessor._examineHttpRequest(subject);
- break;
- case SUBSCRIPTION_UPDATED_TOPIC:
- Logger.debug(Logger.TYPE_INTERNAL, 'XXX updated: ' + data);
- // TODO: check if the subscription is enabled. The user might have
- // disabled it between the time the update started and when it
- // completed.
- var subInfo = JSON.parse(data);
- var failures = PolicyManager.loadSubscriptionRules(subInfo);
- break;
-
- case SUBSCRIPTION_ADDED_TOPIC:
- Logger.debug(Logger.TYPE_INTERNAL, 'XXX added: ' + data);
- var subInfo = JSON.parse(data);
- var failures = PolicyManager.loadSubscriptionRules(subInfo);
- var failed = false;
- for (var listName in failures) {
- failed = true;
- }
- if (failed) {
- var serials = {};
- for (var listName in subInfo) {
- if (!serials[listName]) {
- serials[listName] = {};
- }
- for (var subName in subInfo[listName]) {
- serials[listName][subName] = -1;
- }
- }
- let updateCompleted = function(result) {
- Logger.info(Logger.TYPE_INTERNAL,
- 'Subscription update completed: ' + result);
- }
- subscriptions.update(updateCompleted, serials);
- }
- break;
-
- case SUBSCRIPTION_REMOVED_TOPIC:
- Logger.debug(Logger.TYPE_INTERNAL, 'YYY: ' + data);
- var subInfo = JSON.parse(data);
- var failures = PolicyManager.unloadSubscriptionRules(subInfo);
- break;
-
- case "sessionstore-windows-restored":
- showWelcomeWindow();
- break;
- case "private-browsing" :
- if (data == "enter") {
- self._privateBrowsingEnabled = true;
- } else if (data == "exit") {
- self._privateBrowsingEnabled = false;
- PolicyManager.revokeTemporaryRules();
- }
- break;
- default :
- Logger.warning(Logger.TYPE_ERROR, "uknown topic observed: " + topic);
- }
- },
+ self.getTopLevelDocTranslation = function(uri) {
+ // We're not sure if the array will be fully populated during init. This
+ // is especially a concern given the async addon manager API in Firefox 4.
+ return topLevelDocTranslationRules[uri] || null;
};
return self;
-}());
+}(RequestProcessor || {}));
diff --git a/src/content/lib/request-processor.jsm b/src/content/lib/request-processor.jsm
index f6444d4..92bb8f0 100644
--- a/src/content/lib/request-processor.jsm
+++ b/src/content/lib/request-processor.jsm
@@ -800,7 +800,7 @@ let RequestProcessor = (function(self) {
return accept("Allowed by subscription policy", request);
}
- let compatibilityRules = rpService.getCompatibilityRules();
+ let compatibilityRules = self.getCompatibilityRules();
for (var i = 0; i < compatibilityRules.length; i++) {
var rule = compatibilityRules[i];
var allowOrigin = rule[0] ? originURI.indexOf(rule[0]) == 0 : true;
@@ -1076,3 +1076,5 @@ let RequestProcessor = (function(self) {
Services.scriptloader.loadSubScript('chrome://requestpolicy/content/lib/' +
'request-processor.redirects.js');
+Services.scriptloader.loadSubScript('chrome://requestpolicy/content/lib/' +
+ 'request-processor.compat.js');
diff --git a/src/content/lib/request-processor.redirects.js b/src/content/lib/request-processor.redirects.js
index d6636fd..75c579b 100644
--- a/src/content/lib/request-processor.redirects.js
+++ b/src/content/lib/request-processor.redirects.js
@@ -140,7 +140,7 @@ let RequestProcessor = (function(self) {
return new RequestResult(true, REQUEST_REASON_RELATIVE_URL);
}
- let compatibilityRules = rpService.getCompatibilityRules();
+ let compatibilityRules = self.getCompatibilityRules();
for (var i = 0; i < compatibilityRules.length; i++) {
var rule = compatibilityRules[i];
var allowOrigin = rule[0] ? originURI.indexOf(rule[0]) == 0 : true;
diff --git a/src/content/main/requestpolicy-service.jsm b/src/content/main/requestpolicy-service.jsm
index 6a18252..3248809 100644
--- a/src/content/main/requestpolicy-service.jsm
+++ b/src/content/main/requestpolicy-service.jsm
@@ -29,7 +29,6 @@ let EXPORTED_SYMBOLS = ["rpService"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("chrome://requestpolicy/content/lib/script-loader.jsm");
ScriptLoader.importModules([
@@ -53,18 +52,8 @@ let rpService = (function() {
// Internal Data
// /////////////////////////////////////////////////////////////////////////
- let conflictingExtensions = [];
- let compatibilityRules = [];
- let topLevelDocTranslationRules = {};
-
let subscriptions = null;
- let addonListener = {
- onDisabling : function(addon, needsRestart) {},
- onUninstalling : function(addon, needsRestart) {},
- onOperationCancelled : function(addon, needsRestart) {}
- };
-
// /////////////////////////////////////////////////////////////////////////
// Utility
@@ -91,234 +80,6 @@ let rpService = (function() {
}
- function initializeExtensionCompatibility() {
- if (compatibilityRules.length != 0) {
- return;
- }
-
- var idArray = [];
- idArray.push("greasefire at skrul.com"); // GreaseFire
- idArray.push("{0f9daf7e-2ee2-4fcf-9d4f-d43d93963420}"); // Sage-Too
- idArray.push("{899DF1F8-2F43-4394-8315-37F6744E6319}"); // NewsFox
- idArray.push("brief at mozdev.org"); // Brief
- idArray.push("foxmarks at kei.com"); // Xmarks Sync (a.k.a. Foxmarks)
- // Norton Safe Web Lite Toolbar
- idArray.push("{203FB6B2-2E1E-4474-863B-4C483ECCE78E}");
- // Norton Toolbar (a.k.a. NIS Toolbar)
- idArray.push("{0C55C096-0F1D-4F28-AAA2-85EF591126E7}");
- // Norton Toolbar 2011.7.0.8
- idArray.push("{2D3F3651-74B9-4795-BDEC-6DA2F431CB62}");
- idArray.push("{c45c406e-ab73-11d8-be73-000a95be3b12}"); // Web Developer
- idArray.push("{c07d1a49-9894-49ff-a594-38960ede8fb9}"); // Update Scanner
- idArray.push("FirefoxAddon at similarWeb.com"); // SimilarWeb
- idArray.push("{6614d11d-d21d-b211-ae23-815234e1ebb5}"); // Dr. Web Link Checker
-
- for (let i in idArray) {
- Logger.info(Logger.TYPE_INTERNAL, "Extension check: " + idArray[i]);
- AddonManager.getAddonByID(idArray[i], initializeExtCompatCallback);
- }
- }
-
- function initializeExtCompatCallback(ext) {
- if (!ext) {
- return;
- }
-
- if (ext.isActive === false) {
- Logger.info(Logger.TYPE_INTERNAL, "Extension is not active: " + ext.name);
- return;
- }
-
- switch (ext.id) {
- case "greasefire at skrul.com" : // Greasefire
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- compatibilityRules.push(
- ["file://", "http://userscripts.org/", ext.name]);
- compatibilityRules.push(
- ["file://", "http://static.userscripts.org/", ext.name]);
- break;
- case "{0f9daf7e-2ee2-4fcf-9d4f-d43d93963420}" : // Sage-Too
- case "{899DF1F8-2F43-4394-8315-37F6744E6319}" : // NewsFox
- case "brief at mozdev.org" : // Brief
- Logger.info(Logger.TYPE_INTERNAL, "Conflicting extension: " + ext.name);
- compatibilityRules.push(
- ["resource://brief-content/", null, ext.name]);
- conflictingExtensions.push({
- "id" : ext.id,
- "name" : ext.name,
- "version" : ext.version
- });
- break;
- case "foxmarks at kei.com" : // Xmarks Sync
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- compatibilityRules.push([
- "https://login.xmarks.com/",
- "https://static.xmarks.com/",
- ext.name
- ]);
- break;
- case "{203FB6B2-2E1E-4474-863B-4C483ECCE78E}" : // Norton Safe Web Lite
- case "{0C55C096-0F1D-4F28-AAA2-85EF591126E7}" : // Norton NIS Toolbar
- case "{2D3F3651-74B9-4795-BDEC-6DA2F431CB62}" : // Norton Toolbar
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- compatibilityRules.push([null, "symnst:", ext.name]);
- compatibilityRules.push([null, "symres:", ext.name]);
- break;
- case "{c45c406e-ab73-11d8-be73-000a95be3b12}" : // Web Developer
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- compatibilityRules.push([
- "about:blank",
- "http://jigsaw.w3.org/css-validator/validator",
- ext.name
- ]);
- compatibilityRules.push(
- ["about:blank", "http://validator.w3.org/check", ext.name]);
- break;
- case "{c07d1a49-9894-49ff-a594-38960ede8fb9}" : // Update Scanner
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- var orig = "chrome://updatescan/content/diffPage.xul";
- var translated = "data:text/html";
- topLevelDocTranslationRules[orig] = translated;
- break;
- case "FirefoxAddon at similarWeb.com" : // SimilarWeb
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- compatibilityRules.push([
- "http://api2.similarsites.com/",
- "http://images2.similargroup.com/",
- ext.name
- ]);
- compatibilityRules.push([
- "http://www.similarweb.com/",
- "http://go.similarsites.com/",
- ext.name
- ]);
- break;
- case "{6614d11d-d21d-b211-ae23-815234e1ebb5}" : // Dr. Web Link Checker
- Logger.info(Logger.TYPE_INTERNAL,
- "Using extension compatibility rules for: " + ext.name);
- compatibilityRules.push([null, "http://st.drweb.com/", ext.name]);
- break;
- default :
- Logger.severe(Logger.TYPE_INTERNAL,
- "Unhandled extension (id typo?): " + ext.name);
- break;
- }
- }
-
- function initializeApplicationCompatibility() {
- var appInfo = Cc["@mozilla.org/xre/app-info;1"].
- getService(Ci.nsIXULAppInfo);
-
- // Mozilla updates (doing this for all applications, not just individual
- // applications from the Mozilla community that I'm aware of).
- // At least the http url is needed for Firefox updates, adding the https
- // one as well to be safe.
- compatibilityRules.push(
- ["http://download.mozilla.org/", null, appInfo.vendor]);
- compatibilityRules.push(
- ["https://download.mozilla.org/", null, appInfo.vendor]);
- // There are redirects from 'addons' to 'releases' when installing addons
- // from AMO. Adding the origin of 'releases' to be safe in case those
- // start redirecting elsewhere at some point.
- compatibilityRules.push(
- ["http://addons.mozilla.org/", null, appInfo.vendor]);
- compatibilityRules.push(
- ["https://addons.mozilla.org/", null, appInfo.vendor]);
- compatibilityRules.push(
- ["http://releases.mozilla.org/", null, appInfo.vendor]);
- compatibilityRules.push(
- ["https://releases.mozilla.org/", null, appInfo.vendor]);
- // Firefox 4 has the about:addons page open an iframe to the mozilla site.
- // That opened page grabs content from other mozilla domains.
- compatibilityRules.push([
- "about:addons",
- "https://services.addons.mozilla.org/",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://services.addons.mozilla.org/",
- "https://static.addons.mozilla.net/",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://services.addons.mozilla.org/",
- "https://addons.mozilla.org/",
- appInfo.vendor]);
- compatibilityRules.push([
- "https://services.addons.mozilla.org/",
- "https://www.mozilla.com/",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://services.addons.mozilla.org/",
- "https://www.getpersonas.com/",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://services.addons.mozilla.org/",
- "https://static-cdn.addons.mozilla.net/",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://services.addons.mozilla.org/",
- "https://addons.cdn.mozilla.net/",
- appInfo.vendor
- ]);
- // Firefox 4 uses an about:home page that is locally stored but can be
- // the origin for remote requests. See bug #140 for more info.
- compatibilityRules.push(["about:home", null, appInfo.vendor]);
- // Firefox Sync uses a google captcha.
- compatibilityRules.push([
- "https://auth.services.mozilla.com/",
- "https://api-secure.recaptcha.net/challenge?",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://api-secure.recaptcha.net/challenge?",
- "https://www.google.com/recaptcha/api/challenge?",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "https://auth.services.mozilla.com/",
- "https://www.google.com/recaptcha/api/",
- appInfo.vendor
- ]);
- // Firefox 13 added links from about:newtab
- compatibilityRules.push(["about:newtab", null, appInfo.vendor]);
-
- // Flock
- if (appInfo.ID == "{a463f10c-3994-11da-9945-000d60ca027b}") {
- Logger.info(Logger.TYPE_INTERNAL,
- "Application detected: " + appInfo.vendor);
- compatibilityRules.push(
- ["about:myworld", "http://www.flock.com/", appInfo.vendor]);
- compatibilityRules.push(["about:flock", null, appInfo.vendor]);
- compatibilityRules.push([
- "http://www.flock.com/rss",
- "http://feeds.feedburner.com/flock",
- appInfo.vendor
- ]);
- compatibilityRules.push([
- "http://feeds.feedburner.com/",
- "http://www.flock.com/",
- appInfo.vendor
- ]);
- }
-
- // Seamonkey
- if (appInfo.ID == "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}") {
- Logger.info(Logger.TYPE_INTERNAL, "Application detected: Seamonkey");
- compatibilityRules.push(["mailbox:", null, "Seamonkey"]);
- compatibilityRules.push([null, "mailbox:", "Seamonkey"]);
- }
- }
-
function loadConfigAndRules() {
subscriptions = new UserSubscriptions();
PolicyManager.loadUserRules();
@@ -399,10 +160,6 @@ let rpService = (function() {
// prepare back-end
ProcessEnvironment.enqueueStartupFunction(function() {
loadConfigAndRules();
- // Detect other installed extensions and the current application and do
- // what is needed to allow their requests.
- initializeExtensionCompatibility();
- initializeApplicationCompatibility();
});
// start observers / listeners
@@ -415,12 +172,6 @@ let rpService = (function() {
SUBSCRIPTION_ADDED_TOPIC: self.observe,
SUBSCRIPTION_REMOVED_TOPIC: self.observe
});
- AddonManager.addAddonListener(addonListener);
- });
-
- // stop observers / listeners
- ProcessEnvironment.pushShutdownFunction(function() {
- AddonManager.removeAddonListener(addonListener);
});
ProcessEnvironment.pushShutdownFunction(function(data, reason) {
@@ -447,26 +198,6 @@ let rpService = (function() {
getSubscriptions: function() {
return subscriptions;
},
- getCompatibilityRules: function() {
- return compatibilityRules;
- },
-
-
-
-
- // /////////////////////////////////////////////////////////////////////////
- // nsIRequestPolicy interface
- // /////////////////////////////////////////////////////////////////////////
-
- getConflictingExtensions : function() {
- return conflictingExtensions;
- },
-
- getTopLevelDocTranslation : function(uri) {
- // We're not sure if the array will be fully populated during init. This
- // is especially a concern given the async addon manager API in Firefox 4.
- return topLevelDocTranslationRules[uri] || null;
- },
diff --git a/src/content/ui/menu.js b/src/content/ui/menu.js
index cb353f7..f1cb44f 100644
--- a/src/content/ui/menu.js
+++ b/src/content/ui/menu.js
@@ -92,7 +92,7 @@ requestpolicy.menu = (function() {
self._addRulesList = document.getElementById("rp-rules-add");
self._removeRulesList = document.getElementById("rp-rules-remove");
- var conflictCount = rpService.getConflictingExtensions().length;
+ var conflictCount = RequestProcessor.getConflictingExtensions().length;
var hideConflictInfo = (conflictCount == 0);
}
};
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index 2c50b13..4281cb0 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -1021,7 +1021,7 @@ requestpolicy.overlay = (function() {
*/
self.getTopLevelDocumentUri = function() {
let uri = gBrowser.selectedBrowser.currentURI.spec;
- return rpService.getTopLevelDocTranslation(uri) ||
+ return RequestProcessor.getTopLevelDocTranslation(uri) ||
DomainUtil.stripFragment(uri);
};
@@ -1212,7 +1212,7 @@ requestpolicy.overlay = (function() {
};
// showExtensionConflictInfo : function() {
- // var ext = rpService.getConflictingExtensions();
+ // var ext = RequestProcessor.getConflictingExtensions();
// var extJson = JSON.stringify(ext);
// self._openInNewTab(self._extensionConflictInfoUri
// + encodeURIComponent(extJson));
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list