mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 740771 - Stringify null for Storage.getItem/setItem/removeItem; r=mayhemer
This commit is contained in:
parent
cb0ed3c5ae
commit
baf72711e7
@ -74,7 +74,7 @@ interface nsIDOMStorage : nsISupports
|
|||||||
* @param key key to retrieve
|
* @param key key to retrieve
|
||||||
* @returns found data or empty string if the key was not found
|
* @returns found data or empty string if the key was not found
|
||||||
*/
|
*/
|
||||||
DOMString getItem(in DOMString key);
|
DOMString getItem([Null(Stringify)] in DOMString key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a value with a key. If the key does not exist already, a new
|
* Assign a value with a key. If the key does not exist already, a new
|
||||||
@ -84,14 +84,14 @@ interface nsIDOMStorage : nsISupports
|
|||||||
* @param key key to set
|
* @param key key to set
|
||||||
* @param data data to associate with the key
|
* @param data data to associate with the key
|
||||||
*/
|
*/
|
||||||
void setItem(in DOMString key, in DOMString data);
|
void setItem([Null(Stringify)] in DOMString key, [Null(Stringify)] in DOMString data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a key and its corresponding value.
|
* Remove a key and its corresponding value.
|
||||||
*
|
*
|
||||||
* @param key key to remove
|
* @param key key to remove
|
||||||
*/
|
*/
|
||||||
void removeItem(in DOMString key);
|
void removeItem([Null(Stringify)] in DOMString key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the content of this storage bound to a domain
|
* Clear the content of this storage bound to a domain
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var MOZ_STORAGE_CHANGED_COUNT = 14;
|
var MOZ_STORAGE_CHANGED_COUNT = 21;
|
||||||
|
|
||||||
function startTest()
|
function startTest()
|
||||||
{
|
{
|
||||||
@ -159,6 +159,34 @@ function startTest()
|
|||||||
is(localStorage["testC"], "valueC2");
|
is(localStorage["testC"], "valueC2");
|
||||||
is(localStorage.getItem("testC"), "valueC2");
|
is(localStorage.getItem("testC"), "valueC2");
|
||||||
|
|
||||||
|
localStorage.setItem("testC", null);
|
||||||
|
is("testC" in localStorage, true);
|
||||||
|
is(localStorage.getItem("testC"), "null");
|
||||||
|
is(localStorage["testC"], "null");
|
||||||
|
is(localStorage.testC, "null");
|
||||||
|
|
||||||
|
localStorage.removeItem("testC");
|
||||||
|
localStorage["testC"] = null;
|
||||||
|
is("testC" in localStorage, true);
|
||||||
|
is(localStorage.getItem("testC"), "null");
|
||||||
|
is(localStorage["testC"], "null");
|
||||||
|
is(localStorage.testC, "null");
|
||||||
|
|
||||||
|
localStorage.setItem(null, "test");
|
||||||
|
is("null" in localStorage, true);
|
||||||
|
is(localStorage.getItem("null"), "test");
|
||||||
|
is(localStorage.getItem(null), "test");
|
||||||
|
is(localStorage["null"], "test");
|
||||||
|
localStorage.removeItem(null, "test");
|
||||||
|
// bug 350023
|
||||||
|
todo_is("null" in localStorage, false);
|
||||||
|
|
||||||
|
localStorage.setItem(null, "test");
|
||||||
|
is("null" in localStorage, true);
|
||||||
|
localStorage.removeItem("null", "test");
|
||||||
|
// bug 350023
|
||||||
|
todo_is("null" in localStorage, false);
|
||||||
|
|
||||||
// Clear the storage
|
// Clear the storage
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
is("testB" in localStorage, false, "Keys are not in the JS scope of the storage");
|
is("testB" in localStorage, false, "Keys are not in the JS scope of the storage");
|
||||||
|
@ -165,6 +165,34 @@ function doTest()
|
|||||||
is(localStorage["testC"], "valueC2");
|
is(localStorage["testC"], "valueC2");
|
||||||
is(localStorage.getItem("testC"), "valueC2");
|
is(localStorage.getItem("testC"), "valueC2");
|
||||||
|
|
||||||
|
localStorage.setItem("testC", null);
|
||||||
|
is("testC" in localStorage, true);
|
||||||
|
is(localStorage.getItem("testC"), "null");
|
||||||
|
is(localStorage["testC"], "null");
|
||||||
|
is(localStorage.testC, "null");
|
||||||
|
|
||||||
|
localStorage.removeItem("testC");
|
||||||
|
localStorage["testC"] = null;
|
||||||
|
is("testC" in localStorage, true);
|
||||||
|
is(localStorage.getItem("testC"), "null");
|
||||||
|
is(localStorage["testC"], "null");
|
||||||
|
is(localStorage.testC, "null");
|
||||||
|
|
||||||
|
localStorage.setItem(null, "test");
|
||||||
|
is("null" in localStorage, true);
|
||||||
|
is(localStorage.getItem("null"), "test");
|
||||||
|
is(localStorage.getItem(null), "test");
|
||||||
|
is(localStorage["null"], "test");
|
||||||
|
localStorage.removeItem(null, "test");
|
||||||
|
// bug 350023
|
||||||
|
todo_is("null" in localStorage, false);
|
||||||
|
|
||||||
|
localStorage.setItem(null, "test");
|
||||||
|
is("null" in localStorage, true);
|
||||||
|
localStorage.removeItem("null", "test");
|
||||||
|
// bug 350023
|
||||||
|
todo_is("null" in localStorage, false);
|
||||||
|
|
||||||
// Clear the storage
|
// Clear the storage
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
is(localStorage.length, 0, "The storage is empty [3]");
|
is(localStorage.length, 0, "The storage is empty [3]");
|
||||||
|
@ -156,6 +156,34 @@ function startTest()
|
|||||||
is(localStorage["testC"], "valueC2");
|
is(localStorage["testC"], "valueC2");
|
||||||
is(localStorage.getItem("testC"), "valueC2");
|
is(localStorage.getItem("testC"), "valueC2");
|
||||||
|
|
||||||
|
localStorage.setItem("testC", null);
|
||||||
|
is("testC" in localStorage, true);
|
||||||
|
is(localStorage.getItem("testC"), "null");
|
||||||
|
is(localStorage["testC"], "null");
|
||||||
|
is(localStorage.testC, "null");
|
||||||
|
|
||||||
|
localStorage.removeItem("testC");
|
||||||
|
localStorage["testC"] = null;
|
||||||
|
is("testC" in localStorage, true);
|
||||||
|
is(localStorage.getItem("testC"), "null");
|
||||||
|
is(localStorage["testC"], "null");
|
||||||
|
is(localStorage.testC, "null");
|
||||||
|
|
||||||
|
localStorage.setItem(null, "test");
|
||||||
|
is("null" in localStorage, true);
|
||||||
|
is(localStorage.getItem("null"), "test");
|
||||||
|
is(localStorage.getItem(null), "test");
|
||||||
|
is(localStorage["null"], "test");
|
||||||
|
localStorage.removeItem(null, "test");
|
||||||
|
// bug 350023
|
||||||
|
todo_is("null" in localStorage, false);
|
||||||
|
|
||||||
|
localStorage.setItem(null, "test");
|
||||||
|
is("null" in localStorage, true);
|
||||||
|
localStorage.removeItem("null", "test");
|
||||||
|
// bug 350023
|
||||||
|
todo_is("null" in localStorage, false);
|
||||||
|
|
||||||
// Clear the storage
|
// Clear the storage
|
||||||
localStorage.clear();
|
localStorage.clear();
|
||||||
is(localStorage.length, 0, "The storage is empty [3]");
|
is(localStorage.length, 0, "The storage is empty [3]");
|
||||||
|
Loading…
Reference in New Issue
Block a user