Commit 1b2e466a authored by Tristan Cavelier's avatar Tristan Cavelier

global failure on browserlocalstorage.js -> fixed

browserlocalstorage.js removed
parent 67926bbd
"use strict";
var localStorage = {};
// clear
Object.defineProperty(localStorage,"clear",{
configurable:false,enumerable:false,writable:false,value:function () {
var k;
for (k in this) {
delete this[k];
}
}
});
// key
Object.defineProperty(localStorage,"key",{
configurable:false,enumerable:false,writable:false,value:function (n) {
var i, k;
if (n < 0 || n >= this.length) {
return null;
}
for (k in this) {
if (i === n) {
return k;
}
i += 1
}
return null;
}
});
// length
Object.defineProperty(localStorage,"length",{
configurable:false,enumerable:false,writable:true,value:0
});
// toString
Object.defineProperty(localStorage,"toString",{
configurable:false,enumerable:false,writable:false,value:function (k, v) {
return "[object Storage]";
}
});
// setItem
Object.defineProperty(localStorage,"setItem",{
configurable:false,enumerable:false,writable:false,value:function (k, v) {
if (typeof this[k] === "undefined" &&
typeof v !== "undefined") {
this.length += 1;
}
this[k] = v.toString();
}
});
// getItem
Object.defineProperty(localStorage,"getItem",{
configurable:false,enumerable:false,writable:false,value:function (k) {
return this[k] === undefined? null: this[k];
}
});
// removeItem
Object.defineProperty(localStorage,"removeItem",{
configurable:false,enumerable:false,writable:false,value:function (k) {
if (typeof this[k] !== "undefined") {
this.length -= 1;
}
delete this[k];
}
});
......@@ -11,8 +11,6 @@
<script type="text/javascript" src="../lib/sinon/sinon.js"></script>
<script type="text/javascript" src="../lib/sinon/sinon-qunit.js"></script>
<script type="text/javascript" src="./browserlocalstorage.stub.js"></script>
<script type="text/javascript" src="../lib/md5/md5.js"></script>
<script type="text/javascript" src="../jio.js"></script>
......
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