[Pkg-mozext-commits] [requestpolicy] 08/280: [refactoring] rename CI to Ci
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:29:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit dc01be160293909f9ab94ca036af2e37eefe6a54
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Nov 25 04:57:12 2014 +0100
[refactoring] rename CI to Ci
---
src/components/requestpolicyService.js | 40 +++++++++++++++++-----------------
src/content/lib/DomainUtil.jsm | 14 ++++++------
src/content/lib/FileUtil.jsm | 30 ++++++++++++-------------
src/content/lib/PolicyManager.jsm | 6 ++---
src/content/lib/Request.jsm | 12 +++++-----
src/content/lib/RequestProcessor.jsm | 28 ++++++++++++------------
src/content/lib/Util.jsm | 16 +++++++-------
7 files changed, 73 insertions(+), 73 deletions(-)
diff --git a/src/components/requestpolicyService.js b/src/components/requestpolicyService.js
index 963b9cd..dd98636 100644
--- a/src/components/requestpolicyService.js
+++ b/src/components/requestpolicyService.js
@@ -21,14 +21,14 @@
* ***** END LICENSE BLOCK *****
*/
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
-const CP_OK = CI.nsIContentPolicy.ACCEPT;
+const CP_OK = Ci.nsIContentPolicy.ACCEPT;
const CP_NOP = function() {
return CP_OK;
};
-const CP_REJECT = CI.nsIContentPolicy.REJECT_SERVER;
+const CP_REJECT = Ci.nsIContentPolicy.REJECT_SERVER;
const EXTENSION_ID = "requestpolicy at requestpolicy.com";
@@ -59,7 +59,7 @@ RequestPolicyService.prototype = {
{category : "content-policy"}
],
QueryInterface : XPCOMUtils.generateQI(
- [CI.nsIRequestPolicy, CI.nsIObserver, CI.nsIContentPolicy]),
+ [Ci.nsIRequestPolicy, Ci.nsIObserver, Ci.nsIContentPolicy]),
/* Factory that creates a singleton instance of the component */
_xpcom_factory : {
@@ -157,7 +157,7 @@ RequestPolicyService.prototype = {
try {
// For Firefox <= 3.6.
var em = CC["@mozilla.org/extensions/manager;1"].
- getService(CI.nsIExtensionManager);
+ getService(Ci.nsIExtensionManager);
var ext;
for (var i = 0; i < idArray.length; i++) {
rp.mod.Logger.info(rp.mod.Logger.TYPE_INTERNAL,
@@ -276,7 +276,7 @@ RequestPolicyService.prototype = {
_initializeApplicationCompatibility : function() {
var appInfo = CC["@mozilla.org/xre/app-info;1"].
- getService(CI.nsIXULAppInfo);
+ getService(Ci.nsIXULAppInfo);
// Mozilla updates (doing this for all applications, not just individual
// applications from the Mozilla community that I'm aware of).
@@ -513,7 +513,7 @@ RequestPolicyService.prototype = {
_register : function() {
var os = CC['@mozilla.org/observer-service;1'].
- getService(CI.nsIObserverService);
+ getService(Ci.nsIObserverService);
os.addObserver(this, "http-on-examine-response", false);
os.addObserver(this, "http-on-modify-request", false);
os.addObserver(this, "xpcom-shutdown", false);
@@ -538,7 +538,7 @@ RequestPolicyService.prototype = {
_unregister : function() {
try {
var os = CC['@mozilla.org/observer-service;1'].
- getService(CI.nsIObserverService);
+ getService(Ci.nsIObserverService);
os.removeObserver(this, "http-on-examine-response");
os.removeObserver(this, "http-on-modify-request");
os.removeObserver(this, "xpcom-shutdown");
@@ -563,14 +563,14 @@ RequestPolicyService.prototype = {
_initializePrefSystem : function() {
// Get the preferences branch and setup the preferences observer.
this._prefService = CC["@mozilla.org/preferences-service;1"].
- getService(CI.nsIPrefService);
+ getService(Ci.nsIPrefService);
this.prefs = this._prefService.getBranch("extensions.requestpolicy.")
- .QueryInterface(CI.nsIPrefBranch2);
+ .QueryInterface(Ci.nsIPrefBranch2);
this.prefs.addObserver("", this, false);
this._rootPrefs = this._prefService.getBranch("")
- .QueryInterface(CI.nsIPrefBranch2);
+ .QueryInterface(Ci.nsIPrefBranch2);
this._rootPrefs.addObserver("network.prefetch-next", this, false);
this._rootPrefs.addObserver("network.dns.disablePrefetch", this, false);
},
@@ -601,7 +601,7 @@ RequestPolicyService.prototype = {
});
} else {
var em = CC["@mozilla.org/extensions/manager;1"].
- getService(CI.nsIExtensionManager);
+ getService(Ci.nsIExtensionManager);
var addon = em.getItemForID(EXTENSION_ID);
this.prefs.setCharPref("lastVersion", addon.version);
util.curVersion = addon.version;
@@ -643,7 +643,7 @@ RequestPolicyService.prototype = {
break;
}
var observerService = CC['@mozilla.org/observer-service;1'].
- getService(CI.nsIObserverService);
+ getService(Ci.nsIObserverService);
observerService.notifyObservers(null, "requestpolicy-prefs-changed", null);
},
@@ -688,7 +688,7 @@ RequestPolicyService.prototype = {
_initializePrivateBrowsing : function() {
try {
var pbs = CC["@mozilla.org/privatebrowsing;1"].
- getService(CI.nsIPrivateBrowsingService);
+ getService(Ci.nsIPrivateBrowsingService);
this._privateBrowsingEnabled = pbs.privateBrowsingEnabled;
} catch (e) {
// Ignore exceptions from browsers that do not support private browsing.
@@ -700,7 +700,7 @@ RequestPolicyService.prototype = {
var url = "chrome://requestpolicy/content/settings/setup.html";
var wm = CC['@mozilla.org/appshell/window-mediator;1'].
- getService(CI.nsIWindowMediator);
+ getService(Ci.nsIWindowMediator);
var windowtype = 'navigator:browser';
var mostRecentWindow = wm.getMostRecentWindow(windowtype);
@@ -910,7 +910,7 @@ RequestPolicyService.prototype = {
var prefs = this.prefs;
function prefEmpty(pref) {
try {
- var value = prefs.getComplexValue(pref, CI.nsISupportsString).data;
+ var value = prefs.getComplexValue(pref, Ci.nsISupportsString).data;
return value == '';
} catch (e) {
return true;
@@ -929,7 +929,7 @@ RequestPolicyService.prototype = {
* @param string newSpec
*/
_handleHttpsEverywhereUriRewrite : function(oldURI, newSpec) {
- oldURI = oldURI.QueryInterface(CI.nsIURI);
+ oldURI = oldURI.QueryInterface(Ci.nsIURI);
this._requestProcessor.mapDestinations(oldURI.spec, newSpec);
},
@@ -1056,7 +1056,7 @@ RequestPolicyService.prototype = {
this._shutdown();
break;
case "em-action-requested" :
- if ((subject instanceof CI.nsIUpdateItem)
+ if ((subject instanceof Ci.nsIUpdateItem)
&& subject.id == EXTENSION_ID) {
if (data == "item-uninstalled" || data == "item-disabled") {
this._uninstall = true;
@@ -1100,10 +1100,10 @@ RequestPolicyService.prototype = {
this.shouldLoad = this.mainContentPolicy.shouldLoad;
if (!this.mimeService) {
// this.rejectCode = typeof(/ /) == "object" ? -4 : -3;
- this.rejectCode = CI.nsIContentPolicy.REJECT_SERVER;
+ this.rejectCode = Ci.nsIContentPolicy.REJECT_SERVER;
this.mimeService =
CC['@mozilla.org/uriloader/external-helper-app-service;1']
- .getService(CI.nsIMIMEService);
+ .getService(Ci.nsIMIMEService);
}
},
diff --git a/src/content/lib/DomainUtil.jsm b/src/content/lib/DomainUtil.jsm
index c6d652e..ea8c2b9 100644
--- a/src/content/lib/DomainUtil.jsm
+++ b/src/content/lib/DomainUtil.jsm
@@ -30,7 +30,7 @@
var EXPORTED_SYMBOLS = ["DomainUtil"]
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
if (!rp) {
@@ -42,13 +42,13 @@ Components.utils.import("chrome://requestpolicy/content/lib/Logger.jsm", rp.mod)
var DomainUtil = {};
DomainUtil._ios = CC["@mozilla.org/network/io-service;1"]
- .getService(CI.nsIIOService);
+ .getService(Ci.nsIIOService);
DomainUtil._eTLDService = CC["@mozilla.org/network/effective-tld-service;1"]
- .getService(CI.nsIEffectiveTLDService);
+ .getService(Ci.nsIEffectiveTLDService);
DomainUtil._idnService = CC["@mozilla.org/network/idn-service;1"]
- .getService(CI.nsIIDNService);
+ .getService(Ci.nsIIDNService);
const STANDARDURL_CONTRACTID = "@mozilla.org/network/standard-url;1";
@@ -377,10 +377,10 @@ DomainUtil.formatIDNUri = function(uri) {
*/
DomainUtil.determineRedirectUri = function(originUri, destPath) {
var baseUri = this.getUriObject(originUri);
- var urlType = CI.nsIStandardURL.URLTYPE_AUTHORITY;
- var newUri = CC[STANDARDURL_CONTRACTID].createInstance(CI.nsIStandardURL);
+ var urlType = Ci.nsIStandardURL.URLTYPE_AUTHORITY;
+ var newUri = CC[STANDARDURL_CONTRACTID].createInstance(Ci.nsIStandardURL);
newUri.init(urlType, 0, destPath, null, baseUri);
- var resolvedUri = newUri.QueryInterface(CI.nsIURI);
+ var resolvedUri = newUri.QueryInterface(Ci.nsIURI);
return resolvedUri.spec;
}
diff --git a/src/content/lib/FileUtil.jsm b/src/content/lib/FileUtil.jsm
index d05ff62..af393cb 100644
--- a/src/content/lib/FileUtil.jsm
+++ b/src/content/lib/FileUtil.jsm
@@ -23,7 +23,7 @@
var EXPORTED_SYMBOLS = ["FileUtil"]
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
Components.utils.import("resource://gre/modules/Services.jsm");
@@ -40,9 +40,9 @@ var FileUtil = {
*/
fileToArray : function(file) {
var stream = CC["@mozilla.org/network/file-input-stream;1"]
- .createInstance(CI.nsIFileInputStream);
+ .createInstance(Ci.nsIFileInputStream);
stream.init(file, 0x01, 0444, 0);
- stream.QueryInterface(CI.nsILineInputStream);
+ stream.QueryInterface(Ci.nsILineInputStream);
var line = {}, lines = [], hasmore;
do {
hasmore = stream.readLine(line);
@@ -60,13 +60,13 @@ var FileUtil = {
*/
fileToString : function(file) {
var stream = CC["@mozilla.org/network/file-input-stream;1"]
- .createInstance(CI.nsIFileInputStream);
+ .createInstance(Ci.nsIFileInputStream);
// TODO: Handle NS_ERROR_FILE_NOT_FOUND
stream.init(file, 0x01, 0444, 0);
- stream.QueryInterface(CI.nsILineInputStream);
+ stream.QueryInterface(Ci.nsILineInputStream);
var cstream = CC["@mozilla.org/intl/converter-input-stream;1"].
- createInstance(CI.nsIConverterInputStream);
+ createInstance(Ci.nsIConverterInputStream);
cstream.init(stream, "UTF-8", 0, 0);
var str = "";
@@ -92,12 +92,12 @@ var FileUtil = {
*/
arrayToFile : function(lines, file) {
var stream = CC["@mozilla.org/network/file-output-stream;1"]
- .createInstance(CI.nsIFileOutputStream);
+ .createInstance(Ci.nsIFileOutputStream);
// write, create, append on write, truncate
stream.init(file, 0x02 | 0x08 | 0x10 | 0x20, -1, 0);
var cos = CC["@mozilla.org/intl/converter-output-stream;1"]
- .createInstance(CI.nsIConverterOutputStream);
+ .createInstance(Ci.nsIConverterOutputStream);
cos.init(stream, "UTF-8", 4096, 0x0000);
for (var i = 0; i < lines.length; i++) {
@@ -118,12 +118,12 @@ var FileUtil = {
*/
stringToFile : function(str, file) {
var stream = CC["@mozilla.org/network/file-output-stream;1"]
- .createInstance(CI.nsIFileOutputStream);
+ .createInstance(Ci.nsIFileOutputStream);
// write, create, append on write, truncate
stream.init(file, 0x02 | 0x08 | 0x10 | 0x20, -1, 0);
var cos = CC["@mozilla.org/intl/converter-output-stream;1"]
- .createInstance(CI.nsIConverterOutputStream);
+ .createInstance(Ci.nsIConverterOutputStream);
cos.init(stream, "UTF-8", 4096, 0x0000);
cos.writeString(str);
cos.close();
@@ -139,29 +139,29 @@ var FileUtil = {
* @return {nsIFile}
*/
getRPUserDir : function(subdir1, subdir2, subdir3) {
- var profileDir = Services.dirsvc.get("ProfD", CI.nsIFile);
+ var profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
var file = profileDir.clone();
file.appendRelativePath(REQUESTPOLICY_DIR);
if(!file.exists()) {
- file.create(CI.nsIFile.DIRECTORY_TYPE, 0700);
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, 0700);
}
if (subdir1) {
file.appendRelativePath(subdir1);
if(!file.exists()) {
- file.create(CI.nsIFile.DIRECTORY_TYPE, 0700);
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, 0700);
}
if (subdir2) {
file.appendRelativePath(subdir2);
if(!file.exists()) {
- file.create(CI.nsIFile.DIRECTORY_TYPE, 0700);
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, 0700);
}
if (subdir3) {
file.appendRelativePath(subdir3);
if(!file.exists()) {
- file.create(CI.nsIFile.DIRECTORY_TYPE, 0700);
+ file.create(Ci.nsIFile.DIRECTORY_TYPE, 0700);
}
}
}
diff --git a/src/content/lib/PolicyManager.jsm b/src/content/lib/PolicyManager.jsm
index ec0d267..84241f9 100644
--- a/src/content/lib/PolicyManager.jsm
+++ b/src/content/lib/PolicyManager.jsm
@@ -26,7 +26,7 @@ var EXPORTED_SYMBOLS = [
"RULES_CHANGED_TOPIC"
];
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
const RULES_CHANGED_TOPIC = "requestpolicy-rules-changed";
@@ -311,10 +311,10 @@ PolicyManager.prototype = {
},
_checkRequest : function(origin, dest, aRuleset, result) {
- if (!(origin instanceof CI.nsIURI)) {
+ if (!(origin instanceof Ci.nsIURI)) {
throw "Origin must be an nsIURI.";
}
- if (!(dest instanceof CI.nsIURI)) {
+ if (!(dest instanceof Ci.nsIURI)) {
throw "Destination must be an nsIURI.";
}
if (!result) {
diff --git a/src/content/lib/Request.jsm b/src/content/lib/Request.jsm
index 773947d..11aad8a 100644
--- a/src/content/lib/Request.jsm
+++ b/src/content/lib/Request.jsm
@@ -30,7 +30,7 @@ var EXPORTED_SYMBOLS = [
"REQUEST_TYPE_REDIRECT"
];
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
const REQUEST_TYPE_NORMAL = 1;
@@ -116,7 +116,7 @@ NormalRequest.prototype.detailsToString = function() {
return "type: " + this.aContentType +
", destination: " + this.destURI +
", origin: " + this.originURI +
- ", context: " + ((this.aContext) instanceof (CI.nsIDOMHTMLElement)
+ ", context: " + ((this.aContext) instanceof (Ci.nsIDOMHTMLElement)
? "<HTML Element>"
: this.aContext) +
", mime: " + this.aMimeTypeGuess +
@@ -192,7 +192,7 @@ NormalRequest.prototype.isInternal = function() {
// request. We'll only allow requests to .dtd files, though, so we don't
// open up all file:// destinations.
if (this.aContentLocation.scheme == "file" &&
- this.aContentType == CI.nsIContentPolicy.TYPE_DTD) {
+ this.aContentType == Ci.nsIContentPolicy.TYPE_DTD) {
return true;
}
@@ -210,14 +210,14 @@ NormalRequest.prototype.getWindow = function() {
let win;
try {
- win = context.QueryInterface(CI.nsIDOMWindow);
+ win = context.QueryInterface(Ci.nsIDOMWindow);
} catch (e) {
let doc;
try {
- doc = context.QueryInterface(CI.nsIDOMDocument);
+ doc = context.QueryInterface(Ci.nsIDOMDocument);
} catch (e) {
try {
- doc = context.QueryInterface(CI.nsIDOMNode).ownerDocument;
+ doc = context.QueryInterface(Ci.nsIDOMNode).ownerDocument;
} catch(e) {
return null;
}
diff --git a/src/content/lib/RequestProcessor.jsm b/src/content/lib/RequestProcessor.jsm
index 0e8a57a..7cbb35d 100644
--- a/src/content/lib/RequestProcessor.jsm
+++ b/src/content/lib/RequestProcessor.jsm
@@ -23,11 +23,11 @@
var EXPORTED_SYMBOLS = ["RequestProcessor"];
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
-const CP_OK = CI.nsIContentPolicy.ACCEPT;
-const CP_REJECT = CI.nsIContentPolicy.REJECT_SERVER;
+const CP_OK = Ci.nsIContentPolicy.ACCEPT;
+const CP_REJECT = Ci.nsIContentPolicy.REJECT_SERVER;
// A value intended to not conflict with aExtra passed to shouldLoad() by any
// other callers. Was chosen randomly.
@@ -177,9 +177,9 @@ RequestProcessor.prototype.process = function(request) {
if (originURI == "about:blank" && request.aContext) {
let domNode;
try {
- domNode = request.aContext.QueryInterface(CI.nsIDOMNode);
+ domNode = request.aContext.QueryInterface(Ci.nsIDOMNode);
} catch (e if e.result == Components.results.NS_ERROR_NO_INTERFACE) {}
- if (domNode && domNode.nodeType == CI.nsIDOMNode.DOCUMENT_NODE) {
+ if (domNode && domNode.nodeType == Ci.nsIDOMNode.DOCUMENT_NODE) {
var newOriginURI;
if (request.aContext.documentURI &&
request.aContext.documentURI != "about:blank") {
@@ -223,7 +223,7 @@ RequestProcessor.prototype.process = function(request) {
if (request.aContext) {
let domNode;
try {
- domNode = request.aContext.QueryInterface(CI.nsIDOMNode);
+ domNode = request.aContext.QueryInterface(Ci.nsIDOMNode);
} catch (e if e.result == Components.results.NS_ERROR_NO_INTERFACE) {}
if (domNode && domNode.nodeName == "LINK" &&
@@ -334,7 +334,7 @@ RequestProcessor.prototype.process = function(request) {
if (request.aContext) {
let domNode;
try {
- domNode = request.aContext.QueryInterface(CI.nsIDOMNode);
+ domNode = request.aContext.QueryInterface(Ci.nsIDOMNode);
} catch (e if e.result == Components.results.NS_ERROR_NO_INTERFACE) {}
if (domNode && domNode.nodeName == "xul:browser" &&
@@ -540,14 +540,14 @@ RequestProcessor.prototype._isContentRequest = function(channel) {
var callback = callbacks[i];
try {
// For Gecko 1.9.1
- return callback.getInterface(CI.nsILoadContext).isContent;
+ return callback.getInterface(Ci.nsILoadContext).isContent;
} catch (e) {
}
try {
// For Gecko 1.9.0
- var itemType = callback.getInterface(CI.nsIWebNavigation)
- .QueryInterface(CI.nsIDocShellTreeItem).itemType;
- return itemType == CI.nsIDocShellTreeItem.typeContent;
+ var itemType = callback.getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem).itemType;
+ return itemType == Ci.nsIDocShellTreeItem.typeContent;
} catch (e) {
}
}
@@ -572,7 +572,7 @@ RequestProcessor.prototype._examineHttpResponse = function(observedSubject) {
// TODO: Make user aware of blocked headers so they can allow them if
// desired.
- var httpChannel = observedSubject.QueryInterface(CI.nsIHttpChannel);
+ var httpChannel = observedSubject.QueryInterface(Ci.nsIHttpChannel);
var headerType;
var dest;
@@ -795,7 +795,7 @@ RequestProcessor.prototype.processRedirect = function(request, httpChannel) {
* which we currently can't stop.
*/
RequestProcessor.prototype._examineHttpRequest = function(observedSubject) {
- var httpChannel = observedSubject.QueryInterface(CI.nsIHttpChannel);
+ var httpChannel = observedSubject.QueryInterface(Ci.nsIHttpChannel);
try {
// Determine if prefetch requests are slipping through.
if (httpChannel.getRequestHeader("X-moz") == "prefetch") {
@@ -1081,7 +1081,7 @@ RequestProcessor.prototype.reject = function(reason, request) {
this._cacheShouldLoadResult(CP_REJECT, request.originURI, request.destURI);
this._recordRejectedRequest(request);
- if (CI.nsIContentPolicy.TYPE_DOCUMENT == request.aContentType) {
+ if (Ci.nsIContentPolicy.TYPE_DOCUMENT == request.aContentType) {
// This was a blocked top-level document request. This may be due to
// a blocked attempt by javascript to set the document location.
// TODO: pass requestResult?
diff --git a/src/content/lib/Util.jsm b/src/content/lib/Util.jsm
index 50d019f..9177204 100644
--- a/src/content/lib/Util.jsm
+++ b/src/content/lib/Util.jsm
@@ -23,16 +23,16 @@
var EXPORTED_SYMBOLS = ["Util"];
-const CI = Components.interfaces;
+const Ci = Components.interfaces;
const CC = Components.classes;
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}";
var Util = {
_versionComparator : CC["@mozilla.org/xpcom/version-comparator;1"]
- .getService(CI.nsIVersionComparator),
+ .getService(Ci.nsIVersionComparator),
- appInfo : CC["@mozilla.org/xre/app-info;1"].getService(CI.nsIXULAppInfo),
+ appInfo : CC["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo),
// These need to be set externally. Right now they're set from
// RequestPolicyService._initVersionInfo().
@@ -56,11 +56,11 @@ var Util = {
},
getChromeWindow : function(aContentWindow) {
- return aContentWindow.QueryInterface(CI.nsIInterfaceRequestor)
- .getInterface(CI.nsIWebNavigation)
- .QueryInterface(CI.nsIDocShellTreeItem)
+ return aContentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
.rootTreeItem
- .QueryInterface(CI.nsIInterfaceRequestor)
- .getInterface(CI.nsIDOMWindow);
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
}
}
--
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