[Pkg-mozext-commits] [requestpolicy] 177/257: [ref] JSCS: run `jscs --fix 'src/'`
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:10 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 2809b72215256bd04662403b7f70b2010b9ae574
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Dec 1 17:26:34 2015 +0100
[ref] JSCS: run `jscs --fix 'src/'`
Apply automatic JSCS fixes.
---
src/bootstrap.js | 4 +-
src/content/lib/environment.jsm | 18 +-
src/content/lib/environment.process.js | 26 +--
.../lib/framescript-to-overlay-communication.jsm | 2 +-
src/content/lib/gui-location.jsm | 14 +-
src/content/lib/logger.jsm | 18 +-
src/content/lib/manager-for-event-listeners.jsm | 30 ++-
src/content/lib/manager-for-message-listeners.jsm | 31 ++-
src/content/lib/observer-manager.jsm | 3 -
src/content/lib/old-rules.jsm | 14 +-
src/content/lib/policy-manager.alias-functions.js | 6 -
src/content/lib/policy-manager.jsm | 31 ++-
src/content/lib/prefs.jsm | 19 +-
src/content/lib/request-processor.compat.js | 22 +-
src/content/lib/request-processor.redirects.js | 18 +-
src/content/lib/request-result.jsm | 8 +-
src/content/lib/request-set.jsm | 24 +--
src/content/lib/request.jsm | 2 +-
src/content/lib/ruleset-storage.jsm | 8 +-
src/content/lib/subscription.jsm | 184 ++++++++--------
src/content/lib/utils.jsm | 3 -
src/content/lib/utils/dom.jsm | 4 +-
src/content/lib/utils/domains.jsm | 5 +-
src/content/lib/utils/files.jsm | 18 +-
src/content/lib/utils/info.jsm | 2 +-
src/content/lib/utils/windows.jsm | 7 +-
src/content/lib/utils/xul.jsm | 16 +-
src/content/main/default-pref-handler.js | 1 -
src/content/main/pref-manager.jsm | 5 -
src/content/main/requestpolicy-service.jsm | 34 +--
src/content/main/window-manager-toolbarbutton.js | 6 +-
src/content/main/window-manager.jsm | 28 +--
src/content/main/window-manager.listener.js | 11 +-
src/content/settings/advancedprefs.js | 144 ++++++-------
src/content/settings/basicprefs.js | 76 ++++---
src/content/settings/common.js | 34 ++-
src/content/settings/defaultpolicy.js | 61 +++---
src/content/settings/oldrules.js | 61 +++---
src/content/settings/setup.js | 96 ++++-----
src/content/settings/subscriptions.js | 78 ++++---
src/content/settings/yourpolicy.js | 121 +++++------
src/content/ui/classicmenu.js | 23 +-
src/content/ui/frame.dom-content-loaded.js | 11 +-
src/content/ui/frame.js | 18 +-
src/content/ui/menu.js | 240 ++++++++++-----------
src/content/ui/overlay.js | 85 +++-----
src/content/ui/request-log.filtering.js | 10 +-
src/content/ui/request-log.interface.js | 11 +-
src/content/ui/request-log.js | 7 +-
src/content/ui/request-log.tree-view.js | 13 +-
src/content/ui/xul-trees.js | 4 -
51 files changed, 742 insertions(+), 973 deletions(-)
diff --git a/src/bootstrap.js b/src/bootstrap.js
index 81ab215..66e9c05 100644
--- a/src/bootstrap.js
+++ b/src/bootstrap.js
@@ -52,7 +52,7 @@ function startup(data, reason) {
let {ProcessEnvironment} = Cu.import(envURI, {});
// Remark: startup() takes the arguments as an array!
ProcessEnvironment.startup([data, reason]);
- } catch(e) {
+ } catch (e) {
logSevereError("startup() failed!", e);
}
}
@@ -65,7 +65,7 @@ function shutdown(data, reason) {
ProcessEnvironment.shutdown([data, reason]);
}
Cu.unload(envURI);
- } catch(e) {
+ } catch (e) {
logSevereError("shutdown() failed!", e);
}
}
diff --git a/src/content/lib/environment.jsm b/src/content/lib/environment.jsm
index 3f95bd2..20b16b8 100644
--- a/src/content/lib/environment.jsm
+++ b/src/content/lib/environment.jsm
@@ -69,7 +69,7 @@ let log = {
// Environment
//==============================================================================
-var Environment = (function () {
+var Environment = (function() {
//----------------------------------------------------------------------------
// constants, metadata
@@ -221,7 +221,6 @@ var Environment = (function () {
Environment.LEVELS = LEVELS;
Environment.ENV_STATES = ENV_STATES;
-
/**
* This function creates one "Level Object" for each level. Those objects
* mainly will hold the startup- or shutdown-functions of the corresponding
@@ -237,7 +236,6 @@ var Environment = (function () {
return obj;
}
-
/**
* Registers the environment to its outer environment.
*/
@@ -289,9 +287,6 @@ var Environment = (function () {
}
};
-
-
-
/**
* Add a startup function to the environment.
*/
@@ -342,7 +337,6 @@ var Environment = (function () {
}
};
-
// have a scope/closure for private functions specific to
// startup() and shutdown().
(function createMethods_StartupAndShutdown(Environment) {
@@ -374,7 +368,6 @@ var Environment = (function () {
}
}
-
/**
* This function calls all functions in an array.
*
@@ -400,7 +393,6 @@ var Environment = (function () {
}
}
-
/**
* Process a level independently of the environment's states and
* independently of the other levels' states.
@@ -437,7 +429,6 @@ var Environment = (function () {
}
}
-
/**
* Iterate levels and call processLevel() for each level.
*
@@ -448,12 +439,11 @@ var Environment = (function () {
*/
function processLevels(aStartupOrShutdown, aBootstrapArgs, aUntilLevel) {
let self = this;
- iterateLevels(aStartupOrShutdown, function (level) {
+ iterateLevels(aStartupOrShutdown, function(level) {
processLevel.call(self, aStartupOrShutdown, level, aBootstrapArgs);
}, aUntilLevel);
}
-
/**
* Return some information about an environment.
*
@@ -564,7 +554,7 @@ var Environment = (function () {
// ProcessEnvironment
//==============================================================================
-var ProcessEnvironment = (function () {
+var ProcessEnvironment = (function() {
let scope = {Environment};
Services.scriptloader.loadSubScript(
"chrome://rpcontinued/content/lib/environment.process.js", scope);
@@ -575,7 +565,7 @@ var ProcessEnvironment = (function () {
// FrameScriptEnvironment
//==============================================================================
-var FrameScriptEnvironment = (function () {
+var FrameScriptEnvironment = (function() {
/**
* @constructor
* @extends {Environment}
diff --git a/src/content/lib/environment.process.js b/src/content/lib/environment.process.js
index ca1c75b..6a252b3 100644
--- a/src/content/lib/environment.process.js
+++ b/src/content/lib/environment.process.js
@@ -50,9 +50,12 @@ var ProcessEnvironment = (function() {
return xulRuntime.processType === xulRuntime.PROCESS_TYPE_DEFAULT;
}());
-
const shutdownMessage = C.MM_PREFIX + "shutdown";
+ //----------------------------------------------------------------------------
+ // ProcessEnvironmentBase
+ //----------------------------------------------------------------------------
+
/**
* @constructor
* @extends {Environment}
@@ -71,8 +74,9 @@ var ProcessEnvironment = (function() {
ProcessEnvironmentBase.prototype = Object.create(Environment.prototype);
ProcessEnvironmentBase.prototype.constructor = Environment;
-
-
+ //----------------------------------------------------------------------------
+ // ParentProcessEnvironment
+ //----------------------------------------------------------------------------
/**
* @constructor
@@ -83,7 +87,6 @@ var ProcessEnvironment = (function() {
let self = this;
ProcessEnvironmentBase.call(self, aName);
-
function sendShutdownMessageToChildren() {
let parentMM = Cc["@mozilla.org/parentprocessmessagemanager;1"]
.getService(Ci.nsIMessageBroadcaster);
@@ -99,8 +102,6 @@ var ProcessEnvironment = (function() {
ParentProcessEnvironment.prototype = Object.create(ProcessEnvironmentBase.prototype);
ParentProcessEnvironment.prototype.constructor = ProcessEnvironmentBase;
-
-
/**
* @override
*/
@@ -114,7 +115,6 @@ var ProcessEnvironment = (function() {
// shutdown functions anyway.
let dummyScope = {};
-
/**
* The following section is not optimal – read on…
*/
@@ -142,7 +142,6 @@ var ProcessEnvironment = (function() {
ProcessEnvironmentBase.prototype.startup.apply(self, arguments);
};
-
/**
* @override
*/
@@ -155,8 +154,9 @@ var ProcessEnvironment = (function() {
Cu.unload("chrome://rpcontinued/content/lib/script-loader.jsm");
};
-
-
+ //----------------------------------------------------------------------------
+ // ChildProcessEnvironment
+ //----------------------------------------------------------------------------
/**
* @constructor
@@ -192,7 +192,6 @@ var ProcessEnvironment = (function() {
ChildProcessEnvironment.prototype = Object.create(ProcessEnvironmentBase.prototype);
ChildProcessEnvironment.prototype.constructor = ProcessEnvironmentBase;
-
/**
* @override
*/
@@ -220,8 +219,9 @@ var ProcessEnvironment = (function() {
arguments);
};
-
-
+ //----------------------------------------------------------------------------
+ // ProcessEnvironment
+ //----------------------------------------------------------------------------
if (isMainProcess === true) {
return new ParentProcessEnvironment();
diff --git a/src/content/lib/framescript-to-overlay-communication.jsm b/src/content/lib/framescript-to-overlay-communication.jsm
index 022aee4..366e541 100644
--- a/src/content/lib/framescript-to-overlay-communication.jsm
+++ b/src/content/lib/framescript-to-overlay-communication.jsm
@@ -95,7 +95,7 @@ function FramescriptToOverlayCommunication(aEnv) {
stopCommunication.bind(null, self));
}
-FramescriptToOverlayCommunication.prototype._dump = function (msg) {
+FramescriptToOverlayCommunication.prototype._dump = function(msg) {
let self = this;
Logger.dump(self.env.uid + ": " + msg);
};
diff --git a/src/content/lib/gui-location.jsm b/src/content/lib/gui-location.jsm
index af71abf..b62340b 100644
--- a/src/content/lib/gui-location.jsm
+++ b/src/content/lib/gui-location.jsm
@@ -52,7 +52,7 @@ GUILocation.prototype.toString = function() {
/**
* @static
*/
-GUILocation.merge = function (guiLocation, location1, location2) {
+GUILocation.merge = function(guiLocation, location1, location2) {
return new guiLocation(
location1.value, // we assume: location1.value == location2.value
GUILocationProperties.merge(location1.properties, location2.properties));
@@ -61,7 +61,7 @@ GUILocation.merge = function (guiLocation, location1, location2) {
/**
* @static
*/
-GUILocation.existsInArray = function (locationString, locations) {
+GUILocation.existsInArray = function(locationString, locations) {
return GUILocation.indexOfLocationInArray(locationString, locations) !== -1;
};
@@ -74,7 +74,7 @@ GUILocation.existsInArray = function (locationString, locations) {
* @return {int} The index of the first GUILocation object which contains the
* specified locationString. If it doesn't exist, it returns -1.
*/
-GUILocation.indexOfLocationInArray = function (locationString, locations) {
+GUILocation.indexOfLocationInArray = function(locationString, locations) {
if (locationString instanceof GUILocation) {
locationString = locationString.value;
}
@@ -91,10 +91,10 @@ GUILocation.indexOfLocationInArray = function (locationString, locations) {
*
* @static
*/
-GUILocation.sortByNumRequestsCompareFunction = function (a, b) {
+GUILocation.sortByNumRequestsCompareFunction = function(a, b) {
return GUILocation.compareFunction(a, b, "sortByNumRequests");
};
-GUILocation.compareFunction = function (a, b, sortType) {
+GUILocation.compareFunction = function(a, b, sortType) {
var a_default = 0 < a.properties.numDefaultPolicyRequests;
var b_default = 0 < b.properties.numDefaultPolicyRequests;
@@ -191,7 +191,7 @@ GUILocationProperties.prototype.reset = function() {
* with the specified rule action without being checked.
* Otherwise the ruleAction will be checked for every single request.
*/
-GUILocationProperties.prototype.accumulate = function (requests, ruleAction) {
+GUILocationProperties.prototype.accumulate = function(requests, ruleAction) {
var extractRuleActions = undefined === ruleAction;
var ruleActionCounter = 0;
@@ -248,7 +248,7 @@ GUILocationProperties.requestCountProperties = [
*
* Merge the given GUILocationProperties object to a new object
*/
-GUILocationProperties.merge = function (prop1, prop2) {
+GUILocationProperties.merge = function(prop1, prop2) {
var requestCountProperties = GUILocationProperties.requestCountProperties;
var newObj = new GUILocationProperties();
diff --git a/src/content/lib/logger.jsm b/src/content/lib/logger.jsm
index b50754e..be37c20 100644
--- a/src/content/lib/logger.jsm
+++ b/src/content/lib/logger.jsm
@@ -79,9 +79,6 @@ var Logger = (function() {
// function to use to print out the log
self.printFunc = dump;
-
-
-
let initialized = false;
/**
@@ -141,11 +138,6 @@ var Logger = (function() {
ProcessEnvironment.addStartupFunction(Environment.LEVELS.ESSENTIAL, init);
-
-
-
-
-
function log(aLevel, aType, aMessage, aError) {
let shouldLog = enabled && aLevel >= level && types & aType;
@@ -172,8 +164,6 @@ var Logger = (function() {
}
}
-
-
self.severe = doLog.bind(self, self.LEVEL_SEVERE);
self.severeError = doLog.bind(self, self.LEVEL_SEVERE, self.TYPE_ERROR);
self.warning = doLog.bind(self, self.LEVEL_WARNING);
@@ -219,18 +209,18 @@ var Logger = (function() {
* Triggers errors for a RequestPolicy unit test.
* It's used to test Error Detection from the unit tests.
*/
-var UnitTestObserver = (function () {
+var UnitTestObserver = (function() {
let self = {};
var loggingErrorTopic = "requestpolicy-trigger-logging-error";
var consoleErrorTopic = "requestpolicy-trigger-console-error";
- self.startup = function () {
+ self.startup = function() {
Services.obs.addObserver(self, loggingErrorTopic, false);
Services.obs.addObserver(self, consoleErrorTopic, false);
};
- self.shutdown = function () {
+ self.shutdown = function() {
Services.obs.removeObserver(self, loggingErrorTopic);
Services.obs.removeObserver(self, consoleErrorTopic);
};
@@ -252,7 +242,7 @@ var UnitTestObserver = (function () {
return [part1, part2];
}
- self.observe = function (aSubject, aTopic, aData) {
+ self.observe = function(aSubject, aTopic, aData) {
switch (aTopic) {
case loggingErrorTopic:
let [logLevel, logMessage] = splitColon(aData);
diff --git a/src/content/lib/manager-for-event-listeners.jsm b/src/content/lib/manager-for-event-listeners.jsm
index 1a8993f..ae2a0d1 100644
--- a/src/content/lib/manager-for-event-listeners.jsm
+++ b/src/content/lib/manager-for-event-listeners.jsm
@@ -64,9 +64,9 @@ function ManagerForEventListeners(aEnv) {
self.environment.addStartupFunction(
Environment.LEVELS.INTERFACE,
function() {
- Logger.dump('From now on new event listeners will be ' +
- 'added immediately. Environment: "' +
- self.environment.name + '"');
+ Logger.dump("From now on new event listeners will be " +
+ "added immediately. Environment: \"" +
+ self.environment.name + "\"");
self.addNewListenersImmediately = true;
self.addAllListeners();
});
@@ -86,22 +86,20 @@ function ManagerForEventListeners(aEnv) {
}
}
-
function addEvLis(listener) {
listener.target.addEventListener(listener.eventType, listener.callback,
listener.useCapture);
listener.listening = true;
}
-
ManagerForEventListeners.prototype.addListener = function(aEventTarget,
aEventType,
aCallback,
aUseCapture) {
let self = this;
- if (typeof aCallback !== 'function') {
+ if (typeof aCallback !== "function") {
Logger.warning(Logger.TYPE_ERROR, "The callback for an event listener" +
- 'must be a function! Event type was "' + aEventType + '"');
+ "must be a function! Event type was \"" + aEventType + "\"");
return;
}
let listener = {
@@ -112,16 +110,14 @@ ManagerForEventListeners.prototype.addListener = function(aEventTarget,
listening: false
};
if (self.addNewListenersImmediately) {
- Logger.dump('Immediately adding event listener for "' +
- listener.eventType + '". Environment: "' +
- self.environment.name + '"');
+ Logger.dump("Immediately adding event listener for \"" +
+ listener.eventType + "\". Environment: \"" +
+ self.environment.name + "\"");
addEvLis(listener);
}
self.listeners.push(listener);
};
-
-
/**
* The function will add all listeners already in the list.
*/
@@ -129,9 +125,9 @@ ManagerForEventListeners.prototype.addAllListeners = function() {
let self = this;
for (let listener of self.listeners) {
if (listener.listening === false) {
- Logger.dump('Lazily adding event listener for "' +
- listener.eventType + '". Environment: "' +
- self.environment.name + '"');
+ Logger.dump("Lazily adding event listener for \"" +
+ listener.eventType + "\". Environment: \"" +
+ self.environment.name + "\"");
addEvLis(listener);
}
}
@@ -144,8 +140,8 @@ ManagerForEventListeners.prototype.removeAllListeners = function() {
let self = this;
while (self.listeners.length > 0) {
let listener = self.listeners.pop();
- Logger.dump('Removing event listener for "' + listener.eventType +
- '". Environment: "' + self.environment.name + '"');
+ Logger.dump("Removing event listener for \"" + listener.eventType +
+ "\". Environment: \"" + self.environment.name + "\"");
listener.target.removeEventListener(listener.eventType, listener.callback,
listener.useCapture);
}
diff --git a/src/content/lib/manager-for-message-listeners.jsm b/src/content/lib/manager-for-message-listeners.jsm
index f965a52..7571596 100644
--- a/src/content/lib/manager-for-message-listeners.jsm
+++ b/src/content/lib/manager-for-message-listeners.jsm
@@ -65,9 +65,9 @@ function ManagerForMessageListeners(aEnv, aMM) {
self.environment.addStartupFunction(
Environment.LEVELS.INTERFACE,
function() {
- Logger.dump('From now on new message listeners will be ' +
- 'added immediately. Environment: "' +
- self.environment.name + '"');
+ Logger.dump("From now on new message listeners will be " +
+ "added immediately. Environment: \"" +
+ self.environment.name + "\"");
self.addNewListenersImmediately = true;
self.addAllListeners();
});
@@ -96,7 +96,6 @@ function ManagerForMessageListeners(aEnv, aMM) {
}
}
-
/**
* Add a listener. The class will then take care about adding
* and removing that message listener.
@@ -111,10 +110,10 @@ ManagerForMessageListeners.prototype.addListener = function(aMessageName,
aCallback,
aAddImmediately) {
let self = this;
- if (typeof aCallback !== 'function') {
+ if (typeof aCallback !== "function") {
Logger.warning(Logger.TYPE_ERROR, "The callback for a message listener" +
- 'must be a function! The message name was "' + aMessageName +
- '"');
+ "must be a function! The message name was \"" + aMessageName +
+ "\"");
return;
}
if (aMessageName.indexOf(C.MM_PREFIX) === 0) {
@@ -132,17 +131,15 @@ ManagerForMessageListeners.prototype.addListener = function(aMessageName,
listening: false
};
if (aAddImmediately === true || self.addNewListenersImmediately) {
- Logger.dump('Immediately adding message listener for "' +
- listener.messageName + '". Environment: "' +
- self.environment.name + '"');
+ Logger.dump("Immediately adding message listener for \"" +
+ listener.messageName + "\". Environment: \"" +
+ self.environment.name + "\"");
self.mm.addMessageListener(listener.messageID, listener.callback);
listener.listening = true;
}
self.listeners.push(listener);
};
-
-
/**
* The function will add all listeners already in the list.
*/
@@ -150,9 +147,9 @@ ManagerForMessageListeners.prototype.addAllListeners = function() {
let self = this;
for (let listener of self.listeners) {
if (listener.listening === false) {
- Logger.dump('Lazily adding message listener for "' +
- listener.messageName + '". Environment: "' +
- self.environment.name + '"');
+ Logger.dump("Lazily adding message listener for \"" +
+ listener.messageName + "\". Environment: \"" +
+ self.environment.name + "\"");
self.mm.addMessageListener(listener.messageID, listener.callback);
listener.listening = true;
}
@@ -172,8 +169,8 @@ ManagerForMessageListeners.prototype.removeAllListeners = function() {
// 'is undefined!');
// continue;
//}
- Logger.dump('Removing message listener for "' + listener.messageName +
- '".');
+ Logger.dump("Removing message listener for \"" + listener.messageName +
+ "\".");
//try {
self.mm.removeMessageListener(listener.messageID, listener.callback);
//} catch (e) {
diff --git a/src/content/lib/observer-manager.jsm b/src/content/lib/observer-manager.jsm
index 0825564..02fcc82 100644
--- a/src/content/lib/observer-manager.jsm
+++ b/src/content/lib/observer-manager.jsm
@@ -88,7 +88,6 @@ function ObserverManager(aEnv) {
self.observers = [];
}
-
/**
* Define 'observe' functions. Those function can be called from anywhere;
* the caller hands over an object with the keys being the "IDs" and the values
@@ -168,8 +167,6 @@ function ObserverManager(aEnv) {
};
}
-
-
/**
* The function will unregister all registered observers.
*/
diff --git a/src/content/lib/old-rules.jsm b/src/content/lib/old-rules.jsm
index b35090b..8c69059 100644
--- a/src/content/lib/old-rules.jsm
+++ b/src/content/lib/old-rules.jsm
@@ -36,7 +36,7 @@ let {rpPrefBranch} = importModule("lib/prefs");
// OldRules
//==============================================================================
-var OldRules = (function () {
+var OldRules = (function() {
"use strict";
function OldRules(aOrigins = "", aDestinations = "",
@@ -55,7 +55,7 @@ var OldRules = (function () {
* The three strings containing the old rules.
*/
Object.defineProperty(OldRules.prototype, "prefStrings", {
- get: function () {
+ get: function() {
if (!this._prefStrings) {
this._prefStrings = this._customPrefStrings || {
origins: OldRules._getPrefString("allowedOrigins"),
@@ -72,7 +72,7 @@ var OldRules = (function () {
* Three `Set`s containing the rules as strings.
*/
Object.defineProperty(OldRules.prototype, "prefStringSets", {
- get: function () {
+ get: function() {
function splitString(aRulesString) {
var rules = new Set(aRulesString.split(" "));
@@ -97,7 +97,7 @@ var OldRules = (function () {
/**
* Convert the pref strings to rule objects.
*/
- OldRules.prototype.getAsNewRules = function (addHostWildcard) {
+ OldRules.prototype.getAsNewRules = function(addHostWildcard) {
var rules = [];
var {origins, dests, originsToDests} = this.prefStringSets;
@@ -131,7 +131,7 @@ var OldRules = (function () {
* @param {boolean} aAddHostWildcard
* @return {Object} The endpoints' specifications.
*/
- OldRules.getEndpointSpecFromString = function (aEndpointString,
+ OldRules.getEndpointSpecFromString = function(aEndpointString,
aAddHostWildcard) {
var spec = {};
if (DomainUtil.isValidUri(aEndpointString)) {
@@ -152,7 +152,7 @@ var OldRules = (function () {
};
// FIXME: This should be a function of DomainUtil.
- OldRules._isHostname = function (host) {
+ OldRules._isHostname = function(host) {
return !DomainUtil.isValidUri(host) && !DomainUtil.isIPAddress(host);
};
@@ -161,7 +161,7 @@ var OldRules = (function () {
* @return {string} The value of the pref, or an empty string if
* the pref does not exist.
*/
- OldRules._getPrefString = function (aPrefName) {
+ OldRules._getPrefString = function(aPrefName) {
try {
return rpPrefBranch.getComplexValue(aPrefName, Ci.nsISupportsString).data;
} catch (e) {
diff --git a/src/content/lib/policy-manager.alias-functions.js b/src/content/lib/policy-manager.alias-functions.js
index 25d038a..aeaabac 100644
--- a/src/content/lib/policy-manager.alias-functions.js
+++ b/src/content/lib/policy-manager.alias-functions.js
@@ -48,7 +48,6 @@ PolicyManager = (function(self) {
self.addAllowRules = self.addRules.bind(this, C.RULE_ACTION_ALLOW);
self.addDenyRules = self.addRules.bind(this, C.RULE_ACTION_DENY);
-
function getRuleData(aOrigin, aDest) {
let ruleData = {};
if (aOrigin !== undefined) {
@@ -60,7 +59,6 @@ PolicyManager = (function(self) {
return ruleData;
}
-
function allowOrigin(aOrigin, noStore) {
self.addAllowRule(getRuleData(aOrigin), noStore);
}
@@ -71,7 +69,6 @@ PolicyManager = (function(self) {
allowOrigin(aOrigin, true);
};
-
self.temporarilyAllowOrigin = function(aOrigin) {
PolicyManager.addTemporaryAllowRule(getRuleData(aOrigin));
};
@@ -79,7 +76,6 @@ PolicyManager = (function(self) {
self.addTemporaryAllowRule(getRuleData(undefined, aDest));
};
-
function allowDestination(aDest, noStore) {
self.addAllowRule(getRuleData(undefined, aDest), noStore);
}
@@ -90,7 +86,6 @@ PolicyManager = (function(self) {
allowDestination(aDest, true);
};
-
function allowOriginToDestination(originIdentifier, destIdentifier, noStore) {
self.addAllowRule(getRuleData(originIdentifier, destIdentifier), noStore);
}
@@ -102,7 +97,6 @@ PolicyManager = (function(self) {
allowOriginToDestination(originIdentifier, destIdentifier, true);
};
-
self.temporarilyAllowOriginToDestination = function(originIdentifier,
destIdentifier) {
PolicyManager.addTemporaryAllowRule(getRuleData(originIdentifier,
diff --git a/src/content/lib/policy-manager.jsm b/src/content/lib/policy-manager.jsm
index 46d3b75..131fcaa 100644
--- a/src/content/lib/policy-manager.jsm
+++ b/src/content/lib/policy-manager.jsm
@@ -67,7 +67,7 @@ function notifyRulesChanged() {
* Provides a simplified interface to handling multiple
* rulesets, checking requests against multiple rulesets, etc.
*/
-var PolicyManager = (function () {
+var PolicyManager = (function() {
let self = {};
let userRulesets = {};
@@ -101,8 +101,8 @@ var PolicyManager = (function () {
rawRuleset = new RawRuleset();
}
userRulesets.user = {
- "rawRuleset" : rawRuleset,
- "ruleset" : rawRuleset.toRuleset("user")
+ "rawRuleset": rawRuleset,
+ "ruleset": rawRuleset.toRuleset("user")
};
userRulesets.user.ruleset.userRuleset = true;
//userRulesets.user.ruleset.print();
@@ -121,7 +121,7 @@ var PolicyManager = (function () {
for (let subName in subscriptionInfo[listName]) {
try {
dprint("PolicyManager::loadSubscriptionRules: " +
- listName + ' / ' + subName);
+ listName + " / " + subName);
rawRuleset = RulesetStorage
.loadRawRulesetFromFile(subName + ".json", listName);
} catch (e) {
@@ -137,8 +137,8 @@ var PolicyManager = (function () {
}
let list = subscriptionRulesets[listName];
list[subName] = {
- "rawRuleset" : rawRuleset,
- "ruleset" : rawRuleset.toRuleset(subName)
+ "rawRuleset": rawRuleset,
+ "ruleset": rawRuleset.toRuleset(subName)
};
list[subName].ruleset.userRuleset = false;
//list[subName].ruleset.print();
@@ -156,7 +156,7 @@ var PolicyManager = (function () {
for (let listName in subscriptionInfo) {
for (let subName in subscriptionInfo[listName]) {
dprint("PolicyManager::unloadSubscriptionRules: " +
- listName + ' / ' + subName);
+ listName + " / " + subName);
if (!subscriptionRulesets[listName] ||
!subscriptionRulesets[listName][subName]) {
if (!failures[listName]) {
@@ -216,8 +216,8 @@ var PolicyManager = (function () {
// TODO: can we do this in the background and add some locking? It will
// become annoying when there is a large file to write.
if (!noStore) {
- RulesetStorage.saveRawRulesetToFile(
- userRulesets.user.rawRuleset, "user.json");
+ RulesetStorage.saveRawRulesetToFile(
+ userRulesets.user.rawRuleset, "user.json");
}
//userRulesets.user.ruleset.print();
@@ -225,7 +225,7 @@ var PolicyManager = (function () {
notifyRulesChanged();
};
- self.addRules = function (aRuleAction, aRuleDataList, aNoStore=false) {
+ self.addRules = function(aRuleAction, aRuleDataList, aNoStore=false) {
for (let ruleData of aRuleDataList) {
PolicyManager.addRule(aRuleAction, ruleData, true);
}
@@ -274,8 +274,8 @@ var PolicyManager = (function () {
// TODO: can we do this in the background and add some locking? It will
// become annoying when there is a large file to write.
if (!noStore) {
- RulesetStorage.saveRawRulesetToFile(
- userRulesets.user.rawRuleset, "user.json");
+ RulesetStorage.saveRawRulesetToFile(
+ userRulesets.user.rawRuleset, "user.json");
}
//userRulesets.user.ruleset.print();
@@ -292,8 +292,8 @@ var PolicyManager = (function () {
self.revokeTemporaryRules = function() {
var rawRuleset = new RawRuleset();
userRulesets.temp = {
- "rawRuleset" : rawRuleset,
- "ruleset" : rawRuleset.toRuleset("temp")
+ "rawRuleset": rawRuleset,
+ "ruleset": rawRuleset.toRuleset("temp")
};
userRulesets.temp.ruleset.userRuleset = true;
@@ -345,8 +345,7 @@ var PolicyManager = (function () {
return self;
}());
-
-PolicyManager = (function () {
+PolicyManager = (function() {
let scope = {PolicyManager};
Services.scriptloader.loadSubScript(
"chrome://rpcontinued/content/lib/policy-manager.alias-functions.js",
diff --git a/src/content/lib/prefs.jsm b/src/content/lib/prefs.jsm
index 383089f..cfb3bce 100644
--- a/src/content/lib/prefs.jsm
+++ b/src/content/lib/prefs.jsm
@@ -50,13 +50,10 @@ var rootPrefBranch = Services.prefs.getBranch("")
var Prefs = (function() {
let self = {};
-
-
self.save = function() {
Services.prefs.savePrefFile(null);
};
-
function getRPBoolPref(aPrefName) {
return rpPrefBranch.getBoolPref(aPrefName);
}
@@ -96,10 +93,10 @@ var Prefs = (function() {
let prefName = RP_PREF_ALIASES.bool[prefID];
// define the pref's getter function to `self`
- self["is"+prefName] = getRPBoolPref.bind(this, prefID);
+ self["is" + prefName] = getRPBoolPref.bind(this, prefID);
// define the pref's getter function to `self`
- self["set"+prefName] = setRPBoolPref.bind(this, prefID);
+ self["set" + prefName] = setRPBoolPref.bind(this, prefID);
}
}
@@ -118,24 +115,22 @@ var Prefs = (function() {
}
self.oldRulesExist = function() {
- return !(isPrefEmpty('allowedOrigins') &&
- isPrefEmpty('allowedDestinations') &&
- isPrefEmpty('allowedOriginsToDestinations'));
+ return !(isPrefEmpty("allowedOrigins") &&
+ isPrefEmpty("allowedDestinations") &&
+ isPrefEmpty("allowedOriginsToDestinations"));
};
- self.clearPref = function (aPrefName) {
+ self.clearPref = function(aPrefName) {
try {
if (rpPrefBranch.prefHasUserValue(aPrefName)) {
rpPrefBranch.clearUserPref(aPrefName);
}
} catch (e) {
- Logger.dump('Clearing pref failed: ' + e.toString());
+ Logger.dump("Clearing pref failed: " + e.toString());
}
Services.prefs.savePrefFile(null);
};
-
-
function observePref(subject, topic, data) {
if (topic === "nsPref:changed") {
// Send an observer notification that a pref that affects RP has been
diff --git a/src/content/lib/request-processor.compat.js b/src/content/lib/request-processor.compat.js
index 5f72390..b2b8a42 100644
--- a/src/content/lib/request-processor.compat.js
+++ b/src/content/lib/request-processor.compat.js
@@ -44,9 +44,9 @@ RequestProcessor = (function(self) {
// TODO: update compatibility rules etc. when addons are enabled/disabled
let addonListener = {
- onDisabling : function(addon, needsRestart) {},
- onUninstalling : function(addon, needsRestart) {},
- onOperationCancelled : function(addon, needsRestart) {}
+ onDisabling: function(addon, needsRestart) {},
+ onUninstalling: function(addon, needsRestart) {},
+ onOperationCancelled: function(addon, needsRestart) {}
};
function init() {
@@ -66,7 +66,6 @@ RequestProcessor = (function(self) {
ProcessEnvironment.addStartupFunction(Environment.LEVELS.BACKEND, init);
ProcessEnvironment.addShutdownFunction(Environment.LEVELS.BACKEND, cleanup);
-
function initializeExtensionCompatibility() {
if (compatibilityRules.length !== 0) {
return;
@@ -95,9 +94,6 @@ RequestProcessor = (function(self) {
}
}
-
-
-
function initializeExtCompatCallback(ext) {
if (!ext) {
return;
@@ -124,9 +120,9 @@ RequestProcessor = (function(self) {
compatibilityRules.push(
["resource://brief-content/", null, ext.name]);
conflictingExtensions.push({
- "id" : ext.id,
- "name" : ext.name,
- "version" : ext.version
+ "id": ext.id,
+ "name": ext.name,
+ "version": ext.version
});
break;
case "foxmarks at kei.com" : // Xmarks Sync
@@ -190,9 +186,6 @@ RequestProcessor = (function(self) {
}
}
-
-
-
function initializeApplicationCompatibility() {
var appInfo = Cc["@mozilla.org/xre/app-info;1"].
getService(Ci.nsIXULAppInfo);
@@ -301,9 +294,6 @@ RequestProcessor = (function(self) {
}
}
-
-
-
self.getCompatibilityRules = function() {
return compatibilityRules;
};
diff --git a/src/content/lib/request-processor.redirects.js b/src/content/lib/request-processor.redirects.js
index c2c9b9f..4aee21f 100644
--- a/src/content/lib/request-processor.redirects.js
+++ b/src/content/lib/request-processor.redirects.js
@@ -52,7 +52,6 @@ const HTTPS_EVERYWHERE_REWRITE_TOPIC = "https-everywhere-uri-rewrite";
RequestProcessor = (function(self) {
let internal = Utils.moduleInternal(self);
-
/**
* These are redirects that the user allowed when presented with a redirect
* notification.
@@ -61,8 +60,6 @@ RequestProcessor = (function(self) {
internal.allowedRedirectsReverse = {};
-
-
ProcessEnvironment.obMan.observe(
["http-on-examine-response"],
function(subject) {
@@ -74,8 +71,6 @@ RequestProcessor = (function(self) {
handleHttpsEverywhereUriRewrite(subject, data);
});
-
-
function mapDestinations(origDestUri, newDestUri) {
origDestUri = DomainUtil.stripFragment(origDestUri);
newDestUri = DomainUtil.stripFragment(newDestUri);
@@ -164,14 +159,11 @@ RequestProcessor = (function(self) {
return result;
}
-
self.isAllowedRedirect = function(originURI, destURI) {
var request = new Request(originURI, destURI);
return true === checkRedirect(request).isAllowed;
};
-
-
function processUrlRedirection(request) {
let httpResponse = request.httpResponse;
let httpChannel = httpResponse.httpChannel;
@@ -312,8 +304,8 @@ RequestProcessor = (function(self) {
var window = browser.ownerGlobal;
Utils.tryMultipleTimes(function() {
- var showNotification = Utils.getObjectPath(window, 'rpcontinued',
- 'overlay', '_showRedirectNotification');
+ var showNotification = Utils.getObjectPath(window, "rpcontinued",
+ "overlay", "_showRedirectNotification");
if (!showNotification) {
return false;
}
@@ -373,9 +365,6 @@ RequestProcessor = (function(self) {
return initialOrigin;
}
-
-
-
/**
* Called after a response has been received from the web server. Headers are
* available on the channel. The response can be accessed and modified via
@@ -438,8 +427,6 @@ RequestProcessor = (function(self) {
processUrlRedirection(request);
}
-
-
/**
* Checks whether a request is initiated by a content window. If it's from a
* content window, then it's from unprivileged code.
@@ -454,6 +441,5 @@ RequestProcessor = (function(self) {
return !!loadContext.isContent;
}
-
return self;
}(RequestProcessor || {}));
diff --git a/src/content/lib/request-result.jsm b/src/content/lib/request-result.jsm
index 658f07c..aeb0d85 100644
--- a/src/content/lib/request-result.jsm
+++ b/src/content/lib/request-result.jsm
@@ -88,11 +88,11 @@ function RequestResult(isAllowed, resultReason) {
}
RequestResult.prototype = {
- matchedAllowRules : null,
- matchedDenyRules : null,
+ matchedAllowRules: null,
+ matchedDenyRules: null,
- isAllowed : undefined, // whether the request will be or has been allowed
- resultReason : undefined
+ isAllowed: undefined, // whether the request will be or has been allowed
+ resultReason: undefined
};
RequestResult.prototype.allowRulesExist = function() {
diff --git a/src/content/lib/request-set.jsm b/src/content/lib/request-set.jsm
index 54c09af..331d92e 100644
--- a/src/content/lib/request-set.jsm
+++ b/src/content/lib/request-set.jsm
@@ -55,9 +55,9 @@ function RequestSet() {
this._origins = {};
}
RequestSet.prototype = {
- _origins : null,
+ _origins: null,
- print : function(name) {
+ print: function(name) {
var log = Logger;
log.dump("-------------------------------------------------");
log.dump("== Request Set <" + name + "> ==");
@@ -85,24 +85,24 @@ RequestSet.prototype = {
log.dump("-------------------------------------------------");
},
- getAll : function() {
+ getAll: function() {
return this._origins;
},
// TODO: the name of this method, getAllMergedOrigins, is confusing. Is it
// getting all of the "merged origins" is it "getting all" and merging the
// origins when it does it?
- getAllMergedOrigins : function() {
+ getAllMergedOrigins: function() {
var result = {};
for (var originUri in this._origins) {
var dests = this._origins[originUri];
for (var destBase in dests) {
if (!result[destBase]) {
- result[destBase] = {};
+ result[destBase] = {};
}
for (var destIdent in dests[destBase]) {
if (!result[destBase][destIdent]) {
- result[destBase][destIdent] = {};
+ result[destBase][destIdent] = {};
}
for (var destUri in dests[destBase][destIdent]) {
if (!result[destBase][destIdent][destUri]) {
@@ -120,14 +120,14 @@ RequestSet.prototype = {
return result;
},
- getOriginUri : function(originUri) {
+ getOriginUri: function(originUri) {
return this._origins[originUri] || {};
},
/**
* @param {Array} rules The rules that were triggered by this request.
*/
- addRequest : function(originUri, destUri, requestResult) {
+ addRequest: function(originUri, destUri, requestResult) {
if (requestResult === undefined) {
Logger.warning(Logger.TYPE_INTERNAL,
"addRequest() was called without a requestResult object!" +
@@ -155,7 +155,7 @@ RequestSet.prototype = {
// throw "addRequest 'rules' argument must be an object where each " +
// "key/val is ruleStr/rule";
// }
-/*
+ /*
if (!dests[destBase][destIdent][destUri]) {
// TODO: this is a little sketchy. What if we clobber rules
// that were already here? Arguably if we are told to add the
@@ -180,7 +180,7 @@ RequestSet.prototype = {
/**
*/
- removeRequest : function(originUri, destUri) {
+ removeRequest: function(originUri, destUri) {
if (!this._origins[originUri]) {
return;
}
@@ -219,11 +219,11 @@ RequestSet.prototype = {
/**
*/
- removeOriginUri : function(originUri) {
+ removeOriginUri: function(originUri) {
delete this._origins[originUri];
},
- containsBlockedRequests : function() {
+ containsBlockedRequests: function() {
var origins = this._origins;
for (var originURI in origins) {
for (var destBase in origins[originURI]) {
diff --git a/src/content/lib/request.jsm b/src/content/lib/request.jsm
index 0aeaed7..5ff9d4a 100644
--- a/src/content/lib/request.jsm
+++ b/src/content/lib/request.jsm
@@ -236,7 +236,7 @@ NormalRequest.prototype.getContentWindow = function() {
} catch (e) {
try {
doc = context.QueryInterface(Ci.nsIDOMNode).ownerDocument;
- } catch(e) {
+ } catch (e) {
return null;
}
}
diff --git a/src/content/lib/ruleset-storage.jsm b/src/content/lib/ruleset-storage.jsm
index 01145cd..22a22bf 100644
--- a/src/content/lib/ruleset-storage.jsm
+++ b/src/content/lib/ruleset-storage.jsm
@@ -44,14 +44,14 @@ var RulesetStorage = (function() {
* @param {String} subscriptionListName
* @return {RawRuleset}
*/
- self.loadRawRulesetFromFile = function (filename, subscriptionListName) {
+ self.loadRawRulesetFromFile = function(filename, subscriptionListName) {
// TODO: change filename argument to policyname and we'll append the '.json'
// TODO: get a stream and use the mozilla json interface to decode from stream.
var policyFile = FileUtil.getRPUserDir("policies");
// TODO: maybe exercise additional paranoia and sanitize the filename
// even though we're already useing "appendRelativePath".
if (subscriptionListName) {
- policyFile.appendRelativePath('subscriptions');
+ policyFile.appendRelativePath("subscriptions");
policyFile.appendRelativePath(subscriptionListName);
}
policyFile.appendRelativePath(filename);
@@ -73,14 +73,14 @@ var RulesetStorage = (function() {
* @param {String} filename
* @param {String} subscriptionListName
*/
- self.saveRawRulesetToFile = function (policy, filename,
+ self.saveRawRulesetToFile = function(policy, filename,
subscriptionListName) {
// TODO: change filename argument to policyname and we'll append the '.json'
// TODO: get a stream and use the mozilla json interface to encode to stream.
let policyFile;
if (subscriptionListName) {
policyFile = FileUtil.getRPUserDir("policies",
- 'subscriptions', subscriptionListName);
+ "subscriptions", subscriptionListName);
} else {
policyFile = FileUtil.getRPUserDir("policies");
}
diff --git a/src/content/lib/subscription.jsm b/src/content/lib/subscription.jsm
index 44252e5..fca37d8 100644
--- a/src/content/lib/subscription.jsm
+++ b/src/content/lib/subscription.jsm
@@ -49,15 +49,15 @@ let {RulesetStorage} = importModule("lib/ruleset-storage");
// Constants
//==============================================================================
-const SUBSCRIPTION_UPDATED_TOPIC = 'rpcontinued-subscription-policy-updated';
-const SUBSCRIPTION_ADDED_TOPIC = 'rpcontinued-subscription-policy-added';
-const SUBSCRIPTION_REMOVED_TOPIC = 'rpcontinued-subscription-policy-removed';
+const SUBSCRIPTION_UPDATED_TOPIC = "rpcontinued-subscription-policy-updated";
+const SUBSCRIPTION_ADDED_TOPIC = "rpcontinued-subscription-policy-added";
+const SUBSCRIPTION_REMOVED_TOPIC = "rpcontinued-subscription-policy-removed";
-const DEFAULT_SUBSCRIPTION_LIST_URL_BASE = 'https://raw.githubusercontent.com/RequestPolicyContinued/subscriptions/master/';
+const DEFAULT_SUBSCRIPTION_LIST_URL_BASE = "https://raw.githubusercontent.com/RequestPolicyContinued/subscriptions/master/";
-const SUBSCRIPTION_UPDATE_SUCCESS = 'SUCCESS';
-const SUBSCRIPTION_UPDATE_NOT_NEEDED = 'NOT_NEEDED';
-const SUBSCRIPTION_UPDATE_FAILURE = 'FAILURE';
+const SUBSCRIPTION_UPDATE_SUCCESS = "SUCCESS";
+const SUBSCRIPTION_UPDATE_NOT_NEEDED = "NOT_NEEDED";
+const SUBSCRIPTION_UPDATE_FAILURE = "FAILURE";
//==============================================================================
// utilities
@@ -89,22 +89,22 @@ function dprint(msg) {
*/
function UserSubscriptions() {
var userSubsFile = FileUtil.getRPUserDir();
- userSubsFile.appendRelativePath('subscriptions.json');
- let jsonData = '{}';
+ userSubsFile.appendRelativePath("subscriptions.json");
+ let jsonData = "{}";
if (userSubsFile.exists()) {
jsonData = FileUtil.fileToString(userSubsFile);
}
this._data = JSON.parse(jsonData);
if (!this._data.lists) {
this._data.lists = {
- 'official' : {
- 'subscriptions' : {
- 'allow_embedded' : {},
- 'allow_extensions' : {},
- 'allow_functionality' : {},
- 'allow_mozilla' : {},
- 'allow_sameorg' : {},
- 'deny_trackers' : {}
+ "official": {
+ "subscriptions": {
+ "allow_embedded": {},
+ "allow_extensions": {},
+ "allow_functionality": {},
+ "allow_mozilla": {},
+ "allow_sameorg": {},
+ "deny_trackers": {}
}
}
};
@@ -113,17 +113,17 @@ function UserSubscriptions() {
}
UserSubscriptions.prototype = {
- toString : function () {
+ toString: function() {
return "[UserSubscriptions]";
},
- save : function() {
+ save: function() {
var userSubsFile = FileUtil.getRPUserDir();
- userSubsFile.appendRelativePath('subscriptions.json');
+ userSubsFile.appendRelativePath("subscriptions.json");
FileUtil.stringToFile(JSON.stringify(this._data), userSubsFile);
},
- getSubscriptionInfo : function(defaultPolicy) {
+ getSubscriptionInfo: function(defaultPolicy) {
var lists = this._data.lists;
var result = {};
for (var listName in lists) {
@@ -144,7 +144,7 @@ UserSubscriptions.prototype = {
return result;
},
- addSubscription : function(listName, subName) {
+ addSubscription: function(listName, subName) {
var lists = this._data.lists;
if (!lists[listName]) {
lists[listName] = {};
@@ -156,7 +156,7 @@ UserSubscriptions.prototype = {
this.save();
},
- removeSubscription : function(listName, subName) {
+ removeSubscription: function(listName, subName) {
var lists = this._data.lists;
if (lists[listName] && lists[listName].subscriptions &&
lists[listName].subscriptions[subName]) {
@@ -170,12 +170,12 @@ UserSubscriptions.prototype = {
// make a big fat mess of the code, or more likely I'm just not good at
// making it not a mess. On the other hand, this parallelizes the update
// requests, though that may not be a great thing in this case.
- update : function (callback, serials, defaultPolicy) {
+ update: function(callback, serials, defaultPolicy) {
var updatingLists = {};
var updateResults = {};
function recordDone(listName, subName, result) {
- dprint('Recording done: ' + listName + ' ' + subName);
+ dprint("Recording done: " + listName + " " + subName);
if (subName) {
updateResults[listName][subName] = result;
let list = updatingLists[listName];
@@ -188,7 +188,7 @@ UserSubscriptions.prototype = {
for (let i in updatingLists) {
return; // What's that??
}
- setTimeout(function () { callback(updateResults); }, 0);
+ setTimeout(function() { callback(updateResults); }, 0);
}
var listCount = 0;
@@ -201,70 +201,70 @@ UserSubscriptions.prototype = {
var subCount = 0;
for (let subName in serials[listName]) {
if (!this._lists[listName].subscriptions[subName]) {
- dprint('Skipping update of unsubscribed subscription: ' + listName + ' ' + subName);
+ dprint("Skipping update of unsubscribed subscription: " + listName + " " + subName);
continue;
}
- if (defaultPolicy === 'allow' && subName.indexOf('allow_') === 0) {
- dprint('Skipping update of subscription that is only used with a default deny policy: ' + subName);
+ if (defaultPolicy === "allow" && subName.indexOf("allow_") === 0) {
+ dprint("Skipping update of subscription that is only used with a default deny policy: " + subName);
continue;
}
- if (defaultPolicy === 'deny' && subName.indexOf('deny_') === 0) {
- dprint('Skipping update of subscription that is only used with a default allow policy: ' + subName);
+ if (defaultPolicy === "deny" && subName.indexOf("deny_") === 0) {
+ dprint("Skipping update of subscription that is only used with a default allow policy: " + subName);
continue;
}
- updateSubs[subName] = {'serial' : serials[listName][subName]};
+ updateSubs[subName] = {"serial": serials[listName][subName]};
subCount++;
}
if (subCount === 0) {
- dprint('Skipping list with no subscriptions: ' + listName);
+ dprint("Skipping list with no subscriptions: " + listName);
continue;
}
var url = this._lists[listName].url;
if (!url) {
- url = DEFAULT_SUBSCRIPTION_LIST_URL_BASE + listName + '.json';
+ url = DEFAULT_SUBSCRIPTION_LIST_URL_BASE + listName + ".json";
}
if (!url) {
- dprint('Skipping list without url: ' + listName);
+ dprint("Skipping list without url: " + listName);
continue;
}
var list = new SubscriptionList(listName, url);
updatingLists[listName] = {};
for (let subName in updateSubs) {
- dprint('Will update subscription: ' + listName + ' ' + subName);
+ dprint("Will update subscription: " + listName + " " + subName);
updatingLists[listName][subName] = true;
}
updateResults[listName] = {};
let metadataSuccess = function(list) {
function subSuccess(sub, status) {
- dprint('Successfully updated subscription ' + sub.toString());
+ dprint("Successfully updated subscription " + sub.toString());
recordDone(list._name, sub._name, status);
}
function subError(sub, error) {
- dprint('Failed to update subscription ' + sub.toString() + ': ' +
+ dprint("Failed to update subscription " + sub.toString() + ": " +
error);
recordDone(list._name, sub._name, SUBSCRIPTION_UPDATE_FAILURE);
}
- dprint('Successfully updated list ' + list.toString());
+ dprint("Successfully updated list " + list.toString());
list.updateSubscriptions(updateSubs, subSuccess, subError);
};
let metadataError = function(list, error) {
- dprint('Failed to update list: ' + list.toString() + ': ' + error);
+ dprint("Failed to update list: " + list.toString() + ": " + error);
updateResults[listName] = false;
recordDone(list._name);
};
listCount++;
- dprint('Will update list: ' + listName);
+ dprint("Will update list: " + listName);
list.updateMetadata(metadataSuccess, metadataError);
}
if (listCount === 0) {
- dprint('No lists to update.');
- setTimeout(function () { callback(updateResults); }, 0);
+ dprint("No lists to update.");
+ setTimeout(function() { callback(updateResults); }, 0);
}
}
};
@@ -292,78 +292,78 @@ function SubscriptionList(name, url) {
}
SubscriptionList.prototype = {
- _name : null,
- _url : null,
- _data : null,
+ _name: null,
+ _url: null,
+ _data: null,
- toString : function () {
+ toString: function() {
return "[SubscriptionList " + this._name + " " + this._url + "]";
},
- updateMetadata : function (successCallback, errorCallback) {
- dprint('Updating ' + this.toString());
+ updateMetadata: function(successCallback, errorCallback) {
+ dprint("Updating " + this.toString());
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
var self = this;
- req.onload = function (event) {
+ req.onload = function(event) {
try {
self._data = JSON.parse(req.responseText);
// Maybe we don't need to write this to a file since we never read it
// back again (we always grab new metadata when updating).
- setTimeout(function () { successCallback(self); }, 0);
+ setTimeout(function() { successCallback(self); }, 0);
} catch (e) {
- setTimeout(function () { errorCallback(self, e.toString()); }, 0);
+ setTimeout(function() { errorCallback(self, e.toString()); }, 0);
}
};
- req.onerror = function (event) {
- setTimeout(function () { errorCallback(self, req.statusText); }, 0);
+ req.onerror = function(event) {
+ setTimeout(function() { errorCallback(self, req.statusText); }, 0);
};
- req.open('GET', this._url);
+ req.open("GET", this._url);
req.send(null);
},
- updateSubscriptions : function (userSubs, successCallback, errorCallback) {
+ updateSubscriptions: function(userSubs, successCallback, errorCallback) {
for (let subName in userSubs) {
let sub;
try {
var serial = this.getSubscriptionSerial(subName);
- dprint('Current serial for ' + this._name + ' ' + subName + ': ' +
+ dprint("Current serial for " + this._name + " " + subName + ": " +
userSubs[subName].serial);
- dprint('Available serial for ' + this._name + ' ' + subName + ': ' +
+ dprint("Available serial for " + this._name + " " + subName + ": " +
serial);
var subUrl = this.getSubscriptionUrl(subName);
sub = new Subscription(this._name, subName, subUrl);
if (serial > userSubs[subName].serial) {
sub.update(successCallback, errorCallback);
} else {
- dprint('No update needed for ' + this._name + ' ' + subName);
+ dprint("No update needed for " + this._name + " " + subName);
let curSub = sub;
- setTimeout(function () {
+ setTimeout(function() {
successCallback(curSub, SUBSCRIPTION_UPDATE_NOT_NEEDED);
}, 0);
}
} catch (e) {
let curSub = sub;
- setTimeout(function () {
+ setTimeout(function() {
errorCallback(curSub, e.toString());
}, 0);
}
}
},
-// getSubscriptionNames : function () {
-// var names = [];
-// for (var subName in this._data.subscriptions) {
-// names.push(subName);
-// }
-// return names;
-// },
+ // getSubscriptionNames : function () {
+ // var names = [];
+ // for (var subName in this._data.subscriptions) {
+ // names.push(subName);
+ // }
+ // return names;
+ // },
- getSubscriptionSerial : function (subName) {
+ getSubscriptionSerial: function(subName) {
return this._data.subscriptions[subName].serial;
},
- getSubscriptionUrl : function (subName) {
+ getSubscriptionUrl: function(subName) {
return this._data.subscriptions[subName].url;
}
};
@@ -389,27 +389,27 @@ function Subscription(listName, subName, subUrl) {
}
Subscription.prototype = {
- _list : null,
- _name : null,
- _url : null,
- _data : null,
+ _list: null,
+ _name: null,
+ _url: null,
+ _data: null,
- toString : function () {
+ toString: function() {
return "[Subscription " + this._list + " " + this._name + " " + this._url + "]";
},
- update : function (successCallback, errorCallback) {
- dprint('Updating ' + this.toString());
+ update: function(successCallback, errorCallback) {
+ dprint("Updating " + this.toString());
var req = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Components.interfaces.nsIXMLHttpRequest);
var self = this;
- req.onload = function (event) {
+ req.onload = function(event) {
try {
self._rawData = req.responseText;
if (!self._rawData) {
- let error = 'Empty response when requesting subscription file';
- setTimeout(function () {
+ let error = "Empty response when requesting subscription file";
+ setTimeout(function() {
errorCallback(self, error);
}, 0);
return;
@@ -422,15 +422,15 @@ Subscription.prototype = {
try {
serial = self._data.metadata.serial;
} catch (e) {
- let error = 'Ruleset has no serial number';
- setTimeout(function () {
+ let error = "Ruleset has no serial number";
+ setTimeout(function() {
errorCallback(self, error);
}, 0);
return;
}
- if (typeof serial !== 'number' || serial % 1 !== 0) {
- let error = 'Ruleset has invalid serial number: ' + serial;
- setTimeout(function () {
+ if (typeof serial !== "number" || serial % 1 !== 0) {
+ let error = "Ruleset has invalid serial number: " + serial;
+ setTimeout(function() {
errorCallback(self, error);
}, 0);
return;
@@ -438,10 +438,10 @@ Subscription.prototype = {
// The rest of the sanity checking is done by RawRuleset().
try {
var rawRuleset = new RawRuleset(self._rawData);
- RulesetStorage.saveRawRulesetToFile(rawRuleset, self._name + '.json',
+ RulesetStorage.saveRawRulesetToFile(rawRuleset, self._name + ".json",
self._list);
} catch (e) {
- setTimeout(function () { errorCallback(self, e.toString()); }, 0);
+ setTimeout(function() { errorCallback(self, e.toString()); }, 0);
return;
}
var subInfo = {};
@@ -449,19 +449,19 @@ Subscription.prototype = {
subInfo[self._list][self._name] = true;
Services.obs.notifyObservers(null, SUBSCRIPTION_UPDATED_TOPIC,
JSON.stringify(subInfo));
- setTimeout(function () {
+ setTimeout(function() {
successCallback(self, SUBSCRIPTION_UPDATE_SUCCESS);
}, 0);
} catch (e) {
- setTimeout(function () { errorCallback(self, e.toString()); }, 0);
+ setTimeout(function() { errorCallback(self, e.toString()); }, 0);
}
};
- req.onerror = function (event) {
- setTimeout(function () {
+ req.onerror = function(event) {
+ setTimeout(function() {
errorCallback(self, req.statusText);
}, 0);
};
- req.open('GET', this._url);
+ req.open("GET", this._url);
req.send(null);
}
diff --git a/src/content/lib/utils.jsm b/src/content/lib/utils.jsm
index 7fe2207..ab052d3 100644
--- a/src/content/lib/utils.jsm
+++ b/src/content/lib/utils.jsm
@@ -67,7 +67,6 @@ var Utils = (function() {
XPCOMUtils.defineLazyServiceGetter(self, "threadManager",
"@mozilla.org/thread-manager;1", "nsIThreadManager");
-
/**
* Calls a function multiple times until it succeeds. The
* function must return TRUE on success.
@@ -115,7 +114,6 @@ var Utils = (function() {
return undefined;
};
-
/**
* Return a module's `internal` object, which is a singleton.
* The `internal` can be accessed from all submodules of that module.
@@ -142,7 +140,6 @@ var Utils = (function() {
return aModuleScope.internal;
};
-
/**
* Wrap a function. Allow 'before' and 'after' functions.
* If the function was wrapped already earlier in time, the old
diff --git a/src/content/lib/utils/dom.jsm b/src/content/lib/utils/dom.jsm
index 99aef35..97b4112 100644
--- a/src/content/lib/utils/dom.jsm
+++ b/src/content/lib/utils/dom.jsm
@@ -28,14 +28,14 @@ this.EXPORTED_SYMBOLS = ["DOMUtils"];
// DOMUtils
//==============================================================================
-var DOMUtils = (function () {
+var DOMUtils = (function() {
let self = {};
/**
* Function that takes a DOM Element or an Array of DOM elements and removes
* all their children.
*/
- self.removeChildren = function (aElements) {
+ self.removeChildren = function(aElements) {
// If aElements is not an Array, put the element in an Array.
let elements = Array.isArray(aElements) ? aElements : [aElements];
// Note on `isArray` (above):
diff --git a/src/content/lib/utils/domains.jsm b/src/content/lib/utils/domains.jsm
index 4704811..0c04f78 100644
--- a/src/content/lib/utils/domains.jsm
+++ b/src/content/lib/utils/domains.jsm
@@ -209,7 +209,6 @@ DomainUtil.getBaseDomain = function(uri) {
}
};
-
/**
* Determine whether a hostname is an IP address.
*
@@ -273,13 +272,13 @@ DomainUtil.parseRefresh = function(refreshString) {
}
var url = parts[3];
if (url === undefined) {
- url = '';
+ url = "";
}
// Strip off enclosing quotes around the url.
if (url) {
var first = url[0];
var last = url[url.length - 1];
- if (first === last && (first === "'" || first === '"')) {
+ if (first === last && (first === "'" || first === "\"")) {
url = url.substring(1, url.length - 1);
}
}
diff --git a/src/content/lib/utils/files.jsm b/src/content/lib/utils/files.jsm
index 19210dd..6b4e292 100644
--- a/src/content/lib/utils/files.jsm
+++ b/src/content/lib/utils/files.jsm
@@ -65,7 +65,7 @@ var FileUtil = {
* @param {nsIFile}
* file
*/
- fileToArray : function(file) {
+ fileToArray: function(file) {
var stream = Cc["@mozilla.org/network/file-input-stream;1"]
.createInstance(Ci.nsIFileInputStream);
stream.init(file, 0x01, OCTAL_444, 0);
@@ -84,7 +84,7 @@ var FileUtil = {
*
* @param {nsIFile} file
*/
- fileToString : function(file) {
+ fileToString: function(file) {
// FIXME: This function MUST NOT check for the file to exist,
// otherwise the subscriptions are not fetched at all,
// for whatever reason.
@@ -131,7 +131,7 @@ var FileUtil = {
* @param {nsIFile}
* file
*/
- arrayToFile : function(lines, file) {
+ arrayToFile: function(lines, file) {
var stream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
// write, create, append on write, truncate
@@ -157,7 +157,7 @@ var FileUtil = {
* @param {nsIFile}
* file
*/
- stringToFile : function(str, file) {
+ stringToFile: function(str, file) {
var stream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
// write, create, append on write, truncate
@@ -179,29 +179,29 @@ var FileUtil = {
*
* @return {nsIFile}
*/
- getRPUserDir : function(subdir1, subdir2, subdir3) {
+ getRPUserDir: function(subdir1, subdir2, subdir3) {
var profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
var file = profileDir.clone();
file.appendRelativePath(REQUESTPOLICY_DIR);
- if(!file.exists()) {
+ if (!file.exists()) {
file.create(Ci.nsIFile.DIRECTORY_TYPE, OCTAL_700);
}
if (subdir1) {
file.appendRelativePath(subdir1);
- if(!file.exists()) {
+ if (!file.exists()) {
file.create(Ci.nsIFile.DIRECTORY_TYPE, OCTAL_700);
}
if (subdir2) {
file.appendRelativePath(subdir2);
- if(!file.exists()) {
+ if (!file.exists()) {
file.create(Ci.nsIFile.DIRECTORY_TYPE, OCTAL_700);
}
if (subdir3) {
file.appendRelativePath(subdir3);
- if(!file.exists()) {
+ if (!file.exists()) {
file.create(Ci.nsIFile.DIRECTORY_TYPE, OCTAL_700);
}
}
diff --git a/src/content/lib/utils/info.jsm b/src/content/lib/utils/info.jsm
index 19cda2b..114ea91 100644
--- a/src/content/lib/utils/info.jsm
+++ b/src/content/lib/utils/info.jsm
@@ -84,7 +84,7 @@ var Info = (function() {
self.isFirefox = appID === C.FIREFOX_ID;
self.isSeamonkey = appID === C.SEAMONKEY_ID;
self.isAustralis = self.isFirefox &&
- Services.vc.compare(Services.appinfo.platformVersion, '29') >= 0;
+ Services.vc.compare(Services.appinfo.platformVersion, "29") >= 0;
return self;
}());
diff --git a/src/content/lib/utils/windows.jsm b/src/content/lib/utils/windows.jsm
index d5ea38d..2daffb2 100644
--- a/src/content/lib/utils/windows.jsm
+++ b/src/content/lib/utils/windows.jsm
@@ -85,10 +85,10 @@ var WindowUtils = (function() {
let {PrivateBrowsingUtils} = Cu.import("resource://gre/modules/" +
"PrivateBrowsingUtils.jsm", {});
- return function (aWindow) {
+ return function(aWindow) {
return PrivateBrowsingUtils.isWindowPrivate(aWindow);
};
- } catch(e) {
+ } catch (e) {
// pre Firefox 20
try {
let pbs = Cc["@mozilla.org/privatebrowsing;1"]
@@ -97,7 +97,7 @@ var WindowUtils = (function() {
return function(aWindow) {
return pbs.privateBrowsingEnabled;
};
- } catch(e) {
+ } catch (e) {
Components.utils.reportError(e);
// It's uncertain if private browsing is possible at all, so assume
// that Private Browsing is not possible.
@@ -118,7 +118,6 @@ var WindowUtils = (function() {
rpPrefBranch.getBoolPref("privateBrowsingPermanentWhitelisting");
};
-
//
// Window & DOM utilities
//
diff --git a/src/content/lib/utils/xul.jsm b/src/content/lib/utils/xul.jsm
index 20912be..cd1cdb7 100644
--- a/src/content/lib/utils/xul.jsm
+++ b/src/content/lib/utils/xul.jsm
@@ -43,7 +43,6 @@ var XULUtils = {};
var xulTrees = XULUtils.xulTrees = {};
-
/**
* IIFE: Import the XUL trees and ensure their integrity.
*/
@@ -55,7 +54,7 @@ var xulTrees = XULUtils.xulTrees = {};
};
Services.scriptloader.loadSubScript(
- 'chrome://rpcontinued/content/ui/xul-trees.js',
+ "chrome://rpcontinued/content/ui/xul-trees.js",
xulTreesScope);
// For ensuring that each Element Spec has an ID.
@@ -82,7 +81,6 @@ var xulTrees = XULUtils.xulTrees = {};
}
}());
-
/**
* @param {Array<Object>} aElementSpecList
*
@@ -112,7 +110,6 @@ function recursivelyGetAllElementSpecs(aElementSpecList) {
return allElementSpecs;
}
-
function getParentElement(aDocument, aElementSpec) {
if (!aElementSpec.parent) {
return false;
@@ -182,7 +179,7 @@ function setAttributes(aElement, aElementSpec) {
}
}
-var {addEventListeners, removeEventListeners} = (function () {
+var {addEventListeners, removeEventListeners} = (function() {
/**
* @param {!Object} aRootObject
* @param {Array<string>} aListenerSpec
@@ -212,7 +209,7 @@ var {addEventListeners, removeEventListeners} = (function () {
}
var rootObject = aEventTarget.ownerDocument.defaultView.rpcontinued;
- return Object.keys(aEventList).map(function (eventName) {
+ return Object.keys(aEventList).map(function(eventName) {
return [
eventName,
getEventListener(rootObject, aEventList[eventName])
@@ -227,14 +224,14 @@ var {addEventListeners, removeEventListeners} = (function () {
*/
function addEventListeners(aEventTarget, {events}) {
var listeners = getEventInfoList(aEventTarget, events);
- listeners.forEach(function ([eventName, listener]) {
+ listeners.forEach(function([eventName, listener]) {
aEventTarget.addEventListener(eventName, listener, false);
});
}
function removeEventListeners(aEventTarget, {events}) {
var listeners = getEventInfoList(aEventTarget, events);
- listeners.forEach(function ([eventName, listener]) {
+ listeners.forEach(function([eventName, listener]) {
aEventTarget.removeEventListener(eventName, listener, false);
});
}
@@ -245,7 +242,6 @@ var {addEventListeners, removeEventListeners} = (function () {
};
}());
-
function recursivelyAddXULElements(aDocument, aElementSpecList,
aParentElement = null) {
for (let elementSpec of aElementSpecList) {
@@ -298,7 +294,7 @@ XULUtils.addTreeElementsToWindow = function(aWin, aTreeName) {
* @return {Array<string>} The list of IDs.
*/
function getRootElementIDs(aTreeName) {
- var ids = xulTrees[aTreeName].map(function (aElementSpec) {
+ var ids = xulTrees[aTreeName].map(function(aElementSpec) {
return aElementSpec.attributes.id;
});
return ids;
diff --git a/src/content/main/default-pref-handler.js b/src/content/main/default-pref-handler.js
index d42627b..9b7383b 100644
--- a/src/content/main/default-pref-handler.js
+++ b/src/content/main/default-pref-handler.js
@@ -101,7 +101,6 @@ let defaultPrefScriptScope = {
setUCharPref: prefInitFunctions.setUCharPref
};
-
//
// Load default preferences (if necessary)
//
diff --git a/src/content/main/pref-manager.jsm b/src/content/main/pref-manager.jsm
index 63fdd69..ddbf29a 100644
--- a/src/content/main/pref-manager.jsm
+++ b/src/content/main/pref-manager.jsm
@@ -80,7 +80,6 @@ var PrefManager = (function() {
Services.prefs.savePrefFile(null);
}
-
self.init = function() {
// ================================
// manually handle RP's default preferences
@@ -93,7 +92,6 @@ var PrefManager = (function() {
"chrome://rpcontinued/content/main/default-pref-handler.js",
{});
-
// ================================
// Link/DNS prefetching
// --------------------
@@ -116,7 +114,6 @@ var PrefManager = (function() {
}
}
-
// ================================
// Clean up old, unused prefs (removed in 0.2.0).
// ----------------------------------------------
@@ -131,11 +128,9 @@ var PrefManager = (function() {
}
}
-
Services.prefs.savePrefFile(null);
};
-
function maybeHandleUninstallOrDisable(data, reason) {
if (reason === C.ADDON_DISABLE || reason === C.ADDON_UNINSTALL) {
// TODO: Handle uninstallation in bootstrap.js, not here, RP might be
diff --git a/src/content/main/requestpolicy-service.jsm b/src/content/main/requestpolicy-service.jsm
index 8ed15d0..7f20048 100644
--- a/src/content/main/requestpolicy-service.jsm
+++ b/src/content/main/requestpolicy-service.jsm
@@ -53,12 +53,10 @@ var rpService = (function() {
let subscriptions = null;
-
//----------------------------------------------------------------------------
// Utility
//----------------------------------------------------------------------------
-
function loadConfigAndRules() {
subscriptions = new UserSubscriptions();
PolicyManager.loadUserRules();
@@ -90,7 +88,7 @@ var rpService = (function() {
}
function updateCompleted(result) {
Logger.info(Logger.TYPE_INTERNAL,
- 'Subscription updates completed: ' + result);
+ "Subscription updates completed: " + result);
}
subscriptions.update(updateCompleted, serials, defaultPolicy);
}
@@ -100,9 +98,9 @@ var rpService = (function() {
if (!rpPrefBranch.getBoolPref("welcomeWindowShown")) {
var url = "about:requestpolicy?setup";
- var wm = Cc['@mozilla.org/appshell/window-mediator;1'].
+ var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
getService(Ci.nsIWindowMediator);
- var windowtype = 'navigator:browser';
+ var windowtype = "navigator:browser";
var mostRecentWindow = wm.getMostRecentWindow(windowtype);
// the gBrowser object of the firefox window
@@ -119,12 +117,11 @@ var rpService = (function() {
}
}
-
/**
* Module for detecting installations of other RequestPolicy versions,
* which have a different extension ID.
*/
- var DetectorForOtherInstallations = (function () {
+ var DetectorForOtherInstallations = (function() {
const NOTICE_URL = "chrome://rpcontinued/content/" +
"multiple-installations.html";
@@ -154,11 +151,11 @@ var rpService = (function() {
}
}
- ProcessEnvironment.addStartupFunction(Environment.LEVELS.UI, function () {
+ ProcessEnvironment.addStartupFunction(Environment.LEVELS.UI, function() {
AddonManager.addAddonListener(addonListener);
});
- ProcessEnvironment.addShutdownFunction(Environment.LEVELS.UI, function () {
+ ProcessEnvironment.addShutdownFunction(Environment.LEVELS.UI, function() {
AddonManager.removeAddonListener(addonListener);
});
@@ -228,10 +225,6 @@ var rpService = (function() {
return {checkForOtherInstallations: checkForOtherInstallations};
}());
-
-
-
-
//----------------------------------------------------------------------------
// startup and shutdown functions
//----------------------------------------------------------------------------
@@ -267,17 +260,10 @@ var rpService = (function() {
}
});
-
-
-
-
self.getSubscriptions = function() {
return subscriptions;
};
-
-
-
//----------------------------------------------------------------------------
// nsIObserver interface
//----------------------------------------------------------------------------
@@ -285,7 +271,7 @@ var rpService = (function() {
self.observe = function(subject, topic, data) {
switch (topic) {
case SUBSCRIPTION_UPDATED_TOPIC: {
- Logger.debug(Logger.TYPE_INTERNAL, 'XXX updated: ' + data);
+ 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.
@@ -295,7 +281,7 @@ var rpService = (function() {
}
case SUBSCRIPTION_ADDED_TOPIC: {
- Logger.debug(Logger.TYPE_INTERNAL, 'XXX added: ' + data);
+ Logger.debug(Logger.TYPE_INTERNAL, "XXX added: " + data);
let subInfo = JSON.parse(data);
let failures = PolicyManager.loadSubscriptionRules(subInfo);
let failed = Object.getOwnPropertyNames(failures).length > 0;
@@ -311,7 +297,7 @@ var rpService = (function() {
}
let updateCompleted = function(result) {
Logger.info(Logger.TYPE_INTERNAL,
- 'Subscription update completed: ' + result);
+ "Subscription update completed: " + result);
};
subscriptions.update(updateCompleted, serials);
}
@@ -319,7 +305,7 @@ var rpService = (function() {
}
case SUBSCRIPTION_REMOVED_TOPIC: {
- Logger.debug(Logger.TYPE_INTERNAL, 'YYY: ' + data);
+ Logger.debug(Logger.TYPE_INTERNAL, "YYY: " + data);
let subInfo = JSON.parse(data);
PolicyManager.unloadSubscriptionRules(subInfo);
break;
diff --git a/src/content/main/window-manager-toolbarbutton.js b/src/content/main/window-manager-toolbarbutton.js
index 041ace5..570fd15 100644
--- a/src/content/main/window-manager-toolbarbutton.js
+++ b/src/content/main/window-manager-toolbarbutton.js
@@ -81,7 +81,7 @@ rpWindowManager = (function(self) {
defaultArea: CustomizableUI.AREA_NAVBAR,
label: label,
tooltiptext: tooltiptext,
- onCommand : function(aEvent) {
+ onCommand: function(aEvent) {
// Bad smell
let win = aEvent.target.ownerDocument.defaultView;
win.rpcontinued.overlay.openToolbarPopup(aEvent.target);
@@ -89,12 +89,10 @@ rpWindowManager = (function(self) {
});
}
-
//
// Case 2: Gecko < 29
//
-
// this function can be deleted if Gecko < 29 isn't supported anymore
self.addToolbarButtonToWindow = function(win) {
if (!isAustralis) {
@@ -109,7 +107,6 @@ rpWindowManager = (function(self) {
}
};
-
function addToolbarButtonToNavBar(win) {
// SeaMonkey users have to use a toolbar button now. At the moment I can't
// justify a bunch of special cases to support the statusbar when such a
@@ -164,6 +161,5 @@ rpWindowManager = (function(self) {
}
}
-
return self;
}(rpWindowManager || {}));
diff --git a/src/content/main/window-manager.jsm b/src/content/main/window-manager.jsm
index f5e1349..5e8e168 100644
--- a/src/content/main/window-manager.jsm
+++ b/src/content/main/window-manager.jsm
@@ -40,7 +40,7 @@ let {Environment, ProcessEnvironment} = importModule("lib/environment");
// WindowListener
//==============================================================================
-let WindowListener = (function () {
+let WindowListener = (function() {
let scope = {};
Services.scriptloader.loadSubScript(
"chrome://rpcontinued/content/main/window-manager.listener.js", scope);
@@ -51,7 +51,7 @@ let WindowListener = (function () {
// rpWindowManager
//==============================================================================
-var rpWindowManager = (function () {
+var rpWindowManager = (function() {
let self = {};
let styleSheets = [
@@ -66,15 +66,12 @@ var rpWindowManager = (function () {
let frameScriptURI = "chrome://rpcontinued/content/ui/frame.js?" +
Math.random();
-
-
function loadIntoWindow(window) {
// ==================================
// # 1 : create a scope variable for RP for this window
// ----------------------------------------------------
window.rpcontinued = {};
-
// ==================================
// # 2 : load the overlay's and menu's javascript
// ----------------------------------------------
@@ -93,7 +90,6 @@ var rpWindowManager = (function () {
"Error loading subscripts for window: " + e, e);
}
-
// ==================================
// # 3 : add all XUL elements
// --------------------------
@@ -104,7 +100,6 @@ var rpWindowManager = (function () {
"Couldn't add tree elements to window. " + e, e);
}
-
// ==================================
// # 4 : toolbar button
// --------------------
@@ -112,10 +107,9 @@ var rpWindowManager = (function () {
self.addToolbarButtonToWindow(window);
} catch (e) {
Logger.warning(Logger.TYPE_ERROR, "Error while adding the toolbar " +
- "button to the window: "+e, e);
+ "button to the window: " + e, e);
}
-
// ==================================
// # 5 : init the overlay
// ----------------------
@@ -125,7 +119,7 @@ var rpWindowManager = (function () {
window.rpcontinued.overlay.init();
} catch (e) {
Logger.warning(Logger.TYPE_ERROR,
- "An error occurred while initializing the overlay: "+e, e);
+ "An error occurred while initializing the overlay: " + e, e);
}
}
@@ -133,16 +127,13 @@ var rpWindowManager = (function () {
// # 5 : the overlay cares itself about shutdown.
// nothing to do here.
-
// # 4 : remove the toolbarbutton
// ------------------------------
self.removeToolbarButtonFromWindow(window);
-
// # 3 : remove all XUL elements
XULUtils.removeTreeElementsFromWindow(window, "mainTree");
-
// # 2 and 1 : remove the `rpcontinued` variable from the window
// ---------------------------------------------------------
// This wouldn't be needed when the window is closed, but this has to be
@@ -150,10 +141,6 @@ var rpWindowManager = (function () {
delete window.rpcontinued;
}
-
-
-
-
ProcessEnvironment.addStartupFunction(
Environment.LEVELS.INTERFACE,
function(data, reason) {
@@ -195,10 +182,6 @@ var rpWindowManager = (function () {
ProcessEnvironment.addShutdownFunction(Environment.LEVELS.UI,
unloadStyleSheets);
-
-
-
-
function loadStyleSheets() {
let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
.getService(Ci.nsIStyleSheetService);
@@ -232,11 +215,10 @@ var rpWindowManager = (function () {
}
}
-
return self;
}());
-rpWindowManager = (function () {
+rpWindowManager = (function() {
let scope = {rpWindowManager};
Services.scriptloader.loadSubScript(
"chrome://rpcontinued/content/main/window-manager-toolbarbutton.js",
diff --git a/src/content/main/window-manager.listener.js b/src/content/main/window-manager.listener.js
index 0095d9f..4f732d5 100644
--- a/src/content/main/window-manager.listener.js
+++ b/src/content/main/window-manager.listener.js
@@ -38,7 +38,6 @@ var WindowListener = (function() {
let nextWinID = 0;
let listeners = {};
-
let addEvLis = function(eventName, winID) {
if (typeof listeners[winID] !== "undefined" &&
listeners[winID][eventName] !== null) {
@@ -49,7 +48,7 @@ var WindowListener = (function() {
};
let removeEvLis = function(eventName, winID) {
- if (typeof listeners[winID] !== 'undefined' &&
+ if (typeof listeners[winID] !== "undefined" &&
listeners[winID][eventName] !== null) {
listeners[winID].window.removeEventListener(eventName,
listeners[winID][eventName]);
@@ -63,8 +62,6 @@ var WindowListener = (function() {
}
};
-
-
// external functions to be called on "load" or "unload" events
let externalLoadFunction = null;
let externalUnloadFunction = null;
@@ -75,8 +72,6 @@ var WindowListener = (function() {
externalUnloadFunction = f;
};
-
-
let addEventListenersToWindow = function(window) {
let winID = nextWinID++;
@@ -120,7 +115,6 @@ var WindowListener = (function() {
return winID;
};
-
function removeAllEventListeners() {
for (let winID in listeners) {
removeEvLis("load", winID);
@@ -130,7 +124,6 @@ var WindowListener = (function() {
nextWinID = 0;
}
-
let listening = false;
self.startListening = function() {
if (listening === false) {
@@ -147,8 +140,6 @@ var WindowListener = (function() {
removeAllEventListeners();
};
-
-
self.onOpenWindow = function(xulWindow) {
let window = xulWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
diff --git a/src/content/settings/advancedprefs.js b/src/content/settings/advancedprefs.js
index f1f056f..9de6695 100644
--- a/src/content/settings/advancedprefs.js
+++ b/src/content/settings/advancedprefs.js
@@ -1,6 +1,6 @@
/* global window, $, common, WinEnv, elManager, $id */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -13,130 +13,128 @@
//============================================================================
var PAGE_STRINGS = [
- 'basic',
- 'advanced',
- 'advancedPreferences',
- 'linkPrefetching',
- 'dnsPrefetching',
- 'enabled',
- 'disableOnStartup',
- 'restoreDefaultOnUninstall',
- 'menuPreferences',
- 'menuSorting',
- 'sortByNumRequests',
- 'sortByDestName',
- 'noSorting',
- 'hint',
- 'menuSortingHint',
- 'menuIndicatedInformation',
- 'menuIndicateNumRequests'
+ "basic",
+ "advanced",
+ "advancedPreferences",
+ "linkPrefetching",
+ "dnsPrefetching",
+ "enabled",
+ "disableOnStartup",
+ "restoreDefaultOnUninstall",
+ "menuPreferences",
+ "menuSorting",
+ "sortByNumRequests",
+ "sortByDestName",
+ "noSorting",
+ "hint",
+ "menuSortingHint",
+ "menuIndicatedInformation",
+ "menuIndicateNumRequests"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
});
-
function updateDisplay() {
// Link prefetch.
- $id('pref-linkPrefetch').checked =
- rootPrefBranch.getBoolPref('network.prefetch-next');
+ $id("pref-linkPrefetch").checked =
+ rootPrefBranch.getBoolPref("network.prefetch-next");
- $id('pref-prefetch.link.disableOnStartup').checked =
- rpPrefBranch.getBoolPref('prefetch.link.disableOnStartup');
+ $id("pref-prefetch.link.disableOnStartup").checked =
+ rpPrefBranch.getBoolPref("prefetch.link.disableOnStartup");
- $id('pref-prefetch.link.restoreDefaultOnUninstall').checked =
- rpPrefBranch.getBoolPref('prefetch.link.restoreDefaultOnUninstall');
+ $id("pref-prefetch.link.restoreDefaultOnUninstall").checked =
+ rpPrefBranch.getBoolPref("prefetch.link.restoreDefaultOnUninstall");
// DNS prefetch.
- $id('pref-dnsPrefetch').checked =
- !rootPrefBranch.getBoolPref('network.dns.disablePrefetch');
+ $id("pref-dnsPrefetch").checked =
+ !rootPrefBranch.getBoolPref("network.dns.disablePrefetch");
- $id('pref-prefetch.dns.disableOnStartup').checked =
- rpPrefBranch.getBoolPref('prefetch.dns.disableOnStartup');
+ $id("pref-prefetch.dns.disableOnStartup").checked =
+ rpPrefBranch.getBoolPref("prefetch.dns.disableOnStartup");
- $id('pref-prefetch.dns.restoreDefaultOnUninstall').checked =
- rpPrefBranch.getBoolPref('prefetch.dns.restoreDefaultOnUninstall');
+ $id("pref-prefetch.dns.restoreDefaultOnUninstall").checked =
+ rpPrefBranch.getBoolPref("prefetch.dns.restoreDefaultOnUninstall");
// TODO: Create a class which acts as an API for preferences and which ensures
// that the returned value is always a valid value for "string" preferences.
- var sorting = rpPrefBranch.getCharPref('menu.sorting');
-
- if (sorting === $id('sortByNumRequests').value) {
- $id('sortByNumRequests').checked = true;
- $id('sortByDestName').checked = false;
- $id('noSorting').checked = false;
- } else if (sorting === $id('noSorting').value) {
- $id('sortByNumRequests').checked = false;
- $id('sortByDestName').checked = false;
- $id('noSorting').checked = true;
+ var sorting = rpPrefBranch.getCharPref("menu.sorting");
+
+ if (sorting === $id("sortByNumRequests").value) {
+ $id("sortByNumRequests").checked = true;
+ $id("sortByDestName").checked = false;
+ $id("noSorting").checked = false;
+ } else if (sorting === $id("noSorting").value) {
+ $id("sortByNumRequests").checked = false;
+ $id("sortByDestName").checked = false;
+ $id("noSorting").checked = true;
} else {
- $id('sortByNumRequests').checked = false;
- $id('sortByDestName').checked = true;
- $id('noSorting').checked = false;
+ $id("sortByNumRequests").checked = false;
+ $id("sortByDestName").checked = true;
+ $id("noSorting").checked = false;
}
- $id('menu.info.showNumRequests').checked =
- rpPrefBranch.getBoolPref('menu.info.showNumRequests');
+ $id("menu.info.showNumRequests").checked =
+ rpPrefBranch.getBoolPref("menu.info.showNumRequests");
}
-
- window.onload = function () {
+ window.onload = function() {
updateDisplay();
// Link prefetch.
- elManager.addListener($id('pref-linkPrefetch'), 'change', function (event) {
- rootPrefBranch.setBoolPref('network.prefetch-next', event.target.checked);
+ elManager.addListener($id("pref-linkPrefetch"), "change", function(event) {
+ rootPrefBranch.setBoolPref("network.prefetch-next", event.target.checked);
Services.prefs.savePrefFile(null);
});
elManager.addListener(
- $id('pref-prefetch.link.disableOnStartup'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('prefetch.link.disableOnStartup',
+ $id("pref-prefetch.link.disableOnStartup"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("prefetch.link.disableOnStartup",
event.target.checked);
Services.prefs.savePrefFile(null);
});
elManager.addListener(
- $id('pref-prefetch.link.restoreDefaultOnUninstall'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('prefetch.link.restoreDefaultOnUninstall', event.target.checked);
+ $id("pref-prefetch.link.restoreDefaultOnUninstall"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("prefetch.link.restoreDefaultOnUninstall", event.target.checked);
Services.prefs.savePrefFile(null);
});
// DNS prefetch.
- elManager.addListener($id('pref-dnsPrefetch'), 'change', function (event) {
- rootPrefBranch.setBoolPref('network.dns.disablePrefetch', !event.target.checked);
+ elManager.addListener($id("pref-dnsPrefetch"), "change", function(event) {
+ rootPrefBranch.setBoolPref("network.dns.disablePrefetch", !event.target.checked);
Services.prefs.savePrefFile(null);
});
elManager.addListener(
- $id('pref-prefetch.dns.disableOnStartup'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('prefetch.dns.disableOnStartup', event.target.checked);
+ $id("pref-prefetch.dns.disableOnStartup"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("prefetch.dns.disableOnStartup", event.target.checked);
Services.prefs.savePrefFile(null);
});
elManager.addListener(
- $id('pref-prefetch.dns.restoreDefaultOnUninstall'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('prefetch.dns.restoreDefaultOnUninstall', event.target.checked);
+ $id("pref-prefetch.dns.restoreDefaultOnUninstall"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("prefetch.dns.restoreDefaultOnUninstall", event.target.checked);
Services.prefs.savePrefFile(null);
});
- var sortingListener = function (event) {
- rpPrefBranch.setCharPref('menu.sorting', event.target.value);
+ var sortingListener = function(event) {
+ rpPrefBranch.setCharPref("menu.sorting", event.target.value);
Services.prefs.savePrefFile(null);
};
- elManager.addListener($id('sortByNumRequests'), 'change', sortingListener);
- elManager.addListener($id('sortByDestName'), 'change', sortingListener);
- elManager.addListener($id('noSorting'), 'change', sortingListener);
+ elManager.addListener($id("sortByNumRequests"), "change", sortingListener);
+ elManager.addListener($id("sortByDestName"), "change", sortingListener);
+ elManager.addListener($id("noSorting"), "change", sortingListener);
elManager.addListener(
- $id('menu.info.showNumRequests'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('menu.info.showNumRequests', event.target.checked);
+ $id("menu.info.showNumRequests"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("menu.info.showNumRequests", event.target.checked);
Services.prefs.savePrefFile(null);
});
diff --git a/src/content/settings/basicprefs.js b/src/content/settings/basicprefs.js
index b1d52e3..fabb12b 100644
--- a/src/content/settings/basicprefs.js
+++ b/src/content/settings/basicprefs.js
@@ -1,6 +1,6 @@
/* global window, $, common, WinEnv, elManager, $id */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -13,74 +13,72 @@
//============================================================================
var PAGE_STRINGS = [
- 'basic',
- 'advanced',
- 'webPages',
- 'indicateBlockedImages',
- 'dontIndicateBlacklisted',
- 'autoReload',
- 'menu',
- 'allowAddingNonTemporaryRulesInPBM'
+ "basic",
+ "advanced",
+ "webPages",
+ "indicateBlockedImages",
+ "dontIndicateBlacklisted",
+ "autoReload",
+ "menu",
+ "allowAddingNonTemporaryRulesInPBM"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
});
-
function updateDisplay() {
- var indicate = rpPrefBranch.getBoolPref('indicateBlockedObjects');
- $id('pref-indicateBlockedObjects').checked = indicate;
- $id('indicateBlockedImages-details').hidden = !indicate;
+ var indicate = rpPrefBranch.getBoolPref("indicateBlockedObjects");
+ $id("pref-indicateBlockedObjects").checked = indicate;
+ $id("indicateBlockedImages-details").hidden = !indicate;
- $id('pref-dontIndicateBlacklistedObjects').checked =
- !rpPrefBranch.getBoolPref('indicateBlacklistedObjects');
+ $id("pref-dontIndicateBlacklistedObjects").checked =
+ !rpPrefBranch.getBoolPref("indicateBlacklistedObjects");
- $id('pref-autoReload').checked =
- rpPrefBranch.getBoolPref('autoReload');
+ $id("pref-autoReload").checked =
+ rpPrefBranch.getBoolPref("autoReload");
- $id('pref-privateBrowsingPermanentWhitelisting').checked =
- rpPrefBranch.getBoolPref('privateBrowsingPermanentWhitelisting');
+ $id("pref-privateBrowsingPermanentWhitelisting").checked =
+ rpPrefBranch.getBoolPref("privateBrowsingPermanentWhitelisting");
- // if (rpPrefBranch.getBoolPref('defaultPolicy.allow')) {
- // var word = 'allow';
- // } else {
- // var word = 'block';
- // }
- // $id('defaultpolicyword').innerHTML = word;
+ // if (rpPrefBranch.getBoolPref('defaultPolicy.allow')) {
+ // var word = 'allow';
+ // } else {
+ // var word = 'block';
+ // }
+ // $id('defaultpolicyword').innerHTML = word;
}
-
- window.onload = function () {
+ window.onload = function() {
updateDisplay();
elManager.addListener(
- $id('pref-indicateBlockedObjects'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('indicateBlockedObjects', event.target.checked);
+ $id("pref-indicateBlockedObjects"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("indicateBlockedObjects", event.target.checked);
Services.prefs.savePrefFile(null);
updateDisplay();
});
elManager.addListener(
- $id('pref-dontIndicateBlacklistedObjects'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('indicateBlacklistedObjects',
+ $id("pref-dontIndicateBlacklistedObjects"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("indicateBlacklistedObjects",
!event.target.checked);
Services.prefs.savePrefFile(null);
updateDisplay();
});
- elManager.addListener($id('pref-autoReload'), 'change', function(event) {
- rpPrefBranch.setBoolPref('autoReload', event.target.checked);
+ elManager.addListener($id("pref-autoReload"), "change", function(event) {
+ rpPrefBranch.setBoolPref("autoReload", event.target.checked);
Services.prefs.savePrefFile(null);
updateDisplay();
});
elManager.addListener(
- $id('pref-privateBrowsingPermanentWhitelisting'), 'change',
- function (event) {
- rpPrefBranch.setBoolPref('privateBrowsingPermanentWhitelisting',
+ $id("pref-privateBrowsingPermanentWhitelisting"), "change",
+ function(event) {
+ rpPrefBranch.setBoolPref("privateBrowsingPermanentWhitelisting",
event.target.checked);
Services.prefs.savePrefFile(null);
updateDisplay();
diff --git a/src/content/settings/common.js b/src/content/settings/common.js
index bcaebfb..fc9000f 100644
--- a/src/content/settings/common.js
+++ b/src/content/settings/common.js
@@ -1,7 +1,7 @@
/* global $, window */
/* exported common, WinEnv, elManager, $id, $str */
-var {common, WinEnv, elManager, $id, $str} = (function () {
+var {common, WinEnv, elManager, $id, $str} = (function() {
/* global Components */
const {utils: Cu} = Components;
@@ -25,20 +25,17 @@ var {common, WinEnv, elManager, $id, $str} = (function () {
WinEnv.startup();
var elManager = WinEnv.elManager;
-
var $id = window.document.getElementById.bind(window.document);
-
var COMMON_STRINGS = [
- 'preferences',
- 'managePolicies',
- 'about',
- 'help',
- 'basic',
- 'advanced'
+ "preferences",
+ "managePolicies",
+ "about",
+ "help",
+ "basic",
+ "advanced"
];
-
var $str = StringUtils.$str;
var common = {};
@@ -50,11 +47,11 @@ var {common, WinEnv, elManager, $id, $str} = (function () {
then calling this function will disable/enable the correct subscriptions.
*/
// TODO: rename this function.
- common.switchSubscriptionPolicies = function () {
+ common.switchSubscriptionPolicies = function() {
var subscriptions = new UserSubscriptions();
- var newDefaultPolicy = Prefs.isDefaultAllow() ? 'allow' : 'deny';
- var oldDefaultPolicy = Prefs.isDefaultAllow() ? 'deny' : 'allow';
+ var newDefaultPolicy = Prefs.isDefaultAllow() ? "allow" : "deny";
+ var oldDefaultPolicy = Prefs.isDefaultAllow() ? "deny" : "allow";
var listName, subName, subInfo;
@@ -105,7 +102,7 @@ var {common, WinEnv, elManager, $id, $str} = (function () {
*
* TODO: remove code duplication with menu.js
*/
- common.ruleDataPartToDisplayString = function (ruleDataPart) {
+ common.ruleDataPartToDisplayString = function(ruleDataPart) {
if (ruleDataPart.s && !ruleDataPart.h && !ruleDataPart.port) {
// Special case: Only a scheme is specified.
// The result string will be `scheme "..."`.
@@ -128,21 +125,14 @@ var {common, WinEnv, elManager, $id, $str} = (function () {
return str;
};
-
-
-
-
-
common.localize = function(stringNames) {
stringNames.forEach(function(name) {
- $('[data-string="' + name + '"]').each(function () {
+ $("[data-string=\"" + name + "\"]").each(function() {
$(this).text($str(name));
});
});
};
-
-
$(function() {
common.localize(COMMON_STRINGS);
});
diff --git a/src/content/settings/defaultpolicy.js b/src/content/settings/defaultpolicy.js
index 02ff63d..b28a357 100644
--- a/src/content/settings/defaultpolicy.js
+++ b/src/content/settings/defaultpolicy.js
@@ -1,6 +1,6 @@
/* global window, $, common, WinEnv, elManager, $id */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -13,49 +13,48 @@
//============================================================================
var PAGE_STRINGS = [
- 'yourPolicy',
- 'defaultPolicy',
- 'subscriptions',
- 'allowRequestsByDefault',
- 'blockRequestsByDefault',
- 'defaultPolicyDefinition',
- 'learnMore',
- 'allowRequestsToTheSameDomain',
- 'differentSubscriptionsAreAvailable',
- 'manageSubscriptions'
+ "yourPolicy",
+ "defaultPolicy",
+ "subscriptions",
+ "allowRequestsByDefault",
+ "blockRequestsByDefault",
+ "defaultPolicyDefinition",
+ "learnMore",
+ "allowRequestsToTheSameDomain",
+ "differentSubscriptionsAreAvailable",
+ "manageSubscriptions"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
});
-
function updateDisplay() {
- var defaultallow = rpPrefBranch.getBoolPref('defaultPolicy.allow');
+ var defaultallow = rpPrefBranch.getBoolPref("defaultPolicy.allow");
if (defaultallow) {
- $id('defaultallow').checked = true;
- $id('defaultdenysetting').hidden = true;
+ $id("defaultallow").checked = true;
+ $id("defaultdenysetting").hidden = true;
} else {
- $id('defaultdeny').checked = true;
- $id('defaultdenysetting').hidden = false;
+ $id("defaultdeny").checked = true;
+ $id("defaultdenysetting").hidden = false;
}
- var allowsamedomain = rpPrefBranch.getBoolPref('defaultPolicy.allowSameDomain');
- $id('allowsamedomain').checked = allowsamedomain;
+ var allowsamedomain = rpPrefBranch.getBoolPref("defaultPolicy.allowSameDomain");
+ $id("allowsamedomain").checked = allowsamedomain;
}
function showManageSubscriptionsLink() {
- $id('subscriptionschanged').style.display = 'block';
+ $id("subscriptionschanged").style.display = "block";
}
- window.onload = function () {
+ window.onload = function() {
updateDisplay();
elManager.addListener(
- $id('defaultallow'), 'change',
- function (event) {
+ $id("defaultallow"), "change",
+ function(event) {
var allow = event.target.checked;
- rpPrefBranch.setBoolPref('defaultPolicy.allow', allow);
+ rpPrefBranch.setBoolPref("defaultPolicy.allow", allow);
Services.prefs.savePrefFile(null);
// Reload all subscriptions because it's likely that different
// subscriptions will now be active.
@@ -65,10 +64,10 @@
});
elManager.addListener(
- $id('defaultdeny'), 'change',
- function (event) {
+ $id("defaultdeny"), "change",
+ function(event) {
var deny = event.target.checked;
- rpPrefBranch.setBoolPref('defaultPolicy.allow', !deny);
+ rpPrefBranch.setBoolPref("defaultPolicy.allow", !deny);
Services.prefs.savePrefFile(null);
// Reload all subscriptions because it's likely that different
// subscriptions will now be active.
@@ -78,10 +77,10 @@
});
elManager.addListener(
- $id('allowsamedomain'), 'change',
- function (event) {
+ $id("allowsamedomain"), "change",
+ function(event) {
var allowSameDomain = event.target.checked;
- rpPrefBranch.setBoolPref('defaultPolicy.allowSameDomain',
+ rpPrefBranch.setBoolPref("defaultPolicy.allowSameDomain",
allowSameDomain);
Services.prefs.savePrefFile(null);
});
diff --git a/src/content/settings/oldrules.js b/src/content/settings/oldrules.js
index 796e5c4..b8facdd 100644
--- a/src/content/settings/oldrules.js
+++ b/src/content/settings/oldrules.js
@@ -1,6 +1,6 @@
/* global window, $, common, $id, $str */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -13,26 +13,25 @@
//============================================================================
var PAGE_STRINGS = [
- 'importOldRules',
- 'deleteOldRules',
- 'showOldRuleReimportOptions',
- 'yourOldRulesHaveBeenDeleted',
- 'type',
- 'origin',
- 'destination'
+ "importOldRules",
+ "deleteOldRules",
+ "showOldRuleReimportOptions",
+ "yourOldRulesHaveBeenDeleted",
+ "type",
+ "origin",
+ "destination"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
});
var rules = null;
var addHostWildcard = true;
-
function clearRulesTable() {
- var table = $id('rules');
- var children = table.getElementsByTagName('tr');
+ var table = $id("rules");
+ var children = table.getElementsByTagName("tr");
while (children.length) {
var child = children.item(0);
child.parentNode.removeChild(child);
@@ -40,7 +39,7 @@
}
function populateRuleTable() {
- var table = $id('rules');
+ var table = $id("rules");
var oldRules = new OldRules();
// Setting the global rules var here.
@@ -48,29 +47,29 @@
for (var i = 0; i < rules.length; i++) {
var entry = rules[i];
- var origin = entry.o ? common.ruleDataPartToDisplayString(entry.o) : '';
- var dest = entry.d ? common.ruleDataPartToDisplayString(entry.d) : '';
- addRulesTableRow(table, 'allow', origin, dest, entry);
+ var origin = entry.o ? common.ruleDataPartToDisplayString(entry.o) : "";
+ var dest = entry.d ? common.ruleDataPartToDisplayString(entry.d) : "";
+ addRulesTableRow(table, "allow", origin, dest, entry);
}
}
function addRulesTableRow(table, ruleAction, origin, dest, ruleData) {
- var actionClass = ruleAction === 'allow' ? 'allow' : 'block';
- var action = ruleAction === 'allow' ? $str('allow') : $str('block');
+ var actionClass = ruleAction === "allow" ? "allow" : "block";
+ var action = ruleAction === "allow" ? $str("allow") : $str("block");
- var row = $('<tr>').addClass(actionClass).appendTo(table);
+ var row = $("<tr>").addClass(actionClass).appendTo(table);
row.append(
- $('<td>').text(action),
- $('<td>').text(origin),
- $('<td>').text(dest)
+ $("<td>").text(action),
+ $("<td>").text(origin),
+ $("<td>").text(dest)
);
}
- window.deleteOldRules = function () {
- Prefs.clearPref('allowedOrigins');
- Prefs.clearPref('allowedDestinations');
- Prefs.clearPref('allowedOriginsToDestinations');
+ window.deleteOldRules = function() {
+ Prefs.clearPref("allowedOrigins");
+ Prefs.clearPref("allowedDestinations");
+ Prefs.clearPref("allowedOriginsToDestinations");
$("#doimport").hide();
$("#deletedone").show();
$("#showReimportOptions").hide();
@@ -78,14 +77,14 @@
$("#deleteOldRules").hide();
};
- window.showReimportOptions = function () {
+ window.showReimportOptions = function() {
$("#showReimportOptions").hide();
$("#reimportOldRules").show();
};
- window.importOldRules = function () {
+ window.importOldRules = function() {
if (!rules || rules.length === 0) {
- throw 'rules is undefined or empty';
+ throw "rules is undefined or empty";
}
PolicyManager.addAllowRules(rules);
$("#doimport").hide();
@@ -100,7 +99,7 @@
populateRuleTable();
}
- window.onload = function () {
+ window.onload = function() {
var oldRulesExist = Prefs.oldRulesExist();
if (!oldRulesExist) {
$("#hasrules").hide();
@@ -108,7 +107,7 @@
return;
}
populateRuleTable();
- $('#addhostwildcards').change(handleAddHostWildcardsChange);
+ $("#addhostwildcards").change(handleAddHostWildcardsChange);
};
}());
diff --git a/src/content/settings/setup.js b/src/content/settings/setup.js
index f5c30b0..68b2187 100644
--- a/src/content/settings/setup.js
+++ b/src/content/settings/setup.js
@@ -1,6 +1,6 @@
/* global window, $, common, $id */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -20,34 +20,34 @@
//============================================================================
var PAGE_STRINGS = [
- 'welcomeToRequestPolicy',
- 'forMostUsersDefaultsAreIdeal',
- 'youCanConfigureRequestPolicyToBeMoreStrict',
- 'teachMeHowToUseRequestPolicy',
- 'returnToBrowsing',
- 'configureRequestPolicy',
- 'defaultPolicy',
- 'defaultPolicyDefinition',
- 'allowRequestsByDefault',
- 'blockRequestsByDefault',
- 'allowRequestsToTheSameDomain',
- 'subscriptionPolicies',
- 'subscriptionPoliciesDefinition',
- 'yesUseSubscriptions',
- 'noDoNotUseSubscriptions'
+ "welcomeToRequestPolicy",
+ "forMostUsersDefaultsAreIdeal",
+ "youCanConfigureRequestPolicyToBeMoreStrict",
+ "teachMeHowToUseRequestPolicy",
+ "returnToBrowsing",
+ "configureRequestPolicy",
+ "defaultPolicy",
+ "defaultPolicyDefinition",
+ "allowRequestsByDefault",
+ "blockRequestsByDefault",
+ "allowRequestsToTheSameDomain",
+ "subscriptionPolicies",
+ "subscriptionPoliciesDefinition",
+ "yesUseSubscriptions",
+ "noDoNotUseSubscriptions"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
});
function showConfigure() {
- $('#welcome').css('display', 'none');
- $('#configure').css('display', 'block');
+ $("#welcome").css("display", "none");
+ $("#configure").css("display", "block");
}
function handleDefaultPolicyChange() {
- rpPrefBranch.setBoolPref('defaultPolicy.allow',
+ rpPrefBranch.setBoolPref("defaultPolicy.allow",
$id("defaultallow").checked);
Services.prefs.savePrefFile(null);
setAllowSameDomainBlockDisplay();
@@ -55,16 +55,16 @@
}
function handleAllowSameDomainChange() {
- rpPrefBranch.setBoolPref('defaultPolicy.allowSameDomain',
+ rpPrefBranch.setBoolPref("defaultPolicy.allowSameDomain",
$id("allowsamedomain").checked);
Services.prefs.savePrefFile(null);
}
function setAllowSameDomainBlockDisplay() {
if ($id("defaultallow").checked) {
- $('#allowsamedomainblock').css('display', 'none');
+ $("#allowsamedomainblock").css("display", "none");
} else {
- $('#allowsamedomainblock').css('display', 'block');
+ $("#allowsamedomainblock").css("display", "block");
}
}
@@ -73,25 +73,25 @@
var enableAllowSubs = enableSubs && $id("defaultdeny").checked;
var enableDenySubs = enableSubs && $id("defaultallow").checked;
var subs = {
- 'allow_embedded':{},
- 'allow_extensions':{},
- 'allow_functionality':{},
- 'allow_mozilla':{},
- 'allow_sameorg':{},
- 'deny_trackers':{}
+ "allow_embedded": {},
+ "allow_extensions": {},
+ "allow_functionality": {},
+ "allow_mozilla": {},
+ "allow_sameorg": {},
+ "deny_trackers": {}
};
var userSubs = rpService.getSubscriptions();
for (var subName in subs) {
var subInfo = {};
subInfo.official = {};
subInfo.official[subName] = true;
- if (enableAllowSubs && subName.startsWith('allow_') ||
- enableDenySubs && subName.startsWith('deny_')) {
- userSubs.addSubscription('official', subName);
+ if (enableAllowSubs && subName.startsWith("allow_") ||
+ enableDenySubs && subName.startsWith("deny_")) {
+ userSubs.addSubscription("official", subName);
Services.obs.notifyObservers(null, SUBSCRIPTION_ADDED_TOPIC,
JSON.stringify(subInfo));
} else {
- userSubs.removeSubscription('official', subName);
+ userSubs.removeSubscription("official", subName);
Services.obs.notifyObservers(null, SUBSCRIPTION_REMOVED_TOPIC,
JSON.stringify(subInfo));
}
@@ -114,7 +114,7 @@
return args;
}*/
- window.onload = function () {
+ window.onload = function() {
// To retrieve the last RP version, `Info` needs to be used,
// because the pref "extensions.requestpolicy.lastVersion" has
// already been updated.
@@ -126,11 +126,11 @@
// Note: using version 1.0.0a8 instead of 1.0 as that was the last version
// before this setup window was added.
if (lastRPVersion &&
- Services.vc.compare(lastRPVersion, '0.0') > 0 &&
- Services.vc.compare(lastRPVersion, '1.0.0a8') <= 0) {
+ Services.vc.compare(lastRPVersion, "0.0") > 0 &&
+ Services.vc.compare(lastRPVersion, "1.0.0a8") <= 0) {
var identLevel;
- if (rpPrefBranch.prefHasUserValue('uriIdentificationLevel')) {
- identLevel = rpPrefBranch.getIntPref('uriIdentificationLevel');
+ if (rpPrefBranch.prefHasUserValue("uriIdentificationLevel")) {
+ identLevel = rpPrefBranch.getIntPref("uriIdentificationLevel");
} else {
identLevel = 1;
}
@@ -148,12 +148,12 @@
try {
ruleCount = PolicyManager.getUserRuleCount();
} catch (e) {
- Logger.warning(Logger.TYPE_INTERNAL, 'Unable to get new rule count: ' + e);
+ Logger.warning(Logger.TYPE_INTERNAL, "Unable to get new rule count: " + e);
ruleCount = -1;
}
- Logger.dump('Rule count: ' + ruleCount);
+ Logger.dump("Rule count: " + ruleCount);
if (ruleCount <= 0) {
- Logger.dump('Performing rule import.');
+ Logger.dump("Performing rule import.");
var addHostWildcard = identLevel === 1;
var oldRules = new OldRules();
var rules = oldRules.getAsNewRules(addHostWildcard);
@@ -164,15 +164,15 @@
showConfigure();
} else {
- var defaultAllow = rpPrefBranch.getBoolPref('defaultPolicy.allow');
+ var defaultAllow = rpPrefBranch.getBoolPref("defaultPolicy.allow");
$id("defaultallow").checked = !!defaultAllow;
$id("defaultdeny").checked = !defaultAllow;
if (!defaultAllow) {
- $('#allowsamedomainblock').css('display', 'block');
+ $("#allowsamedomainblock").css("display", "block");
}
$id("allowsamedomain").checked =
- rpPrefBranch.getBoolPref('defaultPolicy.allowSameDomain');
+ rpPrefBranch.getBoolPref("defaultPolicy.allowSameDomain");
// Subscriptions are only simple here if we assume the user won't open the
// setup window again after changing their individual subscriptions through
// the preferences. So, let's assume that as the worst case is that the setup
@@ -180,10 +180,10 @@
// enabled when they really aren't.
}
- $('#showconfigure').click(showConfigure);
- $('input[name=defaultpolicy]').change(handleDefaultPolicyChange);
- $('input[name=subscriptions]').change(handleSubscriptionsChange);
- $('#allowsamedomain').change(handleAllowSameDomainChange);
+ $("#showconfigure").click(showConfigure);
+ $("input[name=defaultpolicy]").change(handleDefaultPolicyChange);
+ $("input[name=subscriptions]").change(handleSubscriptionsChange);
+ $("#allowsamedomain").change(handleAllowSameDomainChange);
};
}());
diff --git a/src/content/settings/subscriptions.js b/src/content/settings/subscriptions.js
index a6a6d6e..0ea7041 100644
--- a/src/content/settings/subscriptions.js
+++ b/src/content/settings/subscriptions.js
@@ -1,6 +1,6 @@
/* global window, document, $, common, WinEnv, elManager */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -17,24 +17,24 @@
//============================================================================
var PAGE_STRINGS = [
- 'yourPolicy',
- 'defaultPolicy',
- 'subscriptions',
- 'subscriptionPolicies',
- 'subscriptionPoliciesDefinition',
- 'learnMoreAboutSubscriptions',
- 'usability',
- 'privacy',
- 'browser',
- 'subscriptionDenyTrackersDescription',
- 'subscriptionAllowSameOrgDescription',
- 'subscriptionAllowFunctionalityDescription',
- 'subscriptionAllowEmbeddedDescription',
- 'subscriptionAllowMozillaDescription',
- 'subscriptionAllowExtensionsDescription'
+ "yourPolicy",
+ "defaultPolicy",
+ "subscriptions",
+ "subscriptionPolicies",
+ "subscriptionPoliciesDefinition",
+ "learnMoreAboutSubscriptions",
+ "usability",
+ "privacy",
+ "browser",
+ "subscriptionDenyTrackersDescription",
+ "subscriptionAllowSameOrgDescription",
+ "subscriptionAllowFunctionalityDescription",
+ "subscriptionAllowEmbeddedDescription",
+ "subscriptionAllowMozillaDescription",
+ "subscriptionAllowExtensionsDescription"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
});
@@ -43,7 +43,7 @@
* "allow" or "deny"
*/
function getDefaultPolicyElements(policy) {
- var selector = '[data-defaultpolicy=' + policy + ']';
+ var selector = "[data-defaultpolicy=" + policy + "]";
var matches = document.body.querySelectorAll(selector);
var elements = Array.prototype.slice.call(matches);
return elements;
@@ -57,13 +57,13 @@
if (display) {
elements[i].removeAttribute("style");
} else {
- elements[i].style.display = 'none';
+ elements[i].style.display = "none";
}
}
}
function getInputElement(subName) {
- var elements = document.body.querySelectorAll('input[name=' + subName + ']');
+ var elements = document.body.querySelectorAll("input[name=" + subName + "]");
if (elements.length <= 0) {
return null;
}
@@ -94,18 +94,16 @@
var currentPolicy, otherPolicy;
if (Prefs.isDefaultAllow()) {
- currentPolicy = 'allow';
- otherPolicy = 'deny';
+ currentPolicy = "allow";
+ otherPolicy = "deny";
} else {
- currentPolicy = 'deny';
- otherPolicy = 'allow';
+ currentPolicy = "deny";
+ otherPolicy = "allow";
}
displayDefaultPolicyElements(currentPolicy, true);
displayDefaultPolicyElements(otherPolicy, false);
}
-
-
function handleSubscriptionCheckboxChange(event) {
var userSubs = rpService.getSubscriptions();
@@ -115,42 +113,42 @@
subInfo.official = {};
subInfo.official[subName] = true;
if (enabled) {
- userSubs.addSubscription('official', subName);
+ userSubs.addSubscription("official", subName);
Services.obs.notifyObservers(null, SUBSCRIPTION_ADDED_TOPIC,
JSON.stringify(subInfo));
} else {
- userSubs.removeSubscription('official', subName);
+ userSubs.removeSubscription("official", subName);
Services.obs.notifyObservers(null, SUBSCRIPTION_REMOVED_TOPIC,
JSON.stringify(subInfo));
}
}
- window.onload = function () {
+ window.onload = function() {
updateDisplay();
var available = {
- 'allow_embedded' : {},
- 'allow_extensions' : {},
- 'allow_functionality' : {},
- 'allow_mozilla' : {},
- 'allow_sameorg' : {},
- 'deny_trackers' : {}
+ "allow_embedded": {},
+ "allow_extensions": {},
+ "allow_functionality": {},
+ "allow_mozilla": {},
+ "allow_sameorg": {},
+ "deny_trackers": {}
};
for (var subName in available) {
var el = getInputElement(subName);
if (!el) {
- Logger.dump('Skipping unexpected official subName: ' + subName);
+ Logger.dump("Skipping unexpected official subName: " + subName);
continue;
}
- elManager.addListener(el, 'change', handleSubscriptionCheckboxChange);
+ elManager.addListener(el, "change", handleSubscriptionCheckboxChange);
}
- var selector = '[data-defaultpolicy=' +
- (Prefs.isDefaultAllow() ? 'deny' : 'allow') + ']';
+ var selector = "[data-defaultpolicy=" +
+ (Prefs.isDefaultAllow() ? "deny" : "allow") + "]";
var matches = document.body.querySelectorAll(selector);
var hideElements = Array.prototype.slice.call(matches);
for (var i = 0; i < hideElements.length; i++) {
- hideElements[i].style.display = 'none';
+ hideElements[i].style.display = "none";
}
// call updateDisplay() every time a subscription is added or removed
diff --git a/src/content/settings/yourpolicy.js b/src/content/settings/yourpolicy.js
index 6f96c23..521d1f1 100644
--- a/src/content/settings/yourpolicy.js
+++ b/src/content/settings/yourpolicy.js
@@ -1,6 +1,6 @@
/* global window, document, $, common, WinEnv, elManager, $id, $str */
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -12,33 +12,33 @@
//============================================================================
var PAGE_STRINGS = [
- 'yourPolicy',
- 'defaultPolicy',
- 'subscriptions',
- 'type',
- 'origin',
- 'destination',
- 'allow',
- 'block',
- 'temporary',
- 'addRule',
- 'learnMoreAboutRules',
- 'removeOldRules',
- 'ruleSet',
- 'filterRules',
- 'policy'
+ "yourPolicy",
+ "defaultPolicy",
+ "subscriptions",
+ "type",
+ "origin",
+ "destination",
+ "allow",
+ "block",
+ "temporary",
+ "addRule",
+ "learnMoreAboutRules",
+ "removeOldRules",
+ "ruleSet",
+ "filterRules",
+ "policy"
];
- $(function () {
+ $(function() {
common.localize(PAGE_STRINGS);
// l10n for input placeholders.
- $id("rulesearch").placeholder = $str('search');
- $('[name=originscheme]').prop('placeholder', $str('scheme'));
- $('[name=destscheme]').prop('placeholder', $str('scheme'));
- $('[name=originhost]').prop('placeholder', $str('host'));
- $('[name=desthost]').prop('placeholder', $str('host'));
- $('[name=originport]').prop('placeholder', $str('port'));
- $('[name=destport]').prop('placeholder', $str('port'));
+ $id("rulesearch").placeholder = $str("search");
+ $("[name=originscheme]").prop("placeholder", $str("scheme"));
+ $("[name=destscheme]").prop("placeholder", $str("scheme"));
+ $("[name=originhost]").prop("placeholder", $str("host"));
+ $("[name=desthost]").prop("placeholder", $str("host"));
+ $("[name=originport]").prop("placeholder", $str("port"));
+ $("[name=destport]").prop("placeholder", $str("port"));
});
const SEARCH_DELAY = 100;
@@ -48,7 +48,7 @@
function populateRuleTable(filter) {
searchTimeoutId = null;
- var table = $id('rules');
+ var table = $id("rules");
clearRulesTable(table);
@@ -57,12 +57,12 @@
// Get and display user rules
var user = PolicyManager.getUserRulesets().user;
entries = user.rawRuleset.toJSON().entries;
- addRules(entries, 'User', filter, false);
+ addRules(entries, "User", filter, false);
// Get and display temorary rules
var temp = PolicyManager.getUserRulesets().temp;
entries = temp.rawRuleset.toJSON().entries;
- addRules(entries, 'Temporary', filter, false);
+ addRules(entries, "Temporary", filter, false);
// Get and display subscription rules
var subscriptionLists = PolicyManager.getSubscriptionRulesets();
@@ -76,12 +76,12 @@
}
function addRules(entries, source, filter, readOnly) {
- var table = $('#rules');
+ var table = $("#rules");
for (var entryType in entries) {
for (var i = 0; i < entries[entryType].length; i++) {
var entry = entries[entryType][i];
- var origin = entry.o ? common.ruleDataPartToDisplayString(entry.o) : '';
- var dest = entry.d ? common.ruleDataPartToDisplayString(entry.d) : '';
+ var origin = entry.o ? common.ruleDataPartToDisplayString(entry.o) : "";
+ var dest = entry.d ? common.ruleDataPartToDisplayString(entry.d) : "";
if (filter) {
if (origin.indexOf(filter) === -1 && dest.indexOf(filter) === -1) {
continue;
@@ -99,18 +99,18 @@
// the same rule twice, (one of them might be a temporary
// rule), both will get removed.
var anchor = $(event.target);
- var ruleAction = anchor.data('requestpolicyRuleAction');
- var ruleData = anchor.data('requestpolicyRuleData');
- if (ruleAction === 'allow') {
+ var ruleAction = anchor.data("requestpolicyRuleAction");
+ var ruleData = anchor.data("requestpolicyRuleData");
+ if (ruleAction === "allow") {
PolicyManager.removeAllowRule(ruleData);
} else {
PolicyManager.removeDenyRule(ruleData);
}
- anchor.closest('tr').remove();
+ anchor.closest("tr").remove();
}
function clearRulesTable(table) {
- var children = table.getElementsByTagName('tr');
+ var children = table.getElementsByTagName("tr");
while (children.length) {
var child = children.item(0);
child.parentNode.removeChild(child);
@@ -120,40 +120,39 @@
function addRulesTableRow(table, ruleAction, origin, dest, ruleData, source,
readOnly) {
-
- if (ruleAction !== 'allow') {
- ruleAction = 'block';
+ if (ruleAction !== "allow") {
+ ruleAction = "block";
}
- ruleAction = ruleAction === 'allow' ? 'allow' : 'block';
- var ruleActionString = ruleAction === 'allow' ? $str('allow') :
- $str('block');
+ ruleAction = ruleAction === "allow" ? "allow" : "block";
+ var ruleActionString = ruleAction === "allow" ? $str("allow") :
+ $str("block");
- var row = $('<tr>').addClass(ruleAction).appendTo(table);
+ var row = $("<tr>").addClass(ruleAction).appendTo(table);
row.append(
- $('<td>').text(ruleActionString),
- $('<td>').text(origin),
- $('<td>').text(dest),
- $('<td>').text(source)
+ $("<td>").text(ruleActionString),
+ $("<td>").text(origin),
+ $("<td>").text(dest),
+ $("<td>").text(source)
);
if (!readOnly) {
- var anchor = $('<a>');
- anchor.text('x').addClass('deleterule');
- anchor.data('requestpolicyRuleAction', ruleAction);
- anchor.data('requestpolicyRuleData', ruleData);
+ var anchor = $("<a>");
+ anchor.text("x").addClass("deleterule");
+ anchor.data("requestpolicyRuleAction", ruleAction);
+ anchor.data("requestpolicyRuleData", ruleData);
anchor.click(deleteRule);
- row.append($('<td>').append(anchor));
+ row.append($("<td>").append(anchor));
} else {
- row.append($('<td>'));
+ row.append($("<td>"));
}
}
- window.addRule = function () {
+ window.addRule = function() {
try {
addRuleHelper();
} catch (e) {
- window.alert('Unable to add rule: ' + e.toString());
+ window.alert("Unable to add rule: " + e.toString());
return;
}
@@ -194,7 +193,7 @@
var destPart = ruleInfoToRuleDataPart(destScheme, destHost, destPort);
if (!originPart && !destPart) {
// TODO: don't throw, instead show message in form.
- throw 'You must specify some rule information';
+ throw "You must specify some rule information";
}
var ruleData = {};
if (originPart) {
@@ -218,15 +217,13 @@
}
}
-
-
- window.onload = function () {
- var search = $id('rulesearch');
- elManager.addListener(search, 'keyup', function (event) {
+ window.onload = function() {
+ var search = $id("rulesearch");
+ elManager.addListener(search, "keyup", function(event) {
if (searchTimeoutId !== null) {
window.clearTimeout(searchTimeoutId);
}
- searchTimeoutId = window.setTimeout(function () {
+ searchTimeoutId = window.setTimeout(function() {
populateRuleTable(event.target.value);
}, SEARCH_DELAY);
}, false);
@@ -237,7 +234,7 @@
// observe rule changes and update the table then
WinEnv.obMan.observe(["rpcontinued-rules-changed"], function() {
- var search = $id('rulesearch');
+ var search = $id("rulesearch");
populateRuleTable(search.value);
});
};
diff --git a/src/content/ui/classicmenu.js b/src/content/ui/classicmenu.js
index 8d29b64..1790644 100644
--- a/src/content/ui/classicmenu.js
+++ b/src/content/ui/classicmenu.js
@@ -23,7 +23,7 @@
/* global window, document */
-window.rpcontinued.classicmenu = (function () {
+window.rpcontinued.classicmenu = (function() {
var self = {};
/* global Components */
@@ -50,11 +50,10 @@ window.rpcontinued.classicmenu = (function () {
}
}
-
/**
* Removes all menu items and removes all event listeners.
*/
- self.emptyMenu = function (menu) {
+ self.emptyMenu = function(menu) {
var menuitems = menu.getElementsByTagName("menuitem");
for (let item of menuitems) {
if (!item.hasOwnProperty("rpListener")) {
@@ -69,7 +68,6 @@ window.rpcontinued.classicmenu = (function () {
DOMUtils.removeChildren(menu);
};
-
self.addMenuSeparator = function(menu) {
var separator = document.createElement("menuseparator");
menu.insertBefore(separator, menu.firstChild);
@@ -79,7 +77,7 @@ window.rpcontinued.classicmenu = (function () {
self.addMenuItem = function(menu, label, aCallback) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", label);
- var listener = function () {
+ var listener = function() {
aCallback();
conditionallyReloadDocument();
};
@@ -90,10 +88,9 @@ window.rpcontinued.classicmenu = (function () {
return menuItem;
};
-
self.addMenuItemTemporarilyAllowOrigin = function(menu, originHost) {
var label = StringUtils.$str("allowOriginTemporarily", [originHost]);
- var callback = function () {
+ var callback = function() {
rpcontinued.overlay.temporarilyAllowOrigin(originHost);
};
var item = self.addMenuItem(menu, label, callback);
@@ -103,18 +100,17 @@ window.rpcontinued.classicmenu = (function () {
self.addMenuItemAllowOrigin = function(menu, originHost) {
var label = StringUtils.$str("allowOrigin", [originHost]);
- var callback = function () {
+ var callback = function() {
rpcontinued.overlay.allowOrigin(originHost);
};
return self.addMenuItem(menu, label, callback);
};
-
self.addMenuItemTemporarilyAllowOriginToDest = function(menu, originHost,
destHost) {
var label = StringUtils.$str("allowOriginToDestinationTemporarily",
[originHost, destHost]);
- var callback = function () {
+ var callback = function() {
rpcontinued.overlay.temporarilyAllowOriginToDestination(originHost,
destHost);
};
@@ -126,7 +122,7 @@ window.rpcontinued.classicmenu = (function () {
self.addMenuItemAllowOriginToDest = function(menu, originHost, destHost) {
var label = StringUtils.$str("allowOriginToDestination",
[originHost, destHost]);
- var callback = function () {
+ var callback = function() {
rpcontinued.overlay.allowOriginToDestination(originHost, destHost);
};
var item = self.addMenuItem(menu, label, callback);
@@ -134,10 +130,9 @@ window.rpcontinued.classicmenu = (function () {
return item;
};
-
self.addMenuItemTemporarilyAllowDest = function(menu, destHost) {
var label = StringUtils.$str("allowDestinationTemporarily", [destHost]);
- var callback = function () {
+ var callback = function() {
rpcontinued.overlay.temporarilyAllowDestination(destHost);
};
var item = self.addMenuItem(menu, label, callback);
@@ -147,7 +142,7 @@ window.rpcontinued.classicmenu = (function () {
self.addMenuItemAllowDest = function(menu, destHost) {
var label = StringUtils.$str("allowDestination", [destHost]);
- var callback = function () {
+ var callback = function() {
rpcontinued.overlay.allowDestination(destHost);
};
return self.addMenuItem(menu, label, callback);
diff --git a/src/content/ui/frame.dom-content-loaded.js b/src/content/ui/frame.dom-content-loaded.js
index ffb81b5..1824232 100644
--- a/src/content/ui/frame.dom-content-loaded.js
+++ b/src/content/ui/frame.dom-content-loaded.js
@@ -52,7 +52,6 @@ var ManagerForDOMContentLoaded = (function() {
});
}
-
/**
* Determines if documentToCheck is the main document loaded in the currently
* active tab.
@@ -86,8 +85,8 @@ var ManagerForDOMContentLoaded = (function() {
let answers = mm.sendSyncMessage(C.MM_PREFIX + "notifyDocumentLoaded",
{documentURI: doc.documentURI});
if (answers.length === 0) {
- Logger.warning(Logger.TYPE_ERROR, 'There seems to be no message ' +
- 'listener for "notifyDocumentLoaded".');
+ Logger.warning(Logger.TYPE_ERROR, "There seems to be no message " +
+ "listener for \"notifyDocumentLoaded\".");
} else {
// take only one answer. If there are more answers, they are ignored
// ==> there must be only one listener for 'notifyDocumentLoaded'
@@ -140,9 +139,6 @@ var ManagerForDOMContentLoaded = (function() {
}
}
-
-
-
/**
* Perform the actions required once the DOM is loaded. This may be being
* called for more than just the page content DOM. It seems to work for now.
@@ -158,7 +154,6 @@ var ManagerForDOMContentLoaded = (function() {
// functions.
DocEnv.startup();
-
let documentURI = doc.documentURI;
let metaRefreshes = [];
@@ -197,7 +192,6 @@ var ManagerForDOMContentLoaded = (function() {
Logger.info(Logger.TYPE_META_REFRESH,
"Number of meta refreshes found: " + metaRefreshes.length);
-
var docShell = doc.defaultView
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
@@ -321,7 +315,6 @@ var ManagerForDOMContentLoaded = (function() {
// delete aWindow.rpOriginalFunctions;
//}
-
framescriptEnv.elManager.addListener(mm, "DOMContentLoaded",
onDOMContentLoaded, true);
diff --git a/src/content/ui/frame.js b/src/content/ui/frame.js
index d18f838..9d21901 100644
--- a/src/content/ui/frame.js
+++ b/src/content/ui/frame.js
@@ -20,7 +20,7 @@
* ***** END LICENSE BLOCK *****
*/
-(function () {
+(function() {
/* global Components */
const {utils: Cu} = Components;
@@ -42,24 +42,20 @@
//console.debug('[RPC] new framescript loading...');
-
-
-
let framescriptEnv = new FrameScriptEnvironment(mm);
let mlManager = framescriptEnv.mlManager;
let overlayComm = new FramescriptToOverlayCommunication(framescriptEnv);
-
// Create a scope for the sub-scripts, which also can
// be removed easily when the framescript gets unloaded.
var framescriptScope = {mm, framescriptEnv, mlManager, overlayComm};
function loadSubScripts() {
Services.scriptloader.loadSubScript(
- 'chrome://rpcontinued/content/ui/frame.blocked-content.js',
+ "chrome://rpcontinued/content/ui/frame.blocked-content.js",
framescriptScope);
Services.scriptloader.loadSubScript(
- 'chrome://rpcontinued/content/ui/frame.dom-content-loaded.js',
+ "chrome://rpcontinued/content/ui/frame.dom-content-loaded.js",
framescriptScope);
}
framescriptEnv.addStartupFunction(Environment.LEVELS.ESSENTIAL,
@@ -70,9 +66,6 @@
framescriptScope = null;
});
-
-
-
function reloadDocument() {
content.document.location.reload(false);
}
@@ -81,12 +74,10 @@
function setLocation(aUri) {
content.document.location.href = aUri;
}
- mlManager.addListener("setLocation", function (message) {
+ mlManager.addListener("setLocation", function(message) {
setLocation(message.data.uri);
});
-
-
// Listen for click events so that we can allow requests that result from
// user-initiated link clicks and form submissions.
function mouseClicked(event) {
@@ -133,7 +124,6 @@
framescriptEnv.elManager.addListener(mm, "click", mouseClicked, true);
});
-
// start up the framescript's environment
framescriptEnv.startup();
}());
diff --git a/src/content/ui/menu.js b/src/content/ui/menu.js
index 1f95f5e..c84b51b 100644
--- a/src/content/ui/menu.js
+++ b/src/content/ui/menu.js
@@ -23,7 +23,7 @@
/* global window, document */
-window.rpcontinued.menu = (function () {
+window.rpcontinued.menu = (function() {
/* global Components */
const {utils: Cu} = Components;
@@ -48,16 +48,12 @@ window.rpcontinued.menu = (function () {
//============================================================================
-
let gBrowser = WindowUtils.getTabBrowser(window);
-
let $id = document.getElementById.bind(document);
-
let initialized = false;
-
// TODO: Create a "List" class which also contains functions like
// _populateList() and emptyList().
var lists = {
@@ -69,18 +65,17 @@ window.rpcontinued.menu = (function () {
addRules: null
};
-
let self = {
- addedMenuItems : [],
+ addedMenuItems: [],
- _originItem : null,
- _originDomainnameItem : null,
- _originNumRequestsItem : null,
+ _originItem: null,
+ _originDomainnameItem: null,
+ _originNumRequestsItem: null,
- _isCurrentlySelectedDestBlocked : null,
- _isCurrentlySelectedDestAllowed : null,
+ _isCurrentlySelectedDestBlocked: null,
+ _isCurrentlySelectedDestAllowed: null,
- _ruleChangeQueues : {}
+ _ruleChangeQueues: {}
};
self.init = function() {
@@ -88,8 +83,8 @@ window.rpcontinued.menu = (function () {
initialized = true;
self._originItem = document.getElementById("rpc-origin");
- self._originDomainnameItem = $id('rpc-origin-domainname');
- self._originNumRequestsItem = $id('rpc-origin-num-requests');
+ self._originDomainnameItem = $id("rpc-origin-domainname");
+ self._originNumRequestsItem = $id("rpc-origin-num-requests");
lists.otherOrigins = $id("rpc-other-origins-list");
lists.blockedDestinations = $id("rpc-blocked-destinations-list");
@@ -98,7 +93,6 @@ window.rpcontinued.menu = (function () {
lists.addRules = $id("rpc-rules-add");
lists.removeRules = $id("rpc-rules-remove");
-
rpcontinued.overlay.OverlayEnvironment.addShutdownFunction(
Environment.LEVELS.INTERFACE,
function() {
@@ -110,7 +104,6 @@ window.rpcontinued.menu = (function () {
}
};
-
/**
* Remove all children from a list, and remove all event listeners.
*
@@ -133,14 +126,13 @@ window.rpcontinued.menu = (function () {
DOMUtils.removeChildren(aList);
}
-
self.prepareMenu = function() {
try {
var disabled = Prefs.isBlockingDisabled();
- $id('rpc-link-enable-blocking').hidden = !disabled;
- $id('rpc-link-disable-blocking').hidden = disabled;
+ $id("rpc-link-enable-blocking").hidden = !disabled;
+ $id("rpc-link-disable-blocking").hidden = disabled;
- $id('rpc-revoke-temporary-permissions').hidden =
+ $id("rpc-revoke-temporary-permissions").hidden =
!PolicyManager.temporaryRulesExist();
self._currentUri = rpcontinued.overlay.getTopLevelDocumentUri();
@@ -190,16 +182,16 @@ window.rpcontinued.menu = (function () {
self._setPrivateBrowsingStyles();
- // var hidePrefetchInfo = !Prefs.isPrefetchEnabled();
- // self._itemPrefetchWarning.hidden = hidePrefetchInfo;
- // self._itemPrefetchWarningSeparator.hidden = hidePrefetchInfo;
- //
- // if (isChromeUri) {
- // self._itemUnrestrictedOrigin.setAttribute("label",
- // StringUtils.$str("unrestrictedOrigin", ["chrome://"]));
- // self._itemUnrestrictedOrigin.hidden = false;
- // return;
- // }
+ // var hidePrefetchInfo = !Prefs.isPrefetchEnabled();
+ // self._itemPrefetchWarning.hidden = hidePrefetchInfo;
+ // self._itemPrefetchWarningSeparator.hidden = hidePrefetchInfo;
+ //
+ // if (isChromeUri) {
+ // self._itemUnrestrictedOrigin.setAttribute("label",
+ // StringUtils.$str("unrestrictedOrigin", ["chrome://"]));
+ // self._itemUnrestrictedOrigin.hidden = false;
+ // return;
+ // }
self._populateOrigin();
self._populateOtherOrigins();
@@ -214,9 +206,9 @@ window.rpcontinued.menu = (function () {
};
self._populateMenuForUncontrollableOrigin = function() {
- self._originDomainnameItem.setAttribute('value',
- StringUtils.$str('noOrigin'));
- self._originNumRequestsItem.setAttribute('value', '');
+ self._originDomainnameItem.setAttribute("value",
+ StringUtils.$str("noOrigin"));
+ self._originNumRequestsItem.setAttribute("value", "");
self._originItem.removeAttribute("default-policy");
self._originItem.removeAttribute("requests-blocked");
@@ -229,10 +221,10 @@ window.rpcontinued.menu = (function () {
lists.addRules
].forEach(emptyList);
- $id('rpc-other-origins').hidden = true;
- $id('rpc-blocked-destinations').hidden = true;
- $id('rpc-mixed-destinations').hidden = true;
- $id('rpc-allowed-destinations').hidden = true;
+ $id("rpc-other-origins").hidden = true;
+ $id("rpc-blocked-destinations").hidden = true;
+ $id("rpc-mixed-destinations").hidden = true;
+ $id("rpc-allowed-destinations").hidden = true;
// TODO: show some message about why the menu is empty.
};
@@ -244,8 +236,8 @@ window.rpcontinued.menu = (function () {
if (true === guiLocations) {
// get prefs
- let sorting = rpPrefBranch.getCharPref('menu.sorting');
- let showNumRequests = rpPrefBranch.getBoolPref('menu.info.showNumRequests');
+ let sorting = rpPrefBranch.getCharPref("menu.sorting");
+ let showNumRequests = rpPrefBranch.getBoolPref("menu.info.showNumRequests");
if (sorting === "numRequests") {
values.sort(GUILocation.sortByNumRequestsCompareFunction);
@@ -265,7 +257,7 @@ window.rpcontinued.menu = (function () {
"+" + props.numAllowedRequests + ")";
}
}
- let newitem = self._addListItem(list, 'rpc-od-item', guiLocation, num);
+ let newitem = self._addListItem(list, "rpc-od-item", guiLocation, num);
newitem.setAttribute("default-policy",
props.numDefaultPolicyRequests > 0 ? "true" : "false");
@@ -275,7 +267,7 @@ window.rpcontinued.menu = (function () {
} else {
values.sort();
for (let i in values) {
- self._addListItem(list, 'rpc-od-item', values[i]);
+ self._addListItem(list, "rpc-od-item", values[i]);
}
}
};
@@ -284,11 +276,11 @@ window.rpcontinued.menu = (function () {
self._originDomainnameItem.setAttribute("value", self._currentBaseDomain);
let showNumRequests = rpPrefBranch
- .getBoolPref('menu.info.showNumRequests');
+ .getBoolPref("menu.info.showNumRequests");
let props = self._getOriginGUILocationProperties();
- let numRequests = '';
+ let numRequests = "";
if (true === showNumRequests) {
if (props.numAllowedRequests > 0 && props.numBlockedRequests > 0) {
numRequests = props.numRequests + " (" +
@@ -308,7 +300,7 @@ window.rpcontinued.menu = (function () {
self._populateOtherOrigins = function() {
let guiOrigins = self._getOtherOriginsAsGUILocations();
self._populateList(lists.otherOrigins, guiOrigins);
- $id('rpc-other-origins').hidden = guiOrigins.length === 0;
+ $id("rpc-other-origins").hidden = guiOrigins.length === 0;
};
self._populateDestinations = function(originIdentifier) {
@@ -360,15 +352,15 @@ window.rpcontinued.menu = (function () {
self._populateList(lists.blockedDestinations,
destsWithSolelyBlockedRequests);
- $id('rpc-blocked-destinations').hidden =
+ $id("rpc-blocked-destinations").hidden =
destsWithSolelyBlockedRequests.length === 0;
self._populateList(lists.mixedDestinations, destsMixed);
- $id('rpc-mixed-destinations').hidden = destsMixed.length === 0;
+ $id("rpc-mixed-destinations").hidden = destsMixed.length === 0;
self._populateList(lists.allowedDestinations,
destsWithSolelyAllowedRequests);
- $id('rpc-allowed-destinations').hidden =
+ $id("rpc-allowed-destinations").hidden =
destsWithSolelyAllowedRequests.length === 0;
};
@@ -380,8 +372,8 @@ window.rpcontinued.menu = (function () {
emptyList(lists.addRules);
let ruleData = {
- 'o' : {
- 'h' : self._addWildcard(origin)
+ "o": {
+ "h": self._addWildcard(origin)
}
};
@@ -409,11 +401,11 @@ window.rpcontinued.menu = (function () {
if (dest) {
ruleData.d = {
- 'h' : self._addWildcard(dest)
+ "h": self._addWildcard(dest)
};
var destOnlyRuleData = {
- 'd' : {
- 'h' : self._addWildcard(dest)
+ "d": {
+ "h": self._addWildcard(dest)
}
};
//if (Prefs.isDefaultAllow()) {
@@ -426,7 +418,7 @@ window.rpcontinued.menu = (function () {
if (!PolicyManager.ruleExists(C.RULE_ACTION_ALLOW, ruleData) &&
!PolicyManager.ruleExists(C.RULE_ACTION_DENY, ruleData)) {
if (mayPermRulesBeAdded === true) {
- self._addMenuItemDenyOriginToDest(lists.addRules, ruleData);
+ self._addMenuItemDenyOriginToDest(lists.addRules, ruleData);
}
self._addMenuItemTempDenyOriginToDest(lists.addRules, ruleData);
}
@@ -504,38 +496,38 @@ window.rpcontinued.menu = (function () {
self._setPrivateBrowsingStyles = function() {
let mayPermRulesBeAdded = WindowUtils.mayPermanentRulesBeAdded(window);
- let val = mayPermRulesBeAdded === true ? '' : 'privatebrowsing';
- $id('rpc-details').setAttribute('class', val);
+ let val = mayPermRulesBeAdded === true ? "" : "privatebrowsing";
+ $id("rpc-details").setAttribute("class", val);
};
self._resetSelectedOrigin = function() {
- self._originItem.setAttribute('selected-origin', 'false');
+ self._originItem.setAttribute("selected-origin", "false");
for (var i = 0; i < lists.otherOrigins.childNodes.length; i++) {
var child = lists.otherOrigins.childNodes[i];
- child.setAttribute('selected-origin', 'false');
+ child.setAttribute("selected-origin", "false");
}
};
self._resetSelectedDest = function() {
for (let i = 0; i < lists.blockedDestinations.childNodes.length; i++) {
let child = lists.blockedDestinations.childNodes[i];
- child.setAttribute('selected-dest', 'false');
+ child.setAttribute("selected-dest", "false");
}
for (let i = 0; i < lists.mixedDestinations.childNodes.length; i++) {
let child = lists.mixedDestinations.childNodes[i];
- child.setAttribute('selected-dest', 'false');
+ child.setAttribute("selected-dest", "false");
}
for (let i = 0; i < lists.allowedDestinations.childNodes.length; i++) {
let child = lists.allowedDestinations.childNodes[i];
- child.setAttribute('selected-dest', 'false');
+ child.setAttribute("selected-dest", "false");
}
};
self._activateOriginItem = function(item) {
- if (item.id === 'rpc-origin') {
+ if (item.id === "rpc-origin") {
// it's _the_ origin
self._currentlySelectedOrigin = self._originDomainnameItem.value;
- } else if (item.parentNode.id === 'rpc-other-origins-list') {
+ } else if (item.parentNode.id === "rpc-other-origins-list") {
// it's an otherOrigin
self._currentlySelectedOrigin = item.getElementsByClassName("domainname")[0].value;
}
@@ -543,7 +535,7 @@ window.rpcontinued.menu = (function () {
// TODO: if the document's origin (rather than an other origin) is being
// activated, then regenerate the other origins list, as well.
self._resetSelectedOrigin();
- item.setAttribute('selected-origin', 'true');
+ item.setAttribute("selected-origin", "true");
self._populateDestinations();
self._resetSelectedDest();
self._populateDetails();
@@ -552,10 +544,10 @@ window.rpcontinued.menu = (function () {
self._activateDestinationItem = function(item) {
self._currentlySelectedDest = item.getElementsByClassName("domainname")[0].value;
- if (item.parentNode.id === 'rpc-blocked-destinations-list') {
+ if (item.parentNode.id === "rpc-blocked-destinations-list") {
self._isCurrentlySelectedDestBlocked = true;
self._isCurrentlySelectedDestAllowed = false;
- } else if (item.parentNode.id === 'rpc-allowed-destinations-list') {
+ } else if (item.parentNode.id === "rpc-allowed-destinations-list") {
self._isCurrentlySelectedDestBlocked = false;
self._isCurrentlySelectedDestAllowed = true;
} else {
@@ -564,11 +556,10 @@ window.rpcontinued.menu = (function () {
}
self._resetSelectedDest();
- item.setAttribute('selected-dest', 'true');
+ item.setAttribute("selected-dest", "true");
self._populateDetails();
};
-
self.itemSelected = function(event) {
var item = event.target;
// TODO: rather than compare IDs, this should probably compare against
@@ -578,19 +569,19 @@ window.rpcontinued.menu = (function () {
// item should be the <hbox>
item = item.parentNode;
}
- if (item.id === 'rpc-origin' ||
- item.parentNode.id === 'rpc-other-origins-list') {
+ if (item.id === "rpc-origin" ||
+ item.parentNode.id === "rpc-other-origins-list") {
self._activateOriginItem(item);
- } else if (item.parentNode.id === 'rpc-blocked-destinations-list' ||
- item.parentNode.id === 'rpc-mixed-destinations-list' ||
- item.parentNode.id === 'rpc-allowed-destinations-list') {
+ } else if (item.parentNode.id === "rpc-blocked-destinations-list" ||
+ item.parentNode.id === "rpc-mixed-destinations-list" ||
+ item.parentNode.id === "rpc-allowed-destinations-list") {
self._activateDestinationItem(item);
- } else if (item.parentNode.id === 'rpc-rules-remove' ||
- item.parentNode.id === 'rpc-rules-add') {
+ } else if (item.parentNode.id === "rpc-rules-remove" ||
+ item.parentNode.id === "rpc-rules-add") {
self._processRuleSelection(item);
} else {
Logger.severe(Logger.TYPE_ERROR,
- 'Unable to figure out which item type was selected.');
+ "Unable to figure out which item type was selected.");
}
};
@@ -599,22 +590,22 @@ window.rpcontinued.menu = (function () {
var ruleAction = item.requestpolicyRuleAction;
var undo;
- if (item.getAttribute('selected-rule') === 'true') {
- item.setAttribute('selected-rule', 'false');
+ if (item.getAttribute("selected-rule") === "true") {
+ item.setAttribute("selected-rule", "false");
undo = true;
} else {
- item.setAttribute('selected-rule', 'true');
+ item.setAttribute("selected-rule", "true");
undo = false;
}
if (!ruleData) {
Logger.severe(Logger.TYPE_ERROR,
- 'ruleData is empty in menu._processRuleSelection()');
+ "ruleData is empty in menu._processRuleSelection()");
return;
}
if (!ruleAction) {
Logger.severe(Logger.TYPE_ERROR,
- 'ruleAction is empty in menu._processRuleSelection()');
+ "ruleAction is empty in menu._processRuleSelection()");
return;
}
@@ -662,37 +653,35 @@ window.rpcontinued.menu = (function () {
self._processRuleChange = function(ruleAction, ruleData) {
switch (ruleAction) {
- case 'allow':
+ case "allow":
PolicyManager.addAllowRule(ruleData);
break;
- case 'allow-temp':
+ case "allow-temp":
PolicyManager.addTemporaryAllowRule(ruleData);
break;
- case 'stop-allow':
+ case "stop-allow":
PolicyManager.removeAllowRule(ruleData);
break;
- case 'deny':
+ case "deny":
PolicyManager.addDenyRule(ruleData);
break;
- case 'deny-temp':
+ case "deny-temp":
PolicyManager.addTemporaryDenyRule(ruleData);
break;
- case 'stop-deny':
+ case "stop-deny":
PolicyManager.removeDenyRule(ruleData);
break;
default:
- throw 'action not implemented: ' + ruleAction;
+ throw "action not implemented: " + ruleAction;
}
};
-
// Note by @jsamuel:
// „It's been too long since I looked at some of the new code.
// I think I may have assumed that I'd get rid of the different strictness
// levels and just use what is currently called LEVEL_SOP. If using anything
// else there will be errors from within getDeniedRequests().“
-
self._getBlockedDestinationsAsGUILocations = function() {
var reqSet = RequestProcessor.getDeniedRequests(
self._currentlySelectedOrigin, self._allRequestsOnDocument);
@@ -828,130 +817,130 @@ window.rpcontinued.menu = (function () {
self._addMenuItemStopAllowingOrigin = function(list, ruleData, subscriptionOverride) {
var originHost = ruleData.o.h;
- var ruleAction = subscriptionOverride ? 'deny' : 'stop-allow';
- return self._addMenuItemHelper(list, ruleData, 'stopAllowingOrigin', [originHost], ruleAction, 'rpc-stop-rule rpc-stop-allow');
+ var ruleAction = subscriptionOverride ? "deny" : "stop-allow";
+ return self._addMenuItemHelper(list, ruleData, "stopAllowingOrigin", [originHost], ruleAction, "rpc-stop-rule rpc-stop-allow");
};
self._addMenuItemStopAllowingDest = function(list, ruleData, subscriptionOverride) {
var destHost = ruleData.d.h;
- var ruleAction = subscriptionOverride ? 'deny' : 'stop-allow';
- return self._addMenuItemHelper(list, ruleData, 'stopAllowingDestination', [destHost], ruleAction, 'rpc-stop-rule rpc-stop-allow');
+ var ruleAction = subscriptionOverride ? "deny" : "stop-allow";
+ return self._addMenuItemHelper(list, ruleData, "stopAllowingDestination", [destHost], ruleAction, "rpc-stop-rule rpc-stop-allow");
};
self._addMenuItemStopAllowingOriginToDest = function(list, ruleData, subscriptionOverride) {
var originHost = ruleData.o.h;
var destHost = ruleData.d.h;
- var ruleAction = subscriptionOverride ? 'deny' : 'stop-allow';
- return self._addMenuItemHelper(list, ruleData, 'stopAllowingOriginToDestination', [originHost, destHost], ruleAction, 'rpc-stop-rule rpc-stop-allow');
+ var ruleAction = subscriptionOverride ? "deny" : "stop-allow";
+ return self._addMenuItemHelper(list, ruleData, "stopAllowingOriginToDestination", [originHost, destHost], ruleAction, "rpc-stop-rule rpc-stop-allow");
};
// Allow
self._addMenuItemAllowOrigin = function(list, ruleData) {
var originHost = ruleData.o.h;
- return self._addMenuItemHelper(list, ruleData, 'allowOrigin', [originHost], 'allow', 'rpc-start-rule rpc-allow');
+ return self._addMenuItemHelper(list, ruleData, "allowOrigin", [originHost], "allow", "rpc-start-rule rpc-allow");
};
self._addMenuItemAllowDest = function(list, ruleData) {
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'allowDestination', [destHost], 'allow', 'rpc-start-rule rpc-allow');
+ return self._addMenuItemHelper(list, ruleData, "allowDestination", [destHost], "allow", "rpc-start-rule rpc-allow");
};
self._addMenuItemAllowOriginToDest = function(list, ruleData) {
var originHost = ruleData.o.h;
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'allowOriginToDestination', [originHost, destHost], 'allow', 'rpc-start-rule rpc-allow');
+ return self._addMenuItemHelper(list, ruleData, "allowOriginToDestination", [originHost, destHost], "allow", "rpc-start-rule rpc-allow");
};
// Allow temp
self._addMenuItemTempAllowOrigin = function(list, ruleData) {
var originHost = ruleData.o.h;
- return self._addMenuItemHelper(list, ruleData, 'allowOriginTemporarily', [originHost], 'allow-temp', 'rpc-start-rule rpc-allow rpc-temporary');
+ return self._addMenuItemHelper(list, ruleData, "allowOriginTemporarily", [originHost], "allow-temp", "rpc-start-rule rpc-allow rpc-temporary");
};
self._addMenuItemTempAllowDest = function(list, ruleData) {
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'allowDestinationTemporarily', [destHost], 'allow-temp', 'rpc-start-rule rpc-allow rpc-temporary');
+ return self._addMenuItemHelper(list, ruleData, "allowDestinationTemporarily", [destHost], "allow-temp", "rpc-start-rule rpc-allow rpc-temporary");
};
self._addMenuItemTempAllowOriginToDest = function(list, ruleData) {
var originHost = ruleData.o.h;
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'allowOriginToDestinationTemporarily', [originHost, destHost], 'allow-temp', 'rpc-start-rule rpc-allow rpc-temporary');
+ return self._addMenuItemHelper(list, ruleData, "allowOriginToDestinationTemporarily", [originHost, destHost], "allow-temp", "rpc-start-rule rpc-allow rpc-temporary");
};
// Stop denying
self._addMenuItemStopDenyingOrigin = function(list, ruleData, subscriptionOverride) {
var originHost = ruleData.o.h;
- var ruleAction = subscriptionOverride ? 'allow' : 'stop-deny';
- return self._addMenuItemHelper(list, ruleData, 'stopDenyingOrigin', [originHost], ruleAction, 'rpc-stop-rule rpc-stop-deny');
+ var ruleAction = subscriptionOverride ? "allow" : "stop-deny";
+ return self._addMenuItemHelper(list, ruleData, "stopDenyingOrigin", [originHost], ruleAction, "rpc-stop-rule rpc-stop-deny");
};
self._addMenuItemStopDenyingDest = function(list, ruleData, subscriptionOverride) {
var destHost = ruleData.d.h;
- var ruleAction = subscriptionOverride ? 'allow' : 'stop-deny';
- return self._addMenuItemHelper(list, ruleData, 'stopDenyingDestination', [destHost], ruleAction, 'rpc-stop-rule rpc-stop-deny');
+ var ruleAction = subscriptionOverride ? "allow" : "stop-deny";
+ return self._addMenuItemHelper(list, ruleData, "stopDenyingDestination", [destHost], ruleAction, "rpc-stop-rule rpc-stop-deny");
};
self._addMenuItemStopDenyingOriginToDest = function(list, ruleData, subscriptionOverride) {
var originHost = ruleData.o.h;
var destHost = ruleData.d.h;
- var ruleAction = subscriptionOverride ? 'allow' : 'stop-deny';
- return self._addMenuItemHelper(list, ruleData, 'stopDenyingOriginToDestination', [originHost, destHost], ruleAction, 'rpc-stop-rule rpc-stop-deny');
+ var ruleAction = subscriptionOverride ? "allow" : "stop-deny";
+ return self._addMenuItemHelper(list, ruleData, "stopDenyingOriginToDestination", [originHost, destHost], ruleAction, "rpc-stop-rule rpc-stop-deny");
};
// Deny
self._addMenuItemDenyOrigin = function(list, ruleData) {
var originHost = ruleData.o.h;
- return self._addMenuItemHelper(list, ruleData, 'denyOrigin', [originHost], 'deny', 'rpc-start-rule rpc-deny');
+ return self._addMenuItemHelper(list, ruleData, "denyOrigin", [originHost], "deny", "rpc-start-rule rpc-deny");
};
self._addMenuItemDenyDest = function(list, ruleData) {
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'denyDestination', [destHost], 'deny', 'rpc-start-rule rpc-deny');
+ return self._addMenuItemHelper(list, ruleData, "denyDestination", [destHost], "deny", "rpc-start-rule rpc-deny");
};
self._addMenuItemDenyOriginToDest = function(list, ruleData) {
var originHost = ruleData.o.h;
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'denyOriginToDestination', [originHost, destHost], 'deny', 'rpc-start-rule rpc-deny');
+ return self._addMenuItemHelper(list, ruleData, "denyOriginToDestination", [originHost, destHost], "deny", "rpc-start-rule rpc-deny");
};
// Deny temp
self._addMenuItemTempDenyOrigin = function(list, ruleData) {
var originHost = ruleData.o.h;
- return self._addMenuItemHelper(list, ruleData, 'denyOriginTemporarily', [originHost], 'deny-temp', 'rpc-start-rule rpc-deny rpc-temporary');
+ return self._addMenuItemHelper(list, ruleData, "denyOriginTemporarily", [originHost], "deny-temp", "rpc-start-rule rpc-deny rpc-temporary");
};
self._addMenuItemTempDenyDest = function(list, ruleData) {
var destHost = ruleData.d.h;
- return self._addMenuItemHelper(list, ruleData, 'denyDestinationTemporarily', [destHost], 'deny-temp', 'rpc-start-rule rpc-deny rpc-temporary');
+ return self._addMenuItemHelper(list, ruleData, "denyDestinationTemporarily", [destHost], "deny-temp", "rpc-start-rule rpc-deny rpc-temporary");
};
self._addMenuItemTempDenyOriginToDest = function(list, ruleData) {
var originHost = ruleData.o.h;
var destHost = ruleData.d.h;
return self._addMenuItemHelper(list, ruleData,
- 'denyOriginToDestinationTemporarily', [originHost, destHost],
- 'deny-temp', 'rpc-start-rule rpc-deny rpc-temporary');
+ "denyOriginToDestinationTemporarily", [originHost, destHost],
+ "deny-temp", "rpc-start-rule rpc-deny rpc-temporary");
};
self._addMenuItemHelper = function(list, ruleData, fmtStrName, fmtStrArgs,
ruleAction, cssClass) {
var label = StringUtils.$str(fmtStrName, fmtStrArgs);
- var item = self._addListItem(list, 'rpc-od-item', label);
+ var item = self._addListItem(list, "rpc-od-item", label);
item.requestpolicyRuleData = ruleData;
item.requestpolicyRuleAction = ruleAction;
//var statustext = ''; // TODO
- item.setAttribute('class', 'rpc-od-item ' + cssClass);
+ item.setAttribute("class", "rpc-od-item " + cssClass);
var canonicalRule = Ruleset.rawRuleToCanonicalString(ruleData);
if (self._ruleChangeQueues[ruleAction]) {
if (self._ruleChangeQueues[ruleAction][canonicalRule]) {
- item.setAttribute('selected-rule', 'true');
+ item.setAttribute("selected-rule", "true");
}
}
return item;
@@ -1054,7 +1043,6 @@ window.rpcontinued.menu = (function () {
continue;
}
-
var results = destinations[destUri][0]; // TODO: Do not look only
// at the first RequestResult object, but at all. (there might be
// several requests with identical origin and destination URI.)
@@ -1109,7 +1097,7 @@ window.rpcontinued.menu = (function () {
let userRules = {};
let subscriptionRules = {};
- reqSet.print('deniedRequests');
+ reqSet.print("deniedRequests");
// TODO: there is no dest if no dest is selected (origin only).
//var destBase = DomainUtil.getBaseDomain(
@@ -1206,11 +1194,11 @@ window.rpcontinued.menu = (function () {
for (let destHost in destHosts) {
let ruleData = {
- 'o' : {
- 'h' : self._addWildcard(origin)
+ "o": {
+ "h": self._addWildcard(origin)
},
- 'd' : {
- 'h': destHost
+ "d": {
+ "h": destHost
}
};
if (!PolicyManager.ruleExists(C.RULE_ACTION_ALLOW, ruleData) &&
@@ -1222,8 +1210,8 @@ window.rpcontinued.menu = (function () {
}
let destOnlyRuleData = {
- 'd' : {
- 'h': destHost
+ "d": {
+ "h": destHost
}
};
if (!PolicyManager.ruleExists(C.RULE_ACTION_ALLOW, destOnlyRuleData) &&
diff --git a/src/content/ui/overlay.js b/src/content/ui/overlay.js
index c457cdc..c7d5fab 100644
--- a/src/content/ui/overlay.js
+++ b/src/content/ui/overlay.js
@@ -27,7 +27,7 @@
* Provides functionality for the overlay. An instance of this class exists for
* each tab/window.
*/
-window.rpcontinued.overlay = (function () {
+window.rpcontinued.overlay = (function() {
/* global Components */
const {utils: Cu} = Components;
@@ -53,7 +53,6 @@ window.rpcontinued.overlay = (function () {
//============================================================================
-
let gBrowser = WindowUtils.getTabBrowser(window);
let $id = document.getElementById.bind(document);
@@ -63,14 +62,12 @@ window.rpcontinued.overlay = (function () {
//let _prefetchInfoUri = "http://www.requestpolicy.com/help/prefetch.html";
//let _prefetchDisablingInstructionsUri = "http://www.requestpolicy.com/help/prefetch.html#disable";
-
// create an environment for this overlay.
let OverlayEnvironment = new Environment(ProcessEnvironment, "OverlayEnv");
// manage this overlay's message listeners:
let mlManager = new ManagerForMessageListeners(OverlayEnvironment,
window.messageManager);
-
let initialized = false;
let toolbarButtonId = "rpcontinuedToolbarButton";
@@ -93,8 +90,6 @@ window.rpcontinued.overlay = (function () {
let isFennec = false;
-
-
let self = {
// This is set by request-log.js when it is initialized. We don't need to worry
// about setting it here.
@@ -102,7 +97,6 @@ window.rpcontinued.overlay = (function () {
OverlayEnvironment: OverlayEnvironment
};
-
self.toString = function() {
return "[rpcontinued.overlay " + overlayId + "]";
};
@@ -242,9 +236,6 @@ window.rpcontinued.overlay = (function () {
OverlayEnvironment.addStartupFunction(Environment.LEVELS.INTERFACE,
addTabContainerTabSelectListener);
-
-
-
mlManager.addListener("notifyDocumentLoaded", function(message) {
let {documentURI} = message.data;
@@ -299,9 +290,7 @@ window.rpcontinued.overlay = (function () {
return {blockedURIs: blockedURIs};
});
-
-
- mlManager.addListener("notifyTopLevelDocumentLoaded", function (message) {
+ mlManager.addListener("notifyTopLevelDocumentLoaded", function(message) {
// Clear any notifications that may have been present.
self._setContentBlockedState(false);
// We don't do this immediately anymore because slow systems might have
@@ -318,9 +307,7 @@ window.rpcontinued.overlay = (function () {
self._updateBlockedContentStateAfterTimeout();
});
-
-
- mlManager.addListener("notifyDOMFrameContentLoaded", function (message) {
+ mlManager.addListener("notifyDOMFrameContentLoaded", function(message) {
// This has an advantage over just relying on the
// observeBlockedRequest() call in that this will clear a blocked
// content notification if there no longer blocked content. Another way
@@ -331,28 +318,20 @@ window.rpcontinued.overlay = (function () {
self._updateBlockedContentState(message.target);
});
-
-
mlManager.addListener("handleMetaRefreshes", function(message) {
self.handleMetaRefreshes(message);
});
-
-
- mlManager.addListener("notifyLinkClicked", function (message) {
+ mlManager.addListener("notifyLinkClicked", function(message) {
RequestProcessor.registerLinkClicked(message.data.origin,
message.data.dest);
});
-
-
- mlManager.addListener("notifyFormSubmitted", function (message) {
+ mlManager.addListener("notifyFormSubmitted", function(message) {
RequestProcessor.registerFormSubmitted(message.data.origin,
message.data.dest);
});
-
-
self.handleMetaRefreshes = function(message) {
Logger.dump("Handling meta refreshes...");
@@ -390,7 +369,6 @@ window.rpcontinued.overlay = (function () {
}
};
-
/**
* Takes an URI, crops it if necessary, and returns it.
* It's ensured that the returned URI isn't longer than a specified length,
@@ -416,7 +394,6 @@ window.rpcontinued.overlay = (function () {
}
}
-
/**
* Shows a notification that a redirect was requested by a page (meta refresh
* or with headers).
@@ -470,7 +447,6 @@ window.rpcontinued.overlay = (function () {
[cropUri(redirectOriginUri, 50), cropUri(redirectTargetUri, 50)]);
}
-
var addRuleMenuName = "rpcontinuedRedirectAddRuleMenu";
var addRulePopup = $id(addRuleMenuName);
var cm = rpcontinued.classicmenu;
@@ -517,9 +493,6 @@ window.rpcontinued.overlay = (function () {
}
}
-
-
-
var notification = notificationBox
.getNotificationWithValue(notificationValue);
if (notification) {
@@ -587,7 +560,6 @@ window.rpcontinued.overlay = (function () {
return true;
};
-
/**
* Performs actions required to be performed after a tab change.
*/
@@ -712,7 +684,7 @@ window.rpcontinued.overlay = (function () {
* This function is called during shouldLoad(). As shouldLoad shoudn't be
* blocked, it's better to set a timeout here.
*/
- self.observeBlockedTopLevelDocRequest = function (browser, originUri,
+ self.observeBlockedTopLevelDocRequest = function(browser, originUri,
destUri) {
// This function is called during shouldLoad() so set a timeout to
// avoid blocking shouldLoad.
@@ -772,17 +744,17 @@ window.rpcontinued.overlay = (function () {
* the subsequent shouldLoad() call.
*/
self._wrapOpenLink = function() {
- Utils.wrapFunction(window.gContextMenu, "openLink", function () {
+ Utils.wrapFunction(window.gContextMenu, "openLink", function() {
RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
this.linkURL);
});
- Utils.wrapFunction(window.gContextMenu, "openLinkInPrivateWindow", function () {
+ Utils.wrapFunction(window.gContextMenu, "openLinkInPrivateWindow", function() {
RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
this.linkURL);
});
- Utils.wrapFunction(window.gContextMenu, "openLinkInCurrent", function () {
+ Utils.wrapFunction(window.gContextMenu, "openLinkInCurrent", function() {
RequestProcessor.registerLinkClicked(this.target.ownerDocument.URL,
this.linkURL);
});
@@ -835,7 +807,7 @@ window.rpcontinued.overlay = (function () {
self._addLocationObserver = function() {
self.locationListener = {
- onLocationChange : function(aProgress, aRequest, aURI) {
+ onLocationChange: function(aProgress, aRequest, aURI) {
// This gets called both for tab changes and for history navigation.
// The timer is running on the main window, not the document's window,
// so we want to stop the timer when the tab is changed.
@@ -859,33 +831,33 @@ window.rpcontinued.overlay = (function () {
self._addHistoryObserver = function() {
// Implements nsISHistoryListener (and nsISupportsWeakReference)
self.historyListener = {
- OnHistoryGoBack : function(backURI) {
+ OnHistoryGoBack: function(backURI) {
RequestProcessor.registerHistoryRequest(backURI.asciiSpec);
return true;
},
- OnHistoryGoForward : function(forwardURI) {
+ OnHistoryGoForward: function(forwardURI) {
RequestProcessor.registerHistoryRequest(forwardURI.asciiSpec);
return true;
},
- OnHistoryGotoIndex : function(index, gotoURI) {
+ OnHistoryGotoIndex: function(index, gotoURI) {
RequestProcessor.registerHistoryRequest(gotoURI.asciiSpec);
return true;
},
- OnHistoryNewEntry : function(newURI) {
+ OnHistoryNewEntry: function(newURI) {
},
- OnHistoryPurge : function(numEntries) {
+ OnHistoryPurge: function(numEntries) {
return true;
},
- OnHistoryReload : function(reloadURI, reloadFlags) {
+ OnHistoryReload: function(reloadURI, reloadFlags) {
return true;
},
- QueryInterface : function(aIID, aResult) {
+ QueryInterface: function(aIID, aResult) {
if (aIID.equals(Components.interfaces.nsISHistoryListener) ||
aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
aIID.equals(Components.interfaces.nsISupports)) {
@@ -894,7 +866,7 @@ window.rpcontinued.overlay = (function () {
throw Components.results.NS_NOINTERFACE;
},
- GetWeakReference : function() {
+ GetWeakReference: function() {
return Components.classes["@mozilla.org/appshell/appShellService;1"]
.createInstance(Components.interfaces.nsIWeakReference);
}
@@ -914,11 +886,11 @@ window.rpcontinued.overlay = (function () {
} catch (e) {
if (tries >= maxTries) {
Logger.severeError("Can't add session history listener, even " +
- "after " + tries + " tries. "+e, e);
+ "after " + tries + " tries. " + e, e);
return;
}
// call this function again in a few miliseconds.
- window.setTimeout(function () {
+ window.setTimeout(function() {
// Prevent the `setTimeout` warning of the AMO Validator.
tryAddingSHistoryListener();
}, waitTime);
@@ -944,9 +916,9 @@ window.rpcontinued.overlay = (function () {
* event
*/
self.onPopupShowing = function(event) {
- // if (event.currentTarget != event.originalTarget) {
- // return;
- // }
+ // if (event.currentTarget != event.originalTarget) {
+ // return;
+ // }
rpcontinued.menu.prepareMenu();
};
@@ -965,9 +937,9 @@ window.rpcontinued.overlay = (function () {
}
}
self._needsReloadOnMenuClose = false;
- // if (event.currentTarget != event.originalTarget) {
- // return;
- // }
+ // if (event.currentTarget != event.originalTarget) {
+ // return;
+ // }
// Leave the popup attached to the context menu, as we consider that the
// default location for it.
//self._attachPopupToContextMenu();
@@ -1146,8 +1118,8 @@ window.rpcontinued.overlay = (function () {
// },
self.openToolbarPopup = function(anchor) {
- // rpcontinued.overlay._toolbox.insertBefore(rpcontinued.overlay.popupElement,
- // null);
+ // rpcontinued.overlay._toolbox.insertBefore(rpcontinued.overlay.popupElement,
+ // null);
popupElement.openPopup(anchor, "after_start", 0, 0, true, true);
};
@@ -1162,7 +1134,6 @@ window.rpcontinued.overlay = (function () {
self.openHelp = openLinkInNewTab.bind(this,
"https://github.com/RequestPolicyContinued/requestpolicy/wiki/Help-and-Support");
-
self.clearRequestLog = function() {
self.requestLog.clear();
};
diff --git a/src/content/ui/request-log.filtering.js b/src/content/ui/request-log.filtering.js
index a519694..39604bf 100644
--- a/src/content/ui/request-log.filtering.js
+++ b/src/content/ui/request-log.filtering.js
@@ -23,7 +23,7 @@
/* global window */
-window.rpcontinued.requestLog = (function (self) {
+window.rpcontinued.requestLog = (function(self) {
/* global Components */
const {utils: Cu} = Components;
@@ -45,7 +45,7 @@ window.rpcontinued.requestLog = (function (self) {
let filterValue = elements.filterTextbox.value;
// create a new regular expression
- filterText = filterValue.length === 0 ? null : new RegExp(filterValue, 'i');
+ filterText = filterValue.length === 0 ? null : new RegExp(filterValue, "i");
// enable/disable the "Clear Filter" button
elements.clearFilterButton.disabled = filterValue.length === 0;
@@ -58,9 +58,6 @@ window.rpcontinued.requestLog = (function (self) {
self.filterChanged();
};
-
-
-
/**
* Check if the row should be displayed or filtered out.
*
@@ -99,9 +96,8 @@ window.rpcontinued.requestLog = (function (self) {
// notify that the table rows has changed
let newRowCount = self.treeView.rowCount;
- self.treebox.rowCountChanged(0, newRowCount-oldRowCount);
+ self.treebox.rowCountChanged(0, newRowCount - oldRowCount);
}
-
return self;
}(window.rpcontinued.requestLog || {}));
diff --git a/src/content/ui/request-log.interface.js b/src/content/ui/request-log.interface.js
index 1aa74e3..d753b09 100644
--- a/src/content/ui/request-log.interface.js
+++ b/src/content/ui/request-log.interface.js
@@ -25,7 +25,7 @@
window.rpcontinued = window.rpcontinued || {};
-window.rpcontinued.requestLog = (function (self) {
+window.rpcontinued.requestLog = (function(self) {
/* global Components */
const {utils: Cu} = Components;
@@ -75,8 +75,8 @@ window.rpcontinued.requestLog = (function (self) {
var forbidden = true;
try {
var uri = DomainUtil.getUriObject(content);
- if (uri.scheme === 'http' || uri.scheme === 'https' ||
- uri.scheme === 'ftp') {
+ if (uri.scheme === "http" || uri.scheme === "https" ||
+ uri.scheme === "ftp") {
forbidden = false;
}
} catch (e) {
@@ -92,9 +92,6 @@ window.rpcontinued.requestLog = (function (self) {
window.top.openUILinkIn(content, "tab", {relatedToCurrent: true});
};
-
-
-
function addRow(aRow) {
self.rows.push(aRow);
@@ -125,7 +122,5 @@ window.rpcontinued.requestLog = (function (self) {
addRow([originURI, destURI, true, (new Date()).toLocaleTimeString()]);
};
-
-
return self;
}(window.rpcontinued.requestLog || {}));
diff --git a/src/content/ui/request-log.js b/src/content/ui/request-log.js
index e444f7f..25a303c 100644
--- a/src/content/ui/request-log.js
+++ b/src/content/ui/request-log.js
@@ -25,7 +25,7 @@
window.rpcontinued = window.rpcontinued || {};
-window.rpcontinued.requestLog = (function (self) {
+window.rpcontinued.requestLog = (function(self) {
/* global Components */
const {utils: Cu} = Components;
@@ -45,13 +45,10 @@ window.rpcontinued.requestLog = (function (self) {
let $id = window.document.getElementById.bind(window.document);
-
self.isEmptyMessageDisplayed = true;
self.rows = [];
self.visibleRows = [];
-
-
function init() {
self.tree = $id("rpcontinued-requestLog-tree");
@@ -72,7 +69,5 @@ window.rpcontinued.requestLog = (function (self) {
// call init() on the window's "load" event
WinEnv.elManager.addListener(window, "load", init, false);
-
-
return self;
}(window.rpcontinued.requestLog || {}));
diff --git a/src/content/ui/request-log.tree-view.js b/src/content/ui/request-log.tree-view.js
index 5252ca4..349721b 100644
--- a/src/content/ui/request-log.tree-view.js
+++ b/src/content/ui/request-log.tree-view.js
@@ -25,26 +25,23 @@
window.rpcontinued = window.rpcontinued || {};
-window.rpcontinued.requestLog = (function (self) {
+window.rpcontinued.requestLog = (function(self) {
//============================================================================
self.treebox = null;
self.columnNameToIndexMap = {
- "rpcontinued-requestLog-origin" : 0,
- "rpcontinued-requestLog-destination" : 1,
- "rpcontinued-requestLog-blocked" : 2,
- "rpcontinued-requestLog-time" : 3
+ "rpcontinued-requestLog-origin": 0,
+ "rpcontinued-requestLog-destination": 1,
+ "rpcontinued-requestLog-blocked": 2,
+ "rpcontinued-requestLog-time": 3
};
-
function getVisibleRowAtIndex(index) {
return self.visibleRows[self.visibleRows.length - index - 1];
}
-
-
//
// the interface.
// see https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/Tutorial/Custom_Tree_Views
diff --git a/src/content/ui/xul-trees.js b/src/content/ui/xul-trees.js
index 6c8d010..9f58d80 100644
--- a/src/content/ui/xul-trees.js
+++ b/src/content/ui/xul-trees.js
@@ -27,7 +27,6 @@
// https://developer.mozilla.org/en-US/Add-ons/SeaMonkey_2
let isSeamonkey = appID === C.SEAMONKEY_ID;
-
exports.toolbarbutton = [
{
parent: {
@@ -83,7 +82,6 @@ exports.mainTree = [
]
},
-
{
parent: {special: {type: "__window__"}},
@@ -99,7 +97,6 @@ exports.mainTree = [
]
},
-
{
parent: {special: {type: "__window__"}},
@@ -300,7 +297,6 @@ exports.mainTree = [
]
},
-
{
parent: {id: "appcontent"},
tag: "splitter",
--
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