Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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 | var testGenerator = testSteps(); |
michael@0 | 7 | |
michael@0 | 8 | function testSteps() |
michael@0 | 9 | { |
michael@0 | 10 | let ioService = |
michael@0 | 11 | Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); |
michael@0 | 12 | |
michael@0 | 13 | function getSpec(filename) { |
michael@0 | 14 | let file = do_get_file(filename); |
michael@0 | 15 | let uri = ioService.newFileURI(file); |
michael@0 | 16 | return uri.spec; |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | // Test for IDBKeyRange and indexedDB availability in JS modules. |
michael@0 | 20 | Cu.import(getSpec("GlobalObjectsModule.jsm")); |
michael@0 | 21 | let test = new GlobalObjectsModule(); |
michael@0 | 22 | test.ok = ok; |
michael@0 | 23 | test.finishTest = continueToNextStep; |
michael@0 | 24 | test.runTest(); |
michael@0 | 25 | yield undefined; |
michael@0 | 26 | |
michael@0 | 27 | // Test for IDBKeyRange and indexedDB availability in JS components. |
michael@0 | 28 | do_load_manifest("GlobalObjectsComponent.manifest"); |
michael@0 | 29 | test = Cc["@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1"]. |
michael@0 | 30 | createInstance(Ci.nsISupports).wrappedJSObject; |
michael@0 | 31 | test.ok = ok; |
michael@0 | 32 | test.finishTest = continueToNextStep; |
michael@0 | 33 | test.runTest(); |
michael@0 | 34 | yield undefined; |
michael@0 | 35 | |
michael@0 | 36 | // Test for IDBKeyRange and indexedDB availability in JS sandboxes. |
michael@0 | 37 | let principal = Cc["@mozilla.org/systemprincipal;1"]. |
michael@0 | 38 | createInstance(Ci.nsIPrincipal); |
michael@0 | 39 | let sandbox = new Cu.Sandbox(principal, |
michael@0 | 40 | { wantGlobalProperties: ["indexedDB"] }); |
michael@0 | 41 | sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js"); |
michael@0 | 42 | Cu.evalInSandbox( |
michael@0 | 43 | "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \ |
michael@0 | 44 | .createInstance(Components.interfaces.mozIJSSubScriptLoader) \ |
michael@0 | 45 | .loadSubScript(__SCRIPT_URI_SPEC__);", sandbox, "1.7"); |
michael@0 | 46 | sandbox.ok = ok; |
michael@0 | 47 | sandbox.finishTest = continueToNextStep; |
michael@0 | 48 | Cu.evalInSandbox("runTest();", sandbox); |
michael@0 | 49 | yield undefined; |
michael@0 | 50 | |
michael@0 | 51 | finishTest(); |
michael@0 | 52 | yield undefined; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | this.runTest = function() { |
michael@0 | 56 | do_get_profile(); |
michael@0 | 57 | |
michael@0 | 58 | do_test_pending(); |
michael@0 | 59 | testGenerator.next(); |
michael@0 | 60 | } |