GlobalObjectsModule.jsm 838 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/
  4. */
  5. Components.utils.importGlobalProperties(["indexedDB"]);
  6. this.EXPORTED_SYMBOLS = [
  7. "GlobalObjectsModule"
  8. ];
  9. this.GlobalObjectsModule = function GlobalObjectsModule() {
  10. }
  11. GlobalObjectsModule.prototype = {
  12. runTest: function() {
  13. const name = "Splendid Test";
  14. let ok = this.ok;
  15. let finishTest = this.finishTest;
  16. let keyRange = IDBKeyRange.only(42);
  17. ok(keyRange, "Got keyRange");
  18. let request = indexedDB.open(name, 1);
  19. request.onerror = function(event) {
  20. ok(false, "indexedDB error, '" + event.target.error.name + "'");
  21. finishTest();
  22. }
  23. request.onsuccess = function(event) {
  24. let db = event.target.result;
  25. ok(db, "Got database");
  26. finishTest();
  27. }
  28. }
  29. }