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