browser_shutdown_scope_lifecycle.js (950B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 add_task(async function () { 8 // Create a11y service inside of the function scope. Its reference should be 9 // released once the anonimous function is called. 10 const [a11yInitObserver, a11yInit] = initAccService(); 11 await a11yInitObserver; 12 const a11yInitThenShutdown = a11yInit.then(async () => { 13 const [a11yShutdownObserver, a11yShutdown] = shutdownAccService(); 14 await a11yShutdownObserver; 15 return a11yShutdown; 16 }); 17 18 (function () { 19 let accService = Cc["@mozilla.org/accessibilityService;1"].getService( 20 Ci.nsIAccessibilityService 21 ); 22 ok(accService, "Service initialized"); 23 })(); 24 25 // Force garbage collection that should trigger shutdown. 26 forceGC(); 27 await a11yInitThenShutdown; 28 });