GlobalObjectsComponent.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/
  4. */
  5. const Cu = Components.utils;
  6. Cu.import("resource://gre/modules/XPCOMUtils.jsm");
  7. Cu.importGlobalProperties(["indexedDB"]);
  8. function GlobalObjectsComponent() {
  9. this.wrappedJSObject = this;
  10. }
  11. GlobalObjectsComponent.prototype =
  12. {
  13. classID: Components.ID("{949ebf50-e0da-44b9-8335-cbfd4febfdcc}"),
  14. QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
  15. runTest: function() {
  16. const name = "Splendid Test";
  17. let ok = this.ok;
  18. let finishTest = this.finishTest;
  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. }
  32. };
  33. this.NSGetFactory = XPCOMUtils.generateNSGetFactory([GlobalObjectsComponent]);