Commit 6f672beb authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Array browsing bug fixed.

parent 586cee4e
......@@ -290,7 +290,7 @@ var JIO =
var k = null, id = 0,
jioIdArray = jioGlobalObj.localStorage.getItem (jioIdArrayName);
for (k in jioIdArray) {
for (k = 0; k < jioIdArray.length; k += 1) {
if (jioIdArray[k] >= jioGlobalObj.queueID) {
jioGlobalObj.queueID = jioIdArray[k] + 1;
}
......@@ -304,7 +304,7 @@ var JIO =
var k = null, newJioIdArray = [], jioIdArrayChanged = false,
jioIdArray = jioGlobalObj.localStorage.getItem (jioIdArrayName);
for (k in jioIdArray) {
for (k = 0; k < jioIdArray.length; k += 1) {
if (jioGlobalObj.localStorage.getItem (
'jio/id/'+jioIdArray[k]) < Date.now () - 10000) {
// remove id from jioIdArray
......@@ -405,7 +405,7 @@ var JIO =
if (res.newone) {
// if it is a new job, we can eliminate deprecated jobs and
// set this job dependencies.
for (id in res.elimArray) {
for (id = 0; id < res.elimArray.length; id += 1) {
basestorage = new BaseStorage(
{'queue':that,'job':priv.jobObject[res.elimArray[id]]});
basestorage.eliminate();
......@@ -413,13 +413,13 @@ var JIO =
if (res.waitArray.length > 0) {
job.status = 'wait';
job.waitingFor = {'jobIdArray':res.waitArray};
for (id in res.waitArray) {
for (id = 0; id < res.waitArray.length; id += 1) {
if (priv.jobObject[res.waitArray[id]]) {
priv.jobObject[res.waitArray[id]].maxtries = 1;
}
}
}
for (id in res.removeArray) {
for (id = 0; id < res.removeArray.length; id += 1) {
that.removeJob(priv.jobObject[res.removeArray[id]]);
}
// set job id
......@@ -481,7 +481,7 @@ var JIO =
that.invokeAll = function () {
// Do all jobs in the queue.
var i = 'id', ok;
var i = 'id', j, ok;
//// do All jobs
for (i in priv.jobObject) {
ok = false;
......@@ -495,7 +495,9 @@ var JIO =
if (priv.jobObject[i].waitingFor.jobIdArray) {
// wait job
// browsing job id array
for (var j in priv.jobObject[i].waitingFor.jobIdArray) {
for (j = 0;
j < priv.jobObject[i].waitingFor.jobIdArray.length;
j += 1) {
if (priv.jobObject[priv.jobObject[i].
waitingFor.jobIdArray[j]]) {
// if a job is still exist, don't invoke
......@@ -743,7 +745,7 @@ var JIO =
var i;
priv.res.message = 'Document list received.';
priv.res.list = documentlist;
for (i in priv.res.list) {
for (i = 0; i < priv.res.list.length; i += 1) {
priv.res.list[i].lastModified =
new Date(priv.res.list[i].lastModified).getTime();
priv.res.list[i].creationDate =
......
......@@ -42,11 +42,11 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// wait a little in order to simulate asynchronous operation
setTimeout(function () {
var localStorageObject = null;
var localStorageObject = null, k, splitk;
localStorageObject = LocalOrCookieStorage.getAll();
for (var k in localStorageObject) {
var splitk = k.split('/');
for (k in localStorageObject) {
splitk = k.split('/');
if (splitk[0] === 'jio' &&
splitk[1] === 'local' &&
splitk[2] === that.getUserName()) {
......@@ -522,7 +522,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
};
for (i in priv.storageArray) {
for (i = 0; i < priv.storageArray.length; i += 1) {
newjob = that.cloneJob();
newjob.maxtries = priv.maxtries;
newjob.storage = priv.storageArray[i];
......@@ -557,7 +557,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
};
for (i in priv.storageArray) {
for (i = 0; i < priv.storageArray.length; i += 1) {
newjob = that.cloneJob();
newjob.maxtries = priv.maxtries;
newjob.storage = priv.storageArray[i];
......@@ -630,7 +630,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
};
for (i in priv.storageArray) {
for (i = 0; i < priv.storageArray.length; i += 1) {
newjob = that.cloneJob();
newjob.maxtries = priv.maxtries;
newjob.storage = priv.storageArray[i];
......@@ -668,7 +668,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
};
for (i in priv.storageArray) {
for (i = 0; i < priv.storageArray.length; i += 1) {
newjob = that.cloneJob();
newjob.maxtries = priv.maxtries;
newjob.storage = priv.storageArray[i];
......@@ -703,7 +703,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
};
for (i in priv.storageArray) {
for (i = 0; i < priv.storageArray.length; i += 1) {
newjob = that.cloneJob();
newjob.maxtries = priv.maxtries;
newjob.storage = priv.storageArray[i];
......
......@@ -40,10 +40,10 @@ var LocalOrCookieStorage =
};
CookieStorage.prototype = {
getItem: function (name) {
var cookies = document.cookie.split(';');
for (var i in cookies) {
var x = cookies[i].substr(0, cookies[i].indexOf('='));
var y = cookies[i].substr(cookies[i].indexOf('=')+1);
var cookies = document.cookie.split(';'), i;
for (i = 0; i < cookies.length; i += 1) {
var x = cookies[i].substr(0, cookies[i].indexOf('=')),
y = cookies[i].substr(cookies[i].indexOf('=')+1);
x = x.replace(/^\s+|\s+$/g,"");
if( x === name ) { return unescape(y); }
}
......@@ -60,11 +60,11 @@ var LocalOrCookieStorage =
return false;
},
getAll: function() {
var retObject = {};
var retObject = {}, i,
var cookies = document.cookie.split(':');
for (var i in cookies) {
var x = cookies[i].substr(0, cookies[i].indexOf('='));
var y = cookies[i].substr(cookies[i].indexOf('=')+1);
for (i = 0; i < cookies.length; i += 1) {
var x = cookies[i].substr(0, cookies[i].indexOf('=')),
y = cookies[i].substr(cookies[i].indexOf('=')+1);
x = x.replace(/^\s+|\s+$/g,"");
retObject[x] = unescape(y);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment