1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/indexedDB/test/unit/GlobalObjectsChild.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,38 @@ 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 +function ok(cond, msg) { 1.10 + dump("ok(" + cond + ", \"" + msg + "\")"); 1.11 + do_check_true(!!cond, Components.stack.caller); 1.12 +} 1.13 + 1.14 +function finishTest() 1.15 +{ 1.16 + do_execute_soon(function() { 1.17 + do_test_finished(); 1.18 + }); 1.19 +} 1.20 + 1.21 +function run_test() { 1.22 + const name = "Splendid Test"; 1.23 + 1.24 + Cu.importGlobalProperties(["indexedDB"]); 1.25 + 1.26 + do_test_pending(); 1.27 + 1.28 + let keyRange = IDBKeyRange.only(42); 1.29 + ok(keyRange, "Got keyRange"); 1.30 + 1.31 + let request = indexedDB.open(name, 1); 1.32 + request.onerror = function(event) { 1.33 + ok(false, "indexedDB error, '" + event.target.error.name + "'"); 1.34 + finishTest(); 1.35 + } 1.36 + request.onsuccess = function(event) { 1.37 + let db = event.target.result; 1.38 + ok(db, "Got database"); 1.39 + finishTest(); 1.40 + } 1.41 +}