GlobalObjectsChild.js 815 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/
  4. */
  5. function ok(cond, msg) {
  6. dump("ok(" + cond + ", \"" + msg + "\")");
  7. do_check_true(!!cond, Components.stack.caller);
  8. }
  9. function finishTest()
  10. {
  11. do_execute_soon(function() {
  12. do_test_finished();
  13. });
  14. }
  15. function run_test() {
  16. const name = "Splendid Test";
  17. Cu.importGlobalProperties(["indexedDB"]);
  18. do_test_pending();
  19. let keyRange = IDBKeyRange.only(42);
  20. ok(keyRange, "Got keyRange");
  21. let request = indexedDB.open(name, 1);
  22. request.onerror = function(event) {
  23. ok(false, "indexedDB error, '" + event.target.error.name + "'");
  24. finishTest();
  25. }
  26. request.onsuccess = function(event) {
  27. let db = event.target.result;
  28. ok(db, "Got database");
  29. finishTest();
  30. }
  31. }