test_globalObjects_other.js (1463B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 var testGenerator = testSteps(); 7 8 function* testSteps() { 9 function getSpec(filename) { 10 let file = do_get_file(filename); 11 let uri = Services.io.newFileURI(file); 12 return uri.spec; 13 } 14 15 // Test for IDBKeyRange and indexedDB availability in JS modules. 16 const { GlobalObjectsModule } = ChromeUtils.importESModule( 17 "resource://test/GlobalObjectsModule.sys.mjs" 18 ); 19 let test = new GlobalObjectsModule(); 20 test.ok = ok; 21 test.finishTest = continueToNextStep; 22 test.runTest(); 23 yield undefined; 24 25 // Test for IDBKeyRange and indexedDB availability in JS sandboxes. 26 let principal = Cc["@mozilla.org/systemprincipal;1"].createInstance( 27 Ci.nsIPrincipal 28 ); 29 let sandbox = new Cu.Sandbox(principal, { 30 wantGlobalProperties: ["indexedDB"], 31 }); 32 sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js"); 33 Cu.evalInSandbox( 34 "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \ 35 .createInstance(Components.interfaces.mozIJSSubScriptLoader) \ 36 .loadSubScript(__SCRIPT_URI_SPEC__);", 37 sandbox, 38 "1.7" 39 ); 40 sandbox.ok = ok; 41 sandbox.finishTest = continueToNextStep; 42 Cu.evalInSandbox("runTest();", sandbox); 43 yield undefined; 44 45 finishTest(); 46 yield undefined; 47 } 48 49 this.runTest = function () { 50 do_get_profile(); 51 52 do_test_pending(); 53 testGenerator.next(); 54 };