[Pkg-mozext-commits] [greasemonkey] 14/62: The 'use strict' - after installing a script - throws the warning

David Prévot taffit at moszumanska.debian.org
Sun Sep 13 22:10:20 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 ab45b6502dc7755d31f9c329a62cc8e0b7b7f60e
Author: janekptacijarabaci <janekptacijarabaci at seznam.cz>
Date:   Wed Aug 19 10:07:42 2015 +0200

    The 'use strict' - after installing a script - throws the warning
    
    ReferenceError: reference to undefined property
    this.scripts[existingIndex]
    - config.js:139:18
---
 content/config.js | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/content/config.js b/content/config.js
index 3450d41..b5798ea 100644
--- a/content/config.js
+++ b/content/config.js
@@ -136,7 +136,9 @@ Config.prototype._save = function(saveNow) {
 
 Config.prototype.install = function(script, oldScript, tempDir) {
   var existingIndex = this._find(oldScript || script);
-  if (!oldScript) oldScript = this.scripts[existingIndex];
+  if (!oldScript && (existingIndex > -1)) {
+    oldScript = this.scripts[existingIndex];
+  }
 
   if (oldScript) {
     // Save the old script's state.
@@ -169,8 +171,10 @@ Config.prototype.uninstall = function(script, forUpdate) {
   if ('undefined' == typeof(forUpdate)) forUpdate = false;
 
   var idx = this._find(script);
-  this._scripts.splice(idx, 1);
-  script.uninstall(forUpdate);
+  if (idx > -1) {
+    this._scripts.splice(idx, 1);
+    script.uninstall(forUpdate);
+  }
 };
 
 /**

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