helpers.js (873B)
1 /** 2 * Any copyright is dedicated to the Public Domain. 3 * http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 var testGenerator; 7 var testResult; 8 9 loadScript("dom/quota/test/common/nestedtest.js"); 10 11 function loadScript(path) { 12 const url = new URL(path, "chrome://mochitests/content/browser/"); 13 SpecialPowers.Services.scriptloader.loadSubScript(url.href, this); 14 } 15 16 function runTest() { 17 clearAllDatabases(() => { 18 testGenerator = testSteps(); 19 testGenerator.next(); 20 }); 21 } 22 23 function finishTestNow() { 24 if (testGenerator) { 25 testGenerator.return(); 26 testGenerator = undefined; 27 } 28 } 29 30 function finishTest() { 31 clearAllDatabases(() => { 32 setTimeout(finishTestNow, 0); 33 setTimeout(() => { 34 window.parent.postMessage(testResult, "*"); 35 }, 0); 36 }); 37 } 38 39 function continueToNextStep() { 40 setTimeout(() => { 41 testGenerator.next(); 42 }, 0); 43 }