Very old topic and just now I found a solution.
As of FF34 we can use this component to manage persist data:
Code: Select all
Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
This component provides the following functions:
Code: Select all
hasValue(docURI, id, attr)
getValue(docURI, id, attr)
setValue(docURI, id, attr, value)
removeValue(docURI, id, attr)
getIDsEnumerator(docURI)
getAttributeEnumerator(docURI, id)
Where docURI is window's uri, i.e. chrome://myextension/content/example.xul
id is element's ID
attr is attribute name
(
http://wbamberg.github.io/idl-reference ... Store.html)
For example for my original inquiry this could be used:
Code: Select all
var XULStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
//var uri = "chrome://myextension/content/example.xul";
var uri = window.location.href;
var id = "test";
XULStore.removeValue(uri, id, "value");
To list all stored perist data in current window you can use:
Code: Select all
var XULStore = Cc["@mozilla.org/xul/xulstore;1"].getService(Ci.nsIXULStore);
var uri = window.location.href;
var enumerator = XULStore.getIDsEnumerator(uri);
while(enumerator.hasMore())
{
let id = enumerator.getNext();
let attrEnum = XULStore.getAttributeEnumerator(uri, id);
while(attrEnum.hasMore())
{
let attr = attrEnum.getNext();
let val = XULStore.getValue(uri, id, attr);
dump(id + ": " + attr + " = " + val, 1);
}
}