1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/test/unit/test_globalObjects_other.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/** 1.5 + * Any copyright is dedicated to the Public Domain. 1.6 + * http://creativecommons.org/publicdomain/zero/1.0/ 1.7 + */ 1.8 + 1.9 +var testGenerator = testSteps(); 1.10 + 1.11 +function testSteps() 1.12 +{ 1.13 + let ioService = 1.14 + Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); 1.15 + 1.16 + function getSpec(filename) { 1.17 + let file = do_get_file(filename); 1.18 + let uri = ioService.newFileURI(file); 1.19 + return uri.spec; 1.20 + } 1.21 + 1.22 + // Test for IDBKeyRange and indexedDB availability in JS modules. 1.23 + Cu.import(getSpec("GlobalObjectsModule.jsm")); 1.24 + let test = new GlobalObjectsModule(); 1.25 + test.ok = ok; 1.26 + test.finishTest = continueToNextStep; 1.27 + test.runTest(); 1.28 + yield undefined; 1.29 + 1.30 + // Test for IDBKeyRange and indexedDB availability in JS components. 1.31 + do_load_manifest("GlobalObjectsComponent.manifest"); 1.32 + test = Cc["@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1"]. 1.33 + createInstance(Ci.nsISupports).wrappedJSObject; 1.34 + test.ok = ok; 1.35 + test.finishTest = continueToNextStep; 1.36 + test.runTest(); 1.37 + yield undefined; 1.38 + 1.39 + // Test for IDBKeyRange and indexedDB availability in JS sandboxes. 1.40 + let principal = Cc["@mozilla.org/systemprincipal;1"]. 1.41 + createInstance(Ci.nsIPrincipal); 1.42 + let sandbox = new Cu.Sandbox(principal, 1.43 + { wantGlobalProperties: ["indexedDB"] }); 1.44 + sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js"); 1.45 + Cu.evalInSandbox( 1.46 + "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \ 1.47 + .createInstance(Components.interfaces.mozIJSSubScriptLoader) \ 1.48 + .loadSubScript(__SCRIPT_URI_SPEC__);", sandbox, "1.7"); 1.49 + sandbox.ok = ok; 1.50 + sandbox.finishTest = continueToNextStep; 1.51 + Cu.evalInSandbox("runTest();", sandbox); 1.52 + yield undefined; 1.53 + 1.54 + finishTest(); 1.55 + yield undefined; 1.56 +} 1.57 + 1.58 +this.runTest = function() { 1.59 + do_get_profile(); 1.60 + 1.61 + do_test_pending(); 1.62 + testGenerator.next(); 1.63 +}