Commit 9af14f8a authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Trailing spaces deleted.

console.log no longer in scripts.
JIO classes are more secure now.
parent b149e374
......@@ -7,38 +7,46 @@
</head>
<body>
<script type="text/javascript" src="js/jquery/jquery.js"></script>
<script type="text/javascript" src="unhosted/localorcookiestorage.js"></script>
<script type="text/javascript" src="unhosted/localorcookiestorage.js">
</script>
<script type="text/javascript" src="unhosted/jio.js"></script>
<script type="text/javascript" src="unhosted/base64.js"></script>
<script type="text/javascript" src="unhosted/jio.storage.js"></script>
<script type="text/javascript">
<!--
var mammal = function (description) {
this.caracteristics = description;
};
mammal.prototype = {
createMammal: function () {
// c'est un chat alors
var mycat = new cat(this.caracteristics);
var t = this;
mycat.say = function () { return t.caracteristics.say; };
mycat.name = function () { return t.caracteristics.name; };
return mycat;
}
var maClassPasProtegee = function () {
this.monAttributPasProtegee = 0;
};
var cat = function (detaileddescription) {
// (...)
};
cat.prototype = {
talk: function () {
alert('My name is ' + this.name() + ', ' + this.say());
maClassPasProtegee.prototype = {
getMonAttribut: function () {
return this.monAttributPasProtegee;
},
logMonAttribut: function () {
console.log (this.monAttributPasProtegee);
}
};
var maclass1 = new maClassPasProtegee();
maclass1.logMonAttribut();
maclass1.monAttributPasProtegee ++;
maclass1.logMonAttribut();
var mam = new mammal({'say':'meow','name':'nyancat'});
var mycat = mam.createMammal();
mycat.talk();
//-->
var maClassProtegee = function () {
var publ = {}, priv = {};
priv.monAttributProtegee = 0;
publ.getMonAttribut = function () {
return priv.monAttributProtegee;
};
publ.logMonAttribut = function () {
console.log (priv.monAttributProtegee);
};
return publ;
};
var maclass2 = new maClassProtegee();
maclass2.logMonAttribut();
maclass2.monAttributProtegee ++;
maclass2.logMonAttribut();
//-->
</script>
</body>
</html>
......@@ -40,7 +40,7 @@ test ( "Jio simple methods", function () {
deepEqual ( o.jio.isReady(), true, '1 must be not ready');
ok ( o.jio2.id !== o.jio.id, '1 and 2 must be different');
ok ( o.jio2.getID() !== o.jio.getID(), '1 and 2 must be different');
deepEqual ( o.jio.stop(), true, '1 must be stopped');
......@@ -140,19 +140,15 @@ test ('Simple Job Elimination', function () {
o.jio = JIO.createNew({'type':'dummyallok','userName':'dummy'},
{'ID':'jiotests'});
id = o.jio.id;
id = o.jio.getID();
o.jio.saveDocument({'fileName':'file','fileContent':'content',
'callback':o.f1,'maxtries':1});
console.log (localStorage.getItem('jio/jobObject/'+id));
ok(LocalOrCookieStorage.getItem('jio/jobObject/'+id)['1'],
'job creation');
console.log (localStorage.getItem('jio/jobObject/'+id));
clock.tick(10);
console.log (localStorage.getItem('jio/jobObject/'+id));
o.jio.removeDocument({'fileName':'file','fileContent':'content',
'callback':o.f2,'maxtries':1});
o.tmp = LocalOrCookieStorage.getItem('jio/jobObject/'+id)['1'];
console.log (localStorage.getItem('jio/jobObject/'+id));
ok(!o.tmp || o.tmp.status === 'fail','job elimination');
});
......@@ -168,7 +164,7 @@ test ('Simple Job Replacement', function () {
o.jio = JIO.createNew({'type':'dummyallok','userName':'dummy'},
{'ID':'jiotests'});
id = o.jio.id;
id = o.jio.getID();
o.jio.saveDocument({'fileName':'file','fileContent':'content',
'callback':o.f1,'maxtries':1});
clock.tick(10);
......@@ -193,7 +189,7 @@ test ('Simple Job Waiting', function () {
o.jio = JIO.createNew({'type':'dummyallok','userName':'dummy'},
{'ID':'jiotests'});
id = o.jio.id;
id = o.jio.getID();
o.jio.saveDocument({'fileName':'file','fileContent':'content',
'callback':o.f3,'maxtries':1});
clock.tick(200);
......
This diff is collapsed.
......@@ -62,7 +62,7 @@
}
return that.done(true);
}, 100);
}; // end userNameAvailable
}; // end checkNameAvailability
that.saveDocument = function () {
// Save a document in the local storage
......@@ -307,7 +307,7 @@
async: true,
dataType: 'text', // TODO is it necessary ?
headers: {'Authorization':'Basic '+Base64.encode(
that.getStorageUserName() + ':' + that.getStoragePassword())},
that.getStorageUserName()+':'+that.getStoragePassword())},
// xhrFields: {withCredentials: 'true'}, // cross domain
success: function () {
that.done();
......@@ -359,7 +359,7 @@
case 404:
message = 'Document not found.'; break;
default:
message = 'Cannot load "' + that.getFileName() + '".';
message = 'Cannot load "'+that.getFileName()+'".';
break;
}
that.fail(message,type.status);
......@@ -426,7 +426,8 @@
$("D\\:response",xmlData).each(function(i,data) {
if(i>0) { // exclude parent folder
file = {};
pathArray = ($($("D\\:href",
pathArray = (
$($("D\\:href",
xmlData).get(i)).text()).split('/');
file.fileName = (pathArray[pathArray.length-1] ?
pathArray[pathArray.length-1] :
......@@ -434,10 +435,12 @@
if (file.fileName === '.htaccess' ||
file.fileName === '.htpasswd') { return; }
file.lastModified = (
new Date($($("lp1\\:getlastmodified",
new Date(
$($("lp1\\:getlastmodified",
xmlData).get(i)).text())).getTime();
file.creationDate = (
new Date($($("lp1\\:creationdate",
new Date(
$($("lp1\\:creationdate",
xmlData).get(i)).text())).getTime();
documentArrayList.push (file);
}
......
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