Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /** |
michael@0 | 2 | * Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | * http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | */ |
michael@0 | 5 | |
michael@0 | 6 | const Cu = Components.utils; |
michael@0 | 7 | |
michael@0 | 8 | Cu.import("resource://gre/modules/XPCOMUtils.jsm"); |
michael@0 | 9 | Cu.importGlobalProperties(["indexedDB"]); |
michael@0 | 10 | |
michael@0 | 11 | function GlobalObjectsComponent() { |
michael@0 | 12 | this.wrappedJSObject = this; |
michael@0 | 13 | } |
michael@0 | 14 | |
michael@0 | 15 | GlobalObjectsComponent.prototype = |
michael@0 | 16 | { |
michael@0 | 17 | classID: Components.ID("{949ebf50-e0da-44b9-8335-cbfd4febfdcc}"), |
michael@0 | 18 | |
michael@0 | 19 | QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]), |
michael@0 | 20 | |
michael@0 | 21 | runTest: function() { |
michael@0 | 22 | const name = "Splendid Test"; |
michael@0 | 23 | |
michael@0 | 24 | let ok = this.ok; |
michael@0 | 25 | let finishTest = this.finishTest; |
michael@0 | 26 | |
michael@0 | 27 | let keyRange = IDBKeyRange.only(42); |
michael@0 | 28 | ok(keyRange, "Got keyRange"); |
michael@0 | 29 | |
michael@0 | 30 | let request = indexedDB.open(name, 1); |
michael@0 | 31 | request.onerror = function(event) { |
michael@0 | 32 | ok(false, "indexedDB error, '" + event.target.error.name + "'"); |
michael@0 | 33 | finishTest(); |
michael@0 | 34 | } |
michael@0 | 35 | request.onsuccess = function(event) { |
michael@0 | 36 | let db = event.target.result; |
michael@0 | 37 | ok(db, "Got database"); |
michael@0 | 38 | finishTest(); |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | this.NSGetFactory = XPCOMUtils.generateNSGetFactory([GlobalObjectsComponent]); |