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