Firefox addon 类似浏览器工具箱的远程连接
我正在尝试与另一个开放的配置文件交互,这是一个独立的过程。浏览器工具箱可以做到这一点。我想知道如何重新模拟这种行为?没有提示询问“允许远程连接”Firefox addon 类似浏览器工具箱的远程连接,firefox-addon,Firefox Addon,我正在尝试与另一个开放的配置文件交互,这是一个独立的过程。浏览器工具箱可以做到这一点。我想知道如何重新模拟这种行为?没有提示询问“允许远程连接” 我的目标是(1)找到所有打开的firefox进程,(2)访问其每个xpcom并找出配置文件名,(3)如果它是我感兴趣的配置文件名,我将关注它的最新窗口。我不知道,但通过在MXR中跟踪它,我会有所收获: 我运行了配置文件,它看起来像pref.-host是localhost和.-port是6080。不过,我不确定这如何有助于针对特定的个人资料。也许在浏览
我的目标是(1)找到所有打开的firefox进程,(2)访问其每个xpcom并找出配置文件名,(3)如果它是我感兴趣的配置文件名,我将关注它的最新窗口。我不知道,但通过在MXR中跟踪它,我会有所收获: 我运行了配置文件,它看起来像pref
.-host
是localhost
和.-port
是6080
。不过,我不确定这如何有助于针对特定的个人资料。也许在浏览器工具箱启动时,它将端口6080打开到打开器配置文件。我不确定,但如果它是真的,那么您必须从目标配置文件中运行代码来打开端口
但我完全不确定
但这里的港口是开放的:
哦,看起来是这样的。理想情况下,我正在寻找一种单向的方式,在这种方式下,我不必从另一个配置文件运行代码来允许从其他配置文件进行连接。
11 let { debuggerSocketConnect, DebuggerClient } =
12 Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
13 let { ViewHelpers } =
14 Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});
15
16 /**
17 * Shortcuts for accessing various debugger preferences.
18 */
19 let Prefs = new ViewHelpers.Prefs("devtools.debugger", {
20 chromeDebuggingHost: ["Char", "chrome-debugging-host"],
21 chromeDebuggingPort: ["Int", "chrome-debugging-port"]
22 });
23
24 let gToolbox, gClient;
25
26 function connect() {
27 window.removeEventListener("load", connect);
28 // Initiate the connection
29 let transport = debuggerSocketConnect(
30 Prefs.chromeDebuggingHost,
31 Prefs.chromeDebuggingPort
32 );
33 gClient = new DebuggerClient(transport);
34 gClient.connect(() => {
35 let addonID = getParameterByName("addonID");
36
37 if (addonID) {
38 gClient.listAddons(({addons}) => {
39 let addonActor = addons.filter(addon => addon.id === addonID).pop();
40 openToolbox({ addonActor: addonActor.actor, title: addonActor.name });
41 });
42 } else {
43 gClient.listTabs(openToolbox);
44 }
45 });
46 }
47
106
107 BrowserToolboxProcess.prototype = {
108 /**
109 * Initializes the debugger server.
110 */
111 _initServer: function() {
112 dumpn("Initializing the chrome toolbox server.");
113
114 if (!this.loader) {
115 // Create a separate loader instance, so that we can be sure to receive a
116 // separate instance of the DebuggingServer from the rest of the devtools.
117 // This allows us to safely use the tools against even the actors and
118 // DebuggingServer itself, especially since we can mark this loader as
119 // invisible to the debugger (unlike the usual loader settings).
120 this.loader = new DevToolsLoader();
121 this.loader.invisibleToDebugger = true;
122 this.loader.main("devtools/server/main");
123 this.debuggerServer = this.loader.DebuggerServer;
124 dumpn("Created a separate loader instance for the DebuggerServer.");
125
126 // Forward interesting events.
127 this.debuggerServer.on("connectionchange", this.emit.bind(this));
128 }
129
130 if (!this.debuggerServer.initialized) {
131 this.debuggerServer.init();
132 this.debuggerServer.addBrowserActors();
133 dumpn("initialized and added the browser actors for the DebuggerServer.");
134 }
135
136 this.debuggerServer.openListener(Prefs.chromeDebuggingPort);
137
138 dumpn("Finished initializing the chrome toolbox server.");
139 dumpn("Started listening on port: " + Prefs.chromeDebuggingPort);
140 },
141