head.js (951B)
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 /* eslint no-unused-vars: [2, {"vars": "local"}] */ 8 9 Services.scriptloader.loadSubScript( 10 "chrome://mochitests/content/browser/devtools/client/shared/test/shared-head.js", 11 this 12 ); 13 14 const { 15 DevToolsClient, 16 } = require("resource://devtools/client/devtools-client.js"); 17 const { 18 DevToolsServer, 19 } = require("resource://devtools/server/devtools-server.js"); 20 21 async function createLocalClient() { 22 // Instantiate a minimal server 23 DevToolsServer.init(); 24 DevToolsServer.allowChromeProcess = true; 25 if (!DevToolsServer.createRootActor) { 26 DevToolsServer.registerAllActors(); 27 } 28 const transport = DevToolsServer.connectPipe(); 29 const client = new DevToolsClient(transport); 30 await client.connect(); 31 return client; 32 }