dom/indexedDB/test/unit/test_globalObjects_other.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /**
     2  * Any copyright is dedicated to the Public Domain.
     3  * http://creativecommons.org/publicdomain/zero/1.0/
     4  */
     6 var testGenerator = testSteps();
     8 function testSteps()
     9 {
    10   let ioService =
    11     Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
    13   function getSpec(filename) {
    14     let file = do_get_file(filename);
    15     let uri = ioService.newFileURI(file);
    16     return uri.spec;
    17   }
    19   // Test for IDBKeyRange and indexedDB availability in JS modules.
    20   Cu.import(getSpec("GlobalObjectsModule.jsm"));
    21   let test = new GlobalObjectsModule();
    22   test.ok = ok;
    23   test.finishTest = continueToNextStep;
    24   test.runTest();
    25   yield undefined;
    27   // Test for IDBKeyRange and indexedDB availability in JS components.
    28   do_load_manifest("GlobalObjectsComponent.manifest");
    29   test = Cc["@mozilla.org/dom/indexeddb/GlobalObjectsComponent;1"].
    30          createInstance(Ci.nsISupports).wrappedJSObject;
    31   test.ok = ok;
    32   test.finishTest = continueToNextStep;
    33   test.runTest();
    34   yield undefined;
    36   // Test for IDBKeyRange and indexedDB availability in JS sandboxes.
    37   let principal = Cc["@mozilla.org/systemprincipal;1"].
    38                   createInstance(Ci.nsIPrincipal);
    39   let sandbox = new Cu.Sandbox(principal,
    40                                { wantGlobalProperties: ["indexedDB"] });
    41   sandbox.__SCRIPT_URI_SPEC__ = getSpec("GlobalObjectsSandbox.js");
    42   Cu.evalInSandbox(
    43     "Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \
    44                .createInstance(Components.interfaces.mozIJSSubScriptLoader) \
    45                .loadSubScript(__SCRIPT_URI_SPEC__);", sandbox, "1.7");
    46   sandbox.ok = ok;
    47   sandbox.finishTest = continueToNextStep;
    48   Cu.evalInSandbox("runTest();", sandbox);
    49   yield undefined;
    51   finishTest();
    52   yield undefined;
    53 }
    55 this.runTest = function() {
    56   do_get_profile();
    58   do_test_pending();
    59   testGenerator.next();
    60 }

mercurial