michael@0: /** michael@0: * Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: var testGenerator = testSteps(); michael@0: michael@0: function testSteps() michael@0: { michael@0: let ioService = michael@0: Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); michael@0: michael@0: function getSpec(filename) { michael@0: let file = do_get_file(filename); michael@0: let uri = ioService.newFileURI(file); michael@0: return uri.spec; michael@0: } michael@0: michael@0: // Test for IDBKeyRange and indexedDB availability in JS modules. michael@0: Cu.import(getSpec("GlobalObjectsModule.jsm")); michael@0: let test = new GlobalObjectsModule(); michael@0: test.ok = ok; michael@0: test.finishTest = continueToNextStep; michael@0: test.runTest(); michael@0: yield undefined; michael@0: michael@0: // Test for IDBKeyRange and indexedDB availability in JS components. michael@0: do_load_manifest("GlobalObjectsComponent.manifest"); michael@0: test = Cc["@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1"]. michael@0: createInstance(Ci.nsISupports).wrappedJSObject; michael@0: test.ok = ok; michael@0: test.finishTest = continueToNextStep; michael@0: test.runTest(); michael@0: yield undefined; michael@0: michael@0: // Test for IDBKeyRange and indexedDB availability in JS sandboxes. michael@0: let principal = Cc["@mozilla.org/systemprincipal;1"]. michael@0: createInstance(Ci.nsIPrincipal); michael@0: let sandbox = new Cu.Sandbox(principal, michael@0: { wantGlobalProperties: ["indexedDB"] }); michael@0: sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js"); michael@0: Cu.evalInSandbox( michael@0: "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \ michael@0: .createInstance(Components.interfaces.mozIJSSubScriptLoader) \ michael@0: .loadSubScript(__SCRIPT_URI_SPEC__);", sandbox, "1.7"); michael@0: sandbox.ok = ok; michael@0: sandbox.finishTest = continueToNextStep; michael@0: Cu.evalInSandbox("runTest();", sandbox); michael@0: yield undefined; michael@0: michael@0: finishTest(); michael@0: yield undefined; michael@0: } michael@0: michael@0: this.runTest = function() { michael@0: do_get_profile(); michael@0: michael@0: do_test_pending(); michael@0: testGenerator.next(); michael@0: }