Using IndexedDB in chrome

The indexedDB API is typically used to store data in the user's browser from content JavaScript. (See Using IndexedDB for an overview.) However, the APIs can also be accessed from system-privileged JavaScript using the Components.utils.importGlobalProperties() function:

Components.utils.importGlobalProperties(["indexedDB"]);

// From here on, it's like using IndexedDB from content
var req = indexedDB.open("my-database");
// ...

If you are creating a sandbox, and want indexedDB to be available in it, use the wantGlobalProperties option in the Sandbox constructor:

var options = {
  "wantGlobalProperties": ["indexedDB"]
}
var principal = Cc["@mozilla.org/systemprincipal;1"].createInstance(Ci.nsIPrincipal);
var sandbox = Components.utils.Sandbox(principal, options);

// The sandbox will have access to indexedDB
var sandboxScript = 'var req = indexedDB.open("my-database");';
Components.utils.evalInSandbox(sandboxScript, sandbox);

Before Firefox 33, you would access indexedDB from chrome code using the initWindowless method of the nsIIndexedDatabaseManager service. This method was removed in Firefox 33.