[Pkg-mozext-commits] [requestpolicy] 166/280: [refact] pass startup/shutdown args as array
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:30:18 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 9b28dd9a8576e6cff142608b9ba8def0442e07cc
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Jan 20 16:30:18 2015 +0100
[refact] pass startup/shutdown args as array
---
src/bootstrap.js | 12 ++++--------
src/content/lib/environment.jsm | 6 ++----
src/content/main/environment-manager.jsm | 4 +---
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/src/bootstrap.js b/src/bootstrap.js
index f7d8533..23ea63b 100644
--- a/src/bootstrap.js
+++ b/src/bootstrap.js
@@ -38,24 +38,20 @@ function logSevereError(msg, e) {
Cu.reportError(e);
}
-function startup(data, reason) {
+function startup(...startupArgs) {
try {
// Import the EnvironmentManager and call its startup() function.
Cu.import(envManURI);
- EnvironmentManager.startup(data, reason);
+ EnvironmentManager.startup(startupArgs);
} catch(e) {
logSevereError("startup() failed!", e);
}
}
-function shutdown(data, reason) {
- if (reason == APP_SHUTDOWN) {
- return;
- }
-
+function shutdown(...shutdownArgs) {
try {
// shutdown, unset and unload.
- EnvironmentManager.shutdown(data, reason);
+ EnvironmentManager.shutdown(shutdownArgs);
EnvironmentManager = null;
Cu.unload(envManURI);
} catch(e) {
diff --git a/src/content/lib/environment.jsm b/src/content/lib/environment.jsm
index 537d192..4685330 100644
--- a/src/content/lib/environment.jsm
+++ b/src/content/lib/environment.jsm
@@ -249,9 +249,8 @@ Environment.prototype.addShutdownFunction = function(aLevel, f) {
- Environment.prototype.startup = function() {
+ Environment.prototype.startup = function(fnArgsToApply) {
let self = this;
- let fnArgsToApply = arguments;
if (self.envState == ENV_STATES.NOT_STARTED) {
//console.log('[RPC] starting up Environment "'+self.name+'"...');
@@ -266,9 +265,8 @@ Environment.prototype.addShutdownFunction = function(aLevel, f) {
}
};
- Environment.prototype.shutdown = function() {
+ Environment.prototype.shutdown = function(fnArgsToApply) {
let self = this;
- let fnArgsToApply = arguments;
if (self.envState === ENV_STATES.STARTUP_DONE) {
//console.log('[RPC] shutting down Environment "'+self.name+'"...');
diff --git a/src/content/main/environment-manager.jsm b/src/content/main/environment-manager.jsm
index 04cbd74..7e4cbe6 100644
--- a/src/content/main/environment-manager.jsm
+++ b/src/content/main/environment-manager.jsm
@@ -82,7 +82,7 @@ let EnvironmentManager = (function(self) {
.ProcessEnvironment.startup();
};
- self.shutdown = function(data, reason) {
+ self.shutdown = function(fnArgsToApply) {
// remove the comments in this function for debugging.
//console.debug("[RPC] EnvironmentManager ("+procString+") is going to " +
// "shut down all registered Environments...");
@@ -97,8 +97,6 @@ let EnvironmentManager = (function(self) {
let {Environment} = ScriptLoader.importModule("lib/environment");
let sequence = Environment.shutdownSequence;
- let fnArgsToApply = [data, reason];
-
// prepare shutdown
self.environments.forEach(function(env) {
env.envState = Environment.SHUTTING_DOWN;
--
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