[Pkg-mozext-commits] [requestpolicy] 168/257: [tst][ref] helper addon: change file structure
David Prévot
taffit at moszumanska.debian.org
Thu Jan 28 03:20:09 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 6bd10fda6e0a4ba6dfd65d7f35614ae539266eea
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Dec 1 14:31:13 2015 +0100
[tst][ref] helper addon: change file structure
---
.../dev-helper/content/console-observer.jsm | 26 ++++--
.../content/restart-detection-helper.jsm | 2 +-
tests/helper-addons/dev-helper/content/rpc-uri.jsm | 101 +++++++++++----------
3 files changed, 70 insertions(+), 59 deletions(-)
diff --git a/tests/helper-addons/dev-helper/content/console-observer.jsm b/tests/helper-addons/dev-helper/content/console-observer.jsm
index a5a2889..48c8af7 100644
--- a/tests/helper-addons/dev-helper/content/console-observer.jsm
+++ b/tests/helper-addons/dev-helper/content/console-observer.jsm
@@ -20,13 +20,15 @@
* ***** END LICENSE BLOCK *****
*/
-let EXPORTED_SYMBOLS = ["ConsoleObserver"];
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-const Cu = Components.utils;
+this.EXPORTED_SYMBOLS = ["ConsoleObserver"];
-Cu.import("resource://gre/modules/Services.jsm");
+let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+
+//==============================================================================
+// utilities
+//==============================================================================
var regEx = /(Error|Warning|Exception)/i;
@@ -48,7 +50,7 @@ const knownBugs = [
// issue #597
`[JavaScript Error: "TypeError: sub is undefined" {file: "chrome://rpcontinued/content/lib/subscription.jsm"`
];
-
+
function isKnownBug(aMessage) {
for (bugMsg of knownBugs) {
if (aMessage.startsWith(bugMsg)) {
@@ -58,19 +60,25 @@ function isKnownBug(aMessage) {
return false;
}
+//==============================================================================
+// ConsoleObserver
+//==============================================================================
+
/**
* ConsoleObserver observes all messages sent to the
* Browser Console and detects errors caused by
* RequestPolicy.
*/
-var ConsoleObserver = (function (self) {
+var ConsoleObserver = (function () {
+ let self = {};
+
let numErrors = 0;
let messages = [];
self.getNumErrors = function () {
return numErrors;
};
-
+
self.getMessages = function () {
return messages;
};
@@ -100,4 +108,4 @@ var ConsoleObserver = (function (self) {
};
return self;
-}({}));
+}());
diff --git a/tests/helper-addons/dev-helper/content/restart-detection-helper.jsm b/tests/helper-addons/dev-helper/content/restart-detection-helper.jsm
index b1c91df..c23a696 100644
--- a/tests/helper-addons/dev-helper/content/restart-detection-helper.jsm
+++ b/tests/helper-addons/dev-helper/content/restart-detection-helper.jsm
@@ -20,7 +20,7 @@
* ***** END LICENSE BLOCK *****
*/
-let EXPORTED_SYMBOLS = ["RestartDetectionHelper"];
+this.EXPORTED_SYMBOLS = ["RestartDetectionHelper"];
RestartDetectionHelper = {
mark: null
diff --git a/tests/helper-addons/dev-helper/content/rpc-uri.jsm b/tests/helper-addons/dev-helper/content/rpc-uri.jsm
index 8596eb0..5ea305a 100644
--- a/tests/helper-addons/dev-helper/content/rpc-uri.jsm
+++ b/tests/helper-addons/dev-helper/content/rpc-uri.jsm
@@ -20,61 +20,64 @@
* ***** END LICENSE BLOCK *****
*/
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-const Cu = Components.utils;
+/* global Components */
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-var EXPORTED_SYMBOLS = ["CustomUri"];
+/* exported CustomUri */
+this.EXPORTED_SYMBOLS = ["CustomUri"];
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const destinationURI = "http://www.maindomain.test/destination.html";
+let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+let {XPCOMUtils} = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {});
+//==============================================================================
+// CustomUri
+//==============================================================================
var CustomUri = (function () {
- var self = {
- classDescription: "RPC Protocol",
- contractID: "@mozilla.org/network/protocol;1?name=rpc",
- classID: Components.ID("{2d668f50-d8af-11e4-8830-0800200c9a66}"),
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]),
-
- scheme: "rpc",
- protocolFlags: Ci.nsIProtocolHandler.URI_NORELATIVE |
- Ci.nsIProtocolHandler.URI_NOAUTH |
- Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE,
-
-
- newURI: function (aSpec, aOriginCharset, aBaseURI) {
- var uri = Cc["@mozilla.org/network/simple-uri;1"]
- .createInstance(Ci.nsIURI);
- uri.spec = aSpec;
- return uri;
- },
-
- newChannel: function (aURI) {
- var path = aURI.path;
- var uri = Services.io.newURI(destinationURI + "?" + path, null, null);
- var channel = Services.io.newChannelFromURI(uri, null)
- .QueryInterface(Ci.nsIHttpChannel);
- return channel;
- },
-
- //
- // nsIFactory interface implementation
- //
-
- createInstance: function (outer, iid) {
- if (outer) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
- }
- return self.QueryInterface(iid);
- },
-
- startup: registerFactory,
- shutdown: unregisterFactory
+ let self = {};
+
+ const DESTINATION_URI = "http://www.maindomain.test/destination.html";
+
+ self.classDescription = "RPC Protocol";
+ self.contractID = "@mozilla.org/network/protocol;1?name=rpc";
+ self.classID = Components.ID("{2d668f50-d8af-11e4-8830-0800200c9a66}");
+ self.QueryInterface = XPCOMUtils.generateQI([Ci.nsIProtocolHandler]);
+
+ self.scheme = "rpc";
+ self.protocolFlags = Ci.nsIProtocolHandler.URI_NORELATIVE |
+ Ci.nsIProtocolHandler.URI_NOAUTH |
+ Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE;
+
+
+ self.newURI = function (aSpec, aOriginCharset, aBaseURI) {
+ var uri = Cc["@mozilla.org/network/simple-uri;1"]
+ .createInstance(Ci.nsIURI);
+ uri.spec = aSpec;
+ return uri;
};
+ self.newChannel = function (aURI) {
+ var path = aURI.path;
+ var uri = Services.io.newURI(DESTINATION_URI + "?" + path, null, null);
+ var channel = Services.io.newChannelFromURI(uri, null)
+ .QueryInterface(Ci.nsIHttpChannel);
+ return channel;
+ };
+
+ //----------------------------------------------------------------------------
+ // nsIFactory interface implementation
+ //----------------------------------------------------------------------------
+
+ self.createInstance = function (outer, iid) {
+ if (outer) {
+ throw Cr.NS_ERROR_NO_AGGREGATION;
+ }
+ return self.QueryInterface(iid);
+ };
+
+ self.startup = registerFactory;
+ self.shutdown = unregisterFactory;
+
function registerFactory() {
Components.manager.QueryInterface(Ci.nsIComponentRegistrar)
@@ -88,4 +91,4 @@ var CustomUri = (function () {
}
return self;
-})();
+}());
--
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