[Pkg-mozext-commits] [requestpolicy] 165/257: [ref] ScriptLoader: use `LOG_SCRIPTLOADER`

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 afcbaed2e30e8ef4198812a251d5ec0eca9d39fa
Author: Martin Kimmerle <dev at 256k.de>
Date:   Tue Dec 1 13:51:40 2015 +0100

    [ref] ScriptLoader: use `LOG_SCRIPTLOADER`
    
    use the `LOG_SCRIPTLOADER` preprocess variable
---
 src/content/lib/script-loader.jsm | 29 +++++++++++++++++++++++------
 1 file changed, 23 insertions(+), 6 deletions(-)

diff --git a/src/content/lib/script-loader.jsm b/src/content/lib/script-loader.jsm
index e8a978e..4725197 100644
--- a/src/content/lib/script-loader.jsm
+++ b/src/content/lib/script-loader.jsm
@@ -83,12 +83,14 @@ var ScriptLoader = (function() {
       for (let uri in importedModuleURIs) {
         if (importedModuleURIs.hasOwnProperty(uri) &&
             moduleUnloadExceptions.hasOwnProperty(uri) === false) {
-          //console.debug("[RPC] Unloading module "+uri);
+          // #ifdef LOG_SCRIPTLOADER
+          console.debug(`[RPC] [ScriptLoader] Cu.unload("${uri}");`);
+          // #endif
           try {
             Cu.unload(uri);
           } catch(e) {
-            console.error("[RPC] Failed to unload module "+uri);
-            Components.utils.reportError(e);
+            console.error(`[RPC] [ScriptLoader] failed to unload "${uri}"`);
+            Cu.reportError(e);
           }
           delete importedModuleURIs[uri];
         }
@@ -119,16 +121,20 @@ var ScriptLoader = (function() {
         return scope;
       }
 
-      //console.debug("[RPC] `importModule` called for "+moduleID);
+      // #ifdef LOG_SCRIPTLOADER
+      console.debug(`[RPC] [ScriptLoader] importModule("${moduleID}") called.`);
+      // #endif
 
       let uri = getModuleURI(moduleID);
       try {
         if (!(uri in importedModuleURIs)) {
           // the module hasn't been imported yet
           modulesCurrentlyBeingImported[moduleID] = true;
-          //console.debug("[RPC] importing " + moduleID);
         }
 
+        // #ifdef LOG_SCRIPTLOADER
+        console.debug(`[RPC] [ScriptLoader] Cu.import("${uri}");`);
+        // #endif
         Cu.import(uri, scope);
         importedModuleURIs[uri] = true;
 
@@ -176,11 +182,22 @@ var ScriptLoader = (function() {
     defineLazyModuleGetter: function(moduleID, names, scope) {
       scope = scope || {};
 
-      //console.debug("[RPC] defining lazy module getter(s) for " + moduleID);
+      // #ifdef LOG_SCRIPTLOADER
+      console.debug("[RPC] [ScriptLoader] " +
+          `defineLazyModuleGetter("${moduleID}") called.`);
+      // #endif
       let uri = getModuleURI(moduleID);
       for (let i in names) {
         let name = names[i];
+        // #ifndef LOG_SCRIPTLOADER
         XPCOMUtils.defineLazyModuleGetter(scope, name, uri);
+        // #else
+        /* jshint -W083 */ // "don't make functions within a loop"
+        XPCOMUtils.defineLazyModuleGetter(scope, name, uri, null, function() {
+          console.debug(`[RPC] [ScriptLoader] lazily imported "${name}"`);
+        });
+        /* jshint +W083 */
+        // #endif
       }
       importedModuleURIs[uri] = true;
 

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