[Pkg-mozext-commits] [requestpolicy] 182/257: [ref] JSCS: run `jscs --fix 'src/'` (again)

David Prévot taffit at moszumanska.debian.org
Thu Jan 28 03:20:11 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 9d9d77417c72037728e903235a0b0699ede2bc00
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Dec 1 19:52:58 2015 +0100

    [ref] JSCS: run `jscs --fix 'src/'` (again)
---
 src/content/lib/http-response.jsm     |  16 ++--
 src/content/lib/request-processor.jsm | 169 ++++++++++++++--------------------
 src/content/main/about-uri.jsm        |  12 +--
 src/content/main/content-policy.jsm   |   5 +-
 4 files changed, 83 insertions(+), 119 deletions(-)

diff --git a/src/content/lib/http-response.jsm b/src/content/lib/http-response.jsm
index 0c43ae4..38c5717 100644
--- a/src/content/lib/http-response.jsm
+++ b/src/content/lib/http-response.jsm
@@ -58,7 +58,7 @@ HttpResponse.prototype.removeResponseHeader = function() {
  * @return {String|undefined} The header's value, or `undefined`
  *     if the header does not exist.
  */
-HttpResponse.prototype._getResponseHeader = function (aHeaderName) {
+HttpResponse.prototype._getResponseHeader = function(aHeaderName) {
   try {
     return this.httpChannel.getResponseHeader(aHeaderName);
   } catch (e) {
@@ -73,7 +73,7 @@ HttpResponse.prototype._getResponseHeader = function (aHeaderName) {
 /**
  * Determine `headerType` and `headerValue`.
  */
-HttpResponse.prototype._determineRedirectionHeader = function () {
+HttpResponse.prototype._determineRedirectionHeader = function() {
   if (this.hasOwnProperty("hasRedirectionHeader")) {
     // Determine only once.
     return;
@@ -97,7 +97,7 @@ HttpResponse.prototype._determineRedirectionHeader = function () {
 };
 
 Object.defineProperty(HttpResponse.prototype, "rawDestString", {
-  get: function () {
+  get: function() {
     if (!this.hasOwnProperty("_rawDestString")) {
       switch (this.redirHeaderType) {
         case "Location":
@@ -133,7 +133,7 @@ Object.defineProperty(HttpResponse.prototype, "rawDestString", {
 });
 
 Object.defineProperty(HttpResponse.prototype, "destURI", {
-  get: function () {
+  get: function() {
     if (!this.hasOwnProperty("_destURI")) {
       this._destURI = Services.io.newURI(this.rawDestString, null,
                                          this.originURI);
@@ -143,7 +143,7 @@ Object.defineProperty(HttpResponse.prototype, "destURI", {
 });
 
 Object.defineProperty(HttpResponse.prototype, "originURI", {
-  get: function () {
+  get: function() {
     if (!this.hasOwnProperty("_originURI")) {
       this._originURI = Services.io.newURI(this.httpChannel.name, null, null);
     }
@@ -152,7 +152,7 @@ Object.defineProperty(HttpResponse.prototype, "originURI", {
 });
 
 Object.defineProperty(HttpResponse.prototype, "loadContext", {
-  get: function () {
+  get: function() {
     if (!this.hasOwnProperty("_loadContext")) {
       // more info on the load context:
       // https://developer.mozilla.org/en-US/Firefox/Releases/3.5/Updating_extensions
@@ -188,7 +188,7 @@ Object.defineProperty(HttpResponse.prototype, "loadContext", {
  * @return {?nsIDOMXULElement}
  */
 Object.defineProperty(HttpResponse.prototype, "browser", {
-  get: function () {
+  get: function() {
     if (!this.hasOwnProperty("_browser")) {
       let loadContext = this.loadContext;
 
@@ -222,7 +222,7 @@ Object.defineProperty(HttpResponse.prototype, "browser", {
  * @return {?nsIDocShell}
  */
 Object.defineProperty(HttpResponse.prototype, "docShell", {
-  get: function () {
+  get: function() {
     if (!this.hasOwnProperty("_docShell")) {
       try {
         this._docShell = this.httpChannel.notificationCallbacks.
diff --git a/src/content/lib/request-processor.jsm b/src/content/lib/request-processor.jsm
index fdb499f..26a8551 100644
--- a/src/content/lib/request-processor.jsm
+++ b/src/content/lib/request-processor.jsm
@@ -72,11 +72,14 @@ const CP_MAPPEDDESTINATION = 0x178c40bf;
 // RequestProcessor
 //==============================================================================
 
-var RequestProcessor = (function () {
+var RequestProcessor = (function() {
   let self = {};
 
   let internal = Utils.moduleInternal(self);
 
+  //----------------------------------------------------------------------------
+  // private properties
+  //----------------------------------------------------------------------------
 
   /**
    * Number of elapsed milliseconds from the time of the last shouldLoad() call
@@ -94,10 +97,10 @@ var RequestProcessor = (function () {
    * @type {Object}
    */
   let lastShouldLoadCheck = {
-    "origin" : null,
-    "destination" : null,
-    "time" : 0,
-    "result" : null
+    "origin": null,
+    "destination": null,
+    "time": 0,
+    "result": null
   };
 
   let historyRequests = {};
@@ -114,14 +117,9 @@ var RequestProcessor = (function () {
 
   internal.requestObservers = [];
 
-
-
-
-
-
-
-
-
+  //----------------------------------------------------------------------------
+  // private functions
+  //----------------------------------------------------------------------------
 
   function notifyRequestObserversOfBlockedRequest(request) {
     for (var i = 0; i < internal.requestObservers.length; i++) {
@@ -144,12 +142,6 @@ var RequestProcessor = (function () {
     }
   }
 
-
-
-
-
-
-
   // We always call this from shouldLoad to reject a request.
   function reject(reason, request) {
     Logger.warning(Logger.TYPE_CONTENT, "** BLOCKED ** reason: " + reason +
@@ -306,8 +298,6 @@ var RequestProcessor = (function () {
     return false;
   }
 
-
-
   function _getRequestsHelper(currentlySelectedOrigin, allRequestsOnDocument,
       isAllowed) {
     var result = new RequestSet();
@@ -348,50 +338,50 @@ var RequestProcessor = (function () {
     return result;
   }
 
-//  function _getOtherOriginsHelperFromDOM(document, reqSet) {
-//    var documentUri = DomainUtil
-//        .stripFragment(document.documentURI);
-//    Logger.dump("Looking for other origins within DOM of "
-//        + documentUri);
-//    // TODO: Check other elements besides iframes and frames?
-//    var frameTagTypes = {
-//      "iframe" : null,
-//      "frame" : null
-//    };
-//    for (var tagType in frameTagTypes) {
-//      var iframes = document.getElementsByTagName(tagType);
-//      for (var i = 0; i < iframes.length; i++) {
-//        var child = iframes[i];
-//        var childDocument = child.contentDocument;
-//        // Flock's special home page is about:myworld. It has (i)frames in it
-//        // that have no contentDocument. It's probably related to the fact that
-//        // that is an xul page, but I have no reason to fully understand the
-//        // problem in order to fix it.
-//        if (!childDocument) {
-//          continue;
-//        }
-//        var childUri = DomainUtil
-//            .stripFragment(childDocument.documentURI);
-//        if (childUri == "about:blank") {
-//          // iframe empty or not loaded yet, or maybe blocked.
-//          // childUri = child.src;
-//          // If it's not loaded or blocked, it's not the origin for anything
-//          // yet.
-//          continue;
-//        }
-//        Logger.dump("Found DOM child " + tagType
-//            + " with src <" + childUri + "> in document <" + documentUri + ">");
-//        //var childUriIdent = DomainUtil.getIdentifier(childUri,
-//        //    DomainUtil.LEVEL_SOP);
-//        // if (!origins[childUriIdent]) {
-//        //   origins[childUriIdent] = {};
-//        // }
-//        // origins[childUriIdent][childUri] = true;
-//        reqSet.addRequest(documentUri, childUri);
-//        _getOtherOriginsHelperFromDOM(childDocument, reqSet);
-//      }
-//    }
-//  },
+  // function _getOtherOriginsHelperFromDOM(document, reqSet) {
+  //   var documentUri = DomainUtil
+  //       .stripFragment(document.documentURI);
+  //   Logger.dump("Looking for other origins within DOM of "
+  //       + documentUri);
+  //   // TODO: Check other elements besides iframes and frames?
+  //   var frameTagTypes = {
+  //     "iframe" : null,
+  //     "frame" : null
+  //   };
+  //   for (var tagType in frameTagTypes) {
+  //     var iframes = document.getElementsByTagName(tagType);
+  //     for (var i = 0; i < iframes.length; i++) {
+  //       var child = iframes[i];
+  //       var childDocument = child.contentDocument;
+  //       // Flock's special home page is about:myworld. It has (i)frames in it
+  //       // that have no contentDocument. It's probably related to the fact that
+  //       // that is an xul page, but I have no reason to fully understand the
+  //       // problem in order to fix it.
+  //       if (!childDocument) {
+  //         continue;
+  //       }
+  //       var childUri = DomainUtil
+  //           .stripFragment(childDocument.documentURI);
+  //       if (childUri == "about:blank") {
+  //         // iframe empty or not loaded yet, or maybe blocked.
+  //         // childUri = child.src;
+  //         // If it's not loaded or blocked, it's not the origin for anything
+  //         // yet.
+  //         continue;
+  //       }
+  //       Logger.dump("Found DOM child " + tagType
+  //           + " with src <" + childUri + "> in document <" + documentUri + ">");
+  //       //var childUriIdent = DomainUtil.getIdentifier(childUri,
+  //       //    DomainUtil.LEVEL_SOP);
+  //       // if (!origins[childUriIdent]) {
+  //       //   origins[childUriIdent] = {};
+  //       // }
+  //       // origins[childUriIdent][childUri] = true;
+  //       reqSet.addRequest(documentUri, childUri);
+  //       _getOtherOriginsHelperFromDOM(childDocument, reqSet);
+  //     }
+  //   }
+  // },
 
   function _addRecursivelyAllRequestsFromURI(originURI, reqSet,
       checkedOrigins) {
@@ -444,23 +434,17 @@ var RequestProcessor = (function () {
     }
   }
 
+  //----------------------------------------------------------------------------
+  // public properties
+  //----------------------------------------------------------------------------
 
-
-
-
-
-
-
-
-
-
-
-
-    // TODO: make them private
+  // TODO: make them private
   self._rejectedRequests = new RequestSet();
   self._allowedRequests = new RequestSet();
 
-
+  //----------------------------------------------------------------------------
+  // public functions
+  //----------------------------------------------------------------------------
 
   /**
    * Process a NormalRequest.
@@ -578,7 +562,6 @@ var RequestProcessor = (function () {
         }
       }
 
-
       if (isDuplicateRequest(request)) {
         return lastShouldLoadCheck.result;
       }
@@ -597,8 +580,6 @@ var RequestProcessor = (function () {
         return CP_OK;
       }
 
-
-
       if (request.aContext) {
         let domNode;
         try {
@@ -615,8 +596,6 @@ var RequestProcessor = (function () {
         }
       }
 
-
-
       // Note: If changing the logic here, also make necessary changes to
       // isAllowedRedirect).
 
@@ -755,11 +734,11 @@ var RequestProcessor = (function () {
       request.requestResult = PolicyManager.checkRequestAgainstUserRules(
           request.aRequestOrigin, request.aContentLocation);
       for (let matchedDenyRule of request.requestResult.matchedDenyRules) {
-        Logger.dump('Matched deny rules');
+        Logger.dump("Matched deny rules");
         Logger.vardump(matchedDenyRule);
       }
       for (let matchedAllowRule of request.requestResult.matchedAllowRules) {
-        Logger.dump('Matched allow rules');
+        Logger.dump("Matched allow rules");
         Logger.vardump(matchedAllowRule);
       }
       // If there are both allow and deny rules, then fall back on the default
@@ -799,11 +778,11 @@ var RequestProcessor = (function () {
           .checkRequestAgainstSubscriptionRules(request.aRequestOrigin,
               request.aContentLocation);
       for (let matchedDenyRule of request.requestResult.matchedDenyRules) {
-        Logger.dump('Matched deny rules');
+        Logger.dump("Matched deny rules");
         Logger.vardump(matchedDenyRule);
       }
       for (let matchedAllowRule of request.requestResult.matchedAllowRules) {
-        Logger.dump('Matched allow rules');
+        Logger.dump("Matched allow rules");
         Logger.vardump(matchedAllowRule);
       }
       if (request.requestResult.allowRulesExist() &&
@@ -877,7 +856,6 @@ var RequestProcessor = (function () {
             reject("Denied by default policy", request);
       }
 
-
     } catch (e) {
       Logger.severe(Logger.TYPE_ERROR,
           "Fatal Error, " + e + ", stack was: " + e.stack);
@@ -891,10 +869,6 @@ var RequestProcessor = (function () {
   //   request.shouldLoadResult = result;
   // };
 
-
-
-
-
   /**
    * Called as a http request is made. The channel is available to allow you to
    * modify headers and such.
@@ -920,11 +894,6 @@ var RequestProcessor = (function () {
   ProcessEnvironment.obMan.observe(["http-on-modify-request"],
                                    examineHttpRequest);
 
-
-
-
-
-
   self.registerHistoryRequest = function(destinationUrl) {
     destinationUrl = DomainUtil.ensureUriHasPath(
         DomainUtil.stripFragment(destinationUrl));
@@ -1051,8 +1020,6 @@ var RequestProcessor = (function () {
         "Could not find observer to remove " + "in removeRequestObserver()");
   };
 
-
-
   self.getDeniedRequests = function(currentlySelectedOrigin, allRequestsOnDocument) {
     Logger.dump("## getDeniedRequests");
     return _getRequestsHelper(currentlySelectedOrigin, allRequestsOnDocument,
@@ -1106,14 +1073,14 @@ var RequestProcessor = (function () {
   return self;
 }());
 
-RequestProcessor = (function () {
+RequestProcessor = (function() {
   let scope = {RequestProcessor};
   Services.scriptloader.loadSubScript(
       "chrome://rpcontinued/content/lib/request-processor.redirects.js", scope);
   return scope.RequestProcessor;
 }());
 
-RequestProcessor = (function () {
+RequestProcessor = (function() {
   let scope = {RequestProcessor};
   Services.scriptloader.loadSubScript(
       "chrome://rpcontinued/content/lib/request-processor.compat.js", scope);
diff --git a/src/content/main/about-uri.jsm b/src/content/main/about-uri.jsm
index 39792ab..ffd5e4d 100644
--- a/src/content/main/about-uri.jsm
+++ b/src/content/main/about-uri.jsm
@@ -53,7 +53,7 @@ function getURI(aURI) {
   let id;
   let index = aURI.path.indexOf("?");
   if (index >= 0 && aURI.path.length > index) {
-    id = aURI.path.substr(index+1);
+    id = aURI.path.substr(index + 1);
   }
   if (!id || !(id in FILENAMES)) {
     id = "basicprefs";
@@ -68,17 +68,16 @@ function getURI(aURI) {
 var AboutRequestPolicy = (function() {
   let self = {};
 
-
   self.classDescription = "about:requestpolicy";
   self.contractID = "@mozilla.org/network/protocol/about;1?what=requestpolicy";
   self.classID = Components.ID("{77d4be21-6a28-4b91-9886-15ccd83795e8}");
   self.QueryInterface = XPCOMUtils.generateQI([Ci.nsIAboutModule]);
 
-  self.getURIFlags = function (aURI) {
+  self.getURIFlags = function(aURI) {
     return Ci.nsIAboutModule.ALLOW_SCRIPT;
   };
 
-  self.newChannel = function (aURI) {
+  self.newChannel = function(aURI) {
     let uri = getURI(aURI);
     let channel = Services.io.newChannel(uri, null, null);
     channel.originalURI = aURI;
@@ -89,14 +88,13 @@ var AboutRequestPolicy = (function() {
   // nsIFactory interface implementation
   //----------------------------------------------------------------------------
 
-  self.createInstance = function (outer, iid) {
+  self.createInstance = function(outer, iid) {
     if (outer) {
       throw Cr.NS_ERROR_NO_AGGREGATION;
     }
     return self.QueryInterface(iid);
   };
 
-
   function registerFactory() {
     Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
         .registerFactory(self.classID, self.classDescription,
@@ -105,7 +103,7 @@ var AboutRequestPolicy = (function() {
 
   ProcessEnvironment.addStartupFunction(
       Environment.LEVELS.INTERFACE,
-      function () {
+      function() {
         try {
           registerFactory();
         } catch (e) {
diff --git a/src/content/main/content-policy.jsm b/src/content/main/content-policy.jsm
index 15942d3..6f02a1b 100644
--- a/src/content/main/content-policy.jsm
+++ b/src/content/main/content-policy.jsm
@@ -70,14 +70,14 @@ var PolicyImplementation = (function() {
       // self.rejectCode = typeof(/ /) == "object" ? -4 : -3;
       self.rejectCode = Ci.nsIContentPolicy.REJECT_SERVER;
       self.mimeService =
-          Cc['@mozilla.org/uriloader/external-helper-app-service;1']
+          Cc["@mozilla.org/uriloader/external-helper-app-service;1"]
           .getService(Ci.nsIMIMEService);
     }
   }
 
   ProcessEnvironment.addStartupFunction(
       Environment.LEVELS.INTERFACE,
-      function () {
+      function() {
         try {
           register();
         } catch (e) {
@@ -90,7 +90,6 @@ var PolicyImplementation = (function() {
         }
       });
 
-
   function unregister() {
     Logger.dump("shutting down PolicyImplementation...");
 

-- 
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