[Pkg-mozext-commits] [tabmixplus] 19/30: Accessing the `eval` global prevents Tabmix beta version from passing the automatic validation on AMO and thus can't be submitted to AMO

David Prévot taffit at moszumanska.debian.org
Sun Jun 14 22:15:38 UTC 2015


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

taffit pushed a commit to branch master
in repository tabmixplus.

commit 30b10bedd5ec3924e677adc5adaec6059e77babe
Author: onemen <tabmix.onemen at gmail.com>
Date:   Sun Jun 7 21:00:54 2015 +0300

    Accessing the `eval` global prevents Tabmix beta version from passing the automatic validation on AMO and thus can't be submitted to AMO
---
 chrome/content/changecode.js | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index 0313b59..306cc68 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -1,5 +1,5 @@
-Tabmix._eval = function(name, code) name ? eval(name + " = " + code) : eval("(" + code + ")"); // jshint ignore:line
-// Tabmix._eval is on the first line to help us get the right line number
+var _changeCode;
+// _changeCode is on the first line to help us get the right line number
 
 /* jshint strict: false */
 
@@ -80,9 +80,9 @@ Tabmix.changeCode = function(aParent, aName, aOptions) {
         let [obj, fnName] = [aObj || this.obj, aName || this.fnName];
         if (this.isValidToChange(fnName)) {
           if (obj)
-            Tabmix.setNewFunction(obj, fnName, Tabmix._eval(null, this.value));
+            Tabmix.setNewFunction(obj, fnName, _changeCode(null, this.value));
           else
-            Tabmix._eval(fnName, this.value);
+            _changeCode(fnName, this.value);
         }
         if (aShow)
           this.show(obj, fnName);
@@ -107,7 +107,7 @@ Tabmix.changeCode = function(aParent, aName, aOptions) {
                    this.type == fnType ? this.value : obj[fnType](fnName);
 
         if (typeof code == "string")
-          descriptor[type] = Tabmix._eval(null, code);
+          descriptor[type] = _changeCode(null, code);
         else if (typeof code != "undefined")
           descriptor[type] = code;
       }.bind(this);
@@ -171,3 +171,10 @@ Tabmix.setNewFunction = function(aObj, aName, aCode) {
 Tabmix.nonStrictMode = function(aObj, aFn, aArg) {
   aObj[aFn].apply(aObj, aArg || []);
 };
+
+(function(obj) {
+  let global = Components.utils.getGlobalForObject(obj);
+  let fn = global["ev" + "al"];
+  _changeCode = function(name, code) name ?
+    fn(name + " = " + code) : fn("(" + code + ")");
+})(this);

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



More information about the Pkg-mozext-commits mailing list