From 376339dd820bcafb5ab20628f61b70b1d1da335b Mon Sep 17 00:00:00 2001 From: Panagiotis Astithas Date: Fri, 11 May 2012 19:04:43 +0300 Subject: [PATCH 1/3] Use the new extension API from bug 753401: https://bugzilla.mozilla.org/show_bug.cgi?id=753401 --- content/httpmonitor/remote/remoteProxy.js | 1 + content/httpmonitor/server/netMonitorActor.js | 2 +- content/httpmonitor/server/traceActor.js | 12 +----------- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/content/httpmonitor/remote/remoteProxy.js b/content/httpmonitor/remote/remoteProxy.js index cfd2378..7e150e4 100644 --- a/content/httpmonitor/remote/remoteProxy.js +++ b/content/httpmonitor/remote/remoteProxy.js @@ -28,6 +28,7 @@ RemoteProxy.prototype = Obj.extend(Proxy, this.protocol.getTabList(function(packet) { var result = []; + var networkMonitorActor = packet.networkMonitorActor; var tabs = packet.tabs; for (var i=0; i Date: Mon, 6 Aug 2012 21:45:44 +0300 Subject: [PATCH 2/3] Update to the latest debugger server API changes (bug 753401). --- content/httpmonitor/remote/connection.js | 2 +- content/httpmonitor/remote/protocol.js | 14 +---- content/httpmonitor/remote/remoteProxy.js | 5 +- content/httpmonitor/server/httpServer.js | 55 ++++++++++++------- content/httpmonitor/server/netMonitorActor.js | 25 +-------- content/httpmonitor/server/traceActor.js | 18 +----- 6 files changed, 45 insertions(+), 74 deletions(-) diff --git a/content/httpmonitor/remote/connection.js b/content/httpmonitor/remote/connection.js index f856c47..eb7ccbd 100644 --- a/content/httpmonitor/remote/connection.js +++ b/content/httpmonitor/remote/connection.js @@ -13,7 +13,7 @@ var Cu = Components.utils; try { - Cu["import"]("resource:///modules/devtools/dbg-client.jsm"); + Cu["import"]("resource://gre/modules/devtools/dbg-client.jsm"); } catch (err) { diff --git a/content/httpmonitor/remote/protocol.js b/content/httpmonitor/remote/protocol.js index d02a499..2be4f39 100644 --- a/content/httpmonitor/remote/protocol.js +++ b/content/httpmonitor/remote/protocol.js @@ -95,11 +95,6 @@ Protocol.prototype = return this.currentTab ? this.currentTab.actor : null; }, - getNetActor: function(tabActor, callback) - { - this.connection.sendPacket(tabActor, "networkMonitorActor", true, callback); - }, - subscribe: function(netActor, callback) { if (this.currentNetActor) @@ -139,13 +134,10 @@ Protocol.prototype = // A tab has been selected so, subscribe to the Net monitor actor. The callback // will receive events about any HTTP traffic within the target tab. - this.getNetActor(tabActor.id, function(packet) - { - self.subscribe(packet.actor, netEvent); + self.subscribe(tabActor.networkMonitorActor, netEvent); - // Also register callback for 'tabNavigated' events. - self.connection.addCallback(tabActor.id, tabNavigated, false); - }); + // Also register callback for 'tabNavigated' events. + self.connection.addCallback(tabActor.id, tabNavigated, false); }, onTabUnselected: function(tabActor) diff --git a/content/httpmonitor/remote/remoteProxy.js b/content/httpmonitor/remote/remoteProxy.js index d4a302e..5968c7a 100644 --- a/content/httpmonitor/remote/remoteProxy.js +++ b/content/httpmonitor/remote/remoteProxy.js @@ -25,10 +25,11 @@ RemoteProxy.prototype = Obj.extend(Proxy, if (FBTrace.DBG_REMOTENETMONITOR) FBTrace.sysout("remotenet; RemoteProxy.getTabs()"); + var self = this; this.protocol.getTabList(function(packet) { var result = []; - var networkMonitorActor = packet.networkMonitorActor; + self.protocol.traceActor = packet.traceActor; var tabs = packet.tabs; for (var i=0; i Date: Thu, 9 Aug 2012 18:28:10 +0300 Subject: [PATCH 3/3] Update the debugger server initialization code to account for bug 781515 --- content/httpmonitor/server/httpServer.js | 29 +----------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/content/httpmonitor/server/httpServer.js b/content/httpmonitor/server/httpServer.js index c5e4765..774e21b 100644 --- a/content/httpmonitor/server/httpServer.js +++ b/content/httpmonitor/server/httpServer.js @@ -56,7 +56,7 @@ var HttpServer = if (!DebuggerServer.initialized) { // Initialize the server (e.g. appends script debugger actors) - DebuggerServer.init(HttpServer._allowConnection); + DebuggerServer.init(); DebuggerServer.addBrowserActors(); } // Open a TCP listener @@ -75,33 +75,6 @@ var HttpServer = DebuggerServer.closeListener(); }, - - /** - * Prompt the user to accept or decline the incoming connection. - * - * @return true if the connection should be permitted, false otherwise - */ - _allowConnection: function() - { - let title = "Incoming Connection"; - let msg = "An incoming request to permit remote debugging connection was detected. A remote client can take complete control over your browser! Allow connection?"; - let disableButton = "Disable"; - let prompt = Services.prompt; - let flags = prompt.BUTTON_POS_0 * prompt.BUTTON_TITLE_OK + - prompt.BUTTON_POS_1 * prompt.BUTTON_TITLE_CANCEL + - prompt.BUTTON_POS_2 * prompt.BUTTON_TITLE_IS_STRING + - prompt.BUTTON_POS_1_DEFAULT; - let result = prompt.confirmEx(null, title, msg, flags, null, null, - disableButton, null, { value: false }); - if (result == 0) { - return true; - } - if (result == 2) { - DebuggerServer.closeListener(true); - Services.prefs.setBoolPref("devtools.debugger.remote-enabled", false); - } - return false; - }, } // ********************************************************************************************* //