browser_dbg-chrome-create.js (1914B)
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 /** 6 * Tests that a chrome debugger can be created in a new process. 7 */ 8 9 "use strict"; 10 11 // There are shutdown issues for which multiple rejections are left uncaught. 12 // See bug 1018184 for resolving these issues. 13 PromiseTestUtils.allowMatchingRejectionsGlobally(/File closed/); 14 PromiseTestUtils.allowMatchingRejectionsGlobally(/NS_ERROR_FAILURE/); 15 16 // This test can be slow to run 17 requestLongerTimeout(5); 18 19 const { BrowserToolboxLauncher } = ChromeUtils.importESModule( 20 "resource://devtools/client/framework/browser-toolbox/Launcher.sys.mjs" 21 ); 22 23 add_task(async function () { 24 await pushPref("devtools.chrome.enabled", true); 25 await pushPref("devtools.debugger.remote-enabled", true); 26 27 info("Call BrowserToolboxLauncher.init"); 28 const [browserToolboxLauncher, process, profilePath] = await new Promise( 29 resolve => { 30 BrowserToolboxLauncher.init({ 31 onRun: (btl, dbgProcess, dbgProfilePath) => { 32 info("Browser toolbox process started successfully."); 33 resolve([btl, dbgProcess, dbgProfilePath]); 34 }, 35 }); 36 } 37 ); 38 39 ok(process, "The remote debugger process was created"); 40 Assert.equal( 41 process.exitCode, 42 null, 43 "The remote debugger process is running" 44 ); 45 is( 46 typeof process.pid, 47 "number", 48 `The remote debugger process has a proper pid (${process.pid})` 49 ); 50 51 is( 52 profilePath, 53 PathUtils.join(PathUtils.profileDir, "chrome_debugger_profile"), 54 `The remote debugger profile has the expected path` 55 ); 56 57 info("Close the browser toolbox"); 58 await browserToolboxLauncher.close(); 59 60 is( 61 process.exitCode, 62 Services.appinfo.OS == "WINNT" ? -9 : -15, 63 "The remote debugger process died cleanly" 64 ); 65 });