Fix possible infinite loops

This commit is contained in:
Aurimas Vinckevicius 2015-02-17 22:12:52 -06:00
parent aaeb2cec9d
commit 7b621420f7
2 changed files with 7 additions and 7 deletions

View file

@ -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']]);
}
}

View file

@ -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");