[Pkg-mozext-commits] [greasemonkey] 20/62: Don't pass function references in messages.

David Prévot taffit at moszumanska.debian.org
Sun Sep 13 22:10:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository greasemonkey.

commit cf5c0a811a53f633d29ffec6c87a4b15ff0a62b4
Author: Anthony Lieuallen <arantius at gmail.com>
Date:   Wed Aug 19 10:09:26 2015 -0400

    Don't pass function references in messages.
    
    Fixes #2225
---
 modules/menucommand.js | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/menucommand.js b/modules/menucommand.js
index 92a5406..7622aaa 100644
--- a/modules/menucommand.js
+++ b/modules/menucommand.js
@@ -62,6 +62,7 @@ function MenuCommandSandbox(
   // 1) Internally to this function's private scope, maintain a set of
   // registered menu commands.
   var commands = {};
+  var commandFuncs = {};
   var commandCookie = 0;
   // 2) Respond to requests to list those registered commands.
   addEventListener(
@@ -79,11 +80,11 @@ function MenuCommandSandbox(
         if (aScriptUuid != detail.scriptUuid) return;
         // This event is for this script; stop propagating to other scripts.
         e.stopImmediatePropagation();
-        var command = commands[detail.cookie];
-        if (!command) {
+        var commandFunc = commandFuncs[detail.cookie];
+        if (!commandFunc) {
           throw new Error('Could not run requested menu command!');
         } else {
-          command.commandFunc.call();
+          commandFunc.call();
         }
       }, true);
   // 4) Export the "register a command" API function to the sandbox scope.
@@ -107,8 +108,8 @@ function MenuCommandSandbox(
       scriptName: aScriptName,
       scriptUuid: aScriptUuid,
       accessKey: accessKey,
-      commandFunc: commandFunc,
     };
     commands[command.cookie] = command;
+    commandFuncs[command.cookie] = commandFunc;
   };
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/greasemonkey.git



More information about the Pkg-mozext-commits mailing list