summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/test/extensions/bootstrap.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/indexedDB/test/extensions/bootstrap.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/indexedDB/test/extensions/bootstrap.js')
-rw-r--r--dom/indexedDB/test/extensions/bootstrap.js84
1 files changed, 84 insertions, 0 deletions
diff --git a/dom/indexedDB/test/extensions/bootstrap.js b/dom/indexedDB/test/extensions/bootstrap.js
new file mode 100644
index 000000000..357ac462e
--- /dev/null
+++ b/dom/indexedDB/test/extensions/bootstrap.js
@@ -0,0 +1,84 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function testForExpectedSymbols(stage, data) {
+ const expectedSymbols = [ "IDBKeyRange", "indexedDB" ];
+ for (var symbol of expectedSymbols) {
+ Services.prefs.setBoolPref("indexeddbtest.bootstrap." + stage + "." +
+ symbol, symbol in this);
+ }
+}
+
+function GlobalObjectsComponent() {
+ this.wrappedJSObject = this;
+}
+
+GlobalObjectsComponent.prototype =
+{
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
+
+ runTest: function() {
+ const name = "Splendid Test";
+
+ let ok = this.ok;
+ let finishTest = this.finishTest;
+
+ let keyRange = IDBKeyRange.only(42);
+ ok(keyRange, "Got keyRange");
+
+ let request = indexedDB.open(name, 1);
+ request.onerror = function(event) {
+ ok(false, "indexedDB error, '" + event.target.error.name + "'");
+ finishTest();
+ }
+ request.onsuccess = function(event) {
+ let db = event.target.result;
+ ok(db, "Got database");
+ finishTest();
+ }
+ }
+};
+
+var gFactory = {
+ register: function() {
+ var registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+
+ var classID = Components.ID("{d6f85dcb-537d-447e-b783-75d4b405622d}");
+ var description = "IndexedDBTest";
+ var contractID = "@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1";
+ var factory = XPCOMUtils._getFactory(GlobalObjectsComponent);
+
+ registrar.registerFactory(classID, description, contractID, factory);
+
+ this.unregister = function() {
+ registrar.unregisterFactory(classID, factory);
+ delete this.unregister;
+ };
+ }
+};
+
+function install(data, reason) {
+ testForExpectedSymbols("install");
+}
+
+function startup(data, reason) {
+ testForExpectedSymbols("startup");
+ gFactory.register();
+}
+
+function shutdown(data, reason) {
+ testForExpectedSymbols("shutdown");
+ gFactory.unregister();
+}
+
+function uninstall(data, reason) {
+ testForExpectedSymbols("uninstall");
+}