[Pkg-mozext-commits] [greasemonkey] 40/55: The "use strict", minor performance enhancements (the "for" statement), fix typo / style cleanup

David Prévot taffit at moszumanska.debian.org
Thu Oct 29 15:38:06 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 83ddd7236764539e2ee2c5d427cefad9882a9dc6
Author: janekptacijarabaci <janekptacijarabaci at seznam.cz>
Date:   Sun Sep 27 20:38:06 2015 +0200

    The "use strict", minor performance enhancements (the "for" statement), fix typo / style cleanup
---
 content/menucommander.js |  2 +-
 content/scriptprefs.js   |  6 +++---
 modules/ipcscript.js     |  6 +++++-
 modules/script.js        | 24 +++++++++++++++++++++---
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/content/menucommander.js b/content/menucommander.js
index 5892eaa..c7a91f2 100644
--- a/content/menucommander.js
+++ b/content/menucommander.js
@@ -43,7 +43,7 @@ GM_MenuCommander.createMenuItem = function(command) {
 GM_MenuCommander.messageMenuCommandResponse = function(aMessage) {
   if (aMessage.data.cookie != GM_MenuCommander.cookieShowing) return;
 
-  for (i in aMessage.data.commands) {
+  for (var i in aMessage.data.commands) {
     var command = aMessage.data.commands[i];
     var menuItem = GM_MenuCommander.createMenuItem(command);
     GM_MenuCommander.popup.appendChild(menuItem);
diff --git a/content/scriptprefs.js b/content/scriptprefs.js
index 1777f43..3acd3fb 100644
--- a/content/scriptprefs.js
+++ b/content/scriptprefs.js
@@ -57,11 +57,11 @@ window.addEventListener('load', function() {
 }, false);
 
 function onDialogAccept() {
-  gScript.includes = gScriptIncludesEl.pages;
+  // gScript.includes = gScriptIncludesEl.pages;
   gScript.userIncludes = gUserIncludesEl.pages;
-  gScript.matches = gScriptMatchesEl.pages;
+  // gScript.matches = gScriptMatchesEl.pages;
   gScript.userMatches = gUserMatchesEl.pages;
-  gScript.excludes = gScriptExcludesEl.pages;
+  // gScript.excludes = gScriptExcludesEl.pages;
   gScript.userExcludes = gUserExcludesEl.pages;
   GM_util.getService().config._changed(gScript, "cludes");
 }
diff --git a/modules/ipcscript.js b/modules/ipcscript.js
index f21fead..36604b5 100644
--- a/modules/ipcscript.js
+++ b/modules/ipcscript.js
@@ -124,7 +124,11 @@ function updateData(data) {
   var newScripts = data.scripts.map(objectToScript);
   Object.freeze(newScripts);
   scripts = newScripts;
-  IPCScript.prototype.globalExcludes = data.globalExcludes;
+  Object.defineProperty(IPCScript.prototype, "globalExcludes", {
+    get: function () { return data.globalExcludes; },
+    configurable: true,
+    enumerable: true
+  });
 }
 
 
diff --git a/modules/script.js b/modules/script.js
index 03329e8..a28ac9f 100644
--- a/modules/script.js
+++ b/modules/script.js
@@ -217,16 +217,16 @@ Script.prototype.__defineGetter__('userMatches',
 function Script_getUserMatches() { return this._userMatches.concat(); });
 Script.prototype.__defineSetter__('userMatches',
 function Script_setUserMatches(matches) {
-  var matches_MatchPattern = new Array();
+  var matches_MatchPattern = [];
 
-  for (var i = 0; i < matches.length; i++) {
+  for (var i = 0, count = matches.length; i < count; i++) {
     var match = matches[i];
     try {
       var match_MatchPattern = new MatchPattern(match);
       matches_MatchPattern.push(match_MatchPattern);
     } catch (e) {
       GM_util.logError(stringBundle.GetStringFromName('parse.ignoring-match')
-                          .replace('%1', match).replace('%2', e));
+          .replace('%1', match).replace('%2', e));
     }
   }
   matches = matches_MatchPattern;
@@ -241,6 +241,24 @@ function Script_setUserExcludes(excludes) { this._userExcludes = excludes.concat
 
 Script.prototype.__defineGetter__('matches',
 function Script_getMatches() { return this._matches.concat(); });
+Script.prototype.__defineSetter__('matches',
+function Script_setMatches(matches) {
+  var matches_MatchPattern = [];
+
+  for (var i = 0, count = matches.length; i < count; i++) {
+    var match = matches[i];
+    try {
+      var match_MatchPattern = new MatchPattern(match);
+      matches_MatchPattern.push(match_MatchPattern);
+    } catch (e) {
+      GM_util.logError(stringBundle.GetStringFromName('parse.ignoring-match')
+          .replace('%1', match).replace('%2', e));
+    }
+  }
+  matches = matches_MatchPattern;
+
+  this._matches = matches.concat();
+});
 
 Script.prototype.__defineGetter__('requires',
 function Script_getRequires() { return this._requires.concat(); });

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