commit 7b621420f7c0e610b16a48bc2184ef14312459aa
parent aaeb2cec9d9f93a400c7bfa4444ee059b13f88bc
Author: Aurimas Vinckevicius <aurimas.dev@gmail.com>
Date: Tue, 17 Feb 2015 22:12:52 -0600
Fix possible infinite loops
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/chrome/content/zotero/xpcom/schema.js b/chrome/content/zotero/xpcom/schema.js
@@ -1962,9 +1962,9 @@ Zotero.Schema = new function(){
var rows = Zotero.DB.query("SELECT * FROM itemData WHERE valueID NOT IN (SELECT valueID FROM itemDataValues)");
if (rows) {
for (var j=0; j<rows.length; j++) {
- for (var j=0; j<values.length; j++) {
+ for (var k=0; k<values.length; k++) {
var valueID = Zotero.ID.get('itemDataValues');
- Zotero.DB.query("INSERT INTO itemDataValues VALUES (?,?)", [valueID, values[j]]);
+ Zotero.DB.query("INSERT INTO itemDataValues VALUES (?,?)", [valueID, values[k]]);
Zotero.DB.query("UPDATE itemData SET valueID=? WHERE itemID=? AND fieldID=?", [valueID, rows[j]['itemID'], rows[j]['fieldID']]);
}
}
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js
@@ -1090,15 +1090,15 @@ Zotero.Utilities = {
// document, we need to use selectNodes
if(namespaces) {
var ieNamespaces = [];
- for(var i in namespaces) {
- if(!i) continue;
- ieNamespaces.push('xmlns:'+i+'="'+Zotero.Utilities.htmlSpecialChars(namespaces[i])+'"');
+ for(var j in namespaces) {
+ if(!j) continue;
+ ieNamespaces.push('xmlns:'+j+'="'+Zotero.Utilities.htmlSpecialChars(namespaces[j])+'"');
}
rootDoc.setProperty("SelectionNamespaces", ieNamespaces.join(" "));
}
var nodes = element.selectNodes(xpath);
- for(var i=0; i<nodes.length; i++) {
- results.push(nodes[i]);
+ for(var j=0; j<nodes.length; j++) {
+ results.push(nodes[j]);
}
} else {
throw new Error("XPath functionality not available");