Skip to content
Browse files

Support for actors coming from extensions

  • Loading branch information...
1 parent e92139c commit 38602d099f4e33dc0ee92343a7910523f0b41a2b @janodvarko janodvarko committed
View
16 extension/bootstrap.js
@@ -158,9 +158,19 @@ function loadServer()
{
if (serverMode)
{
- Services.scriptloader.loadSubScript(
- "chrome://firebug/content/server/main.js",
- serverScope);
+ var event =
+ {
+ notify: function(timer)
+ {
+ Services.scriptloader.loadSubScript(
+ "chrome://firebug/content/server/main.js",
+ serverScope);
+ }
+ }
+
+ // xxxHonza: hack, must be removed.
+ var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+ timer.initWithCallback(event, 2000, Ci.nsITimer.TYPE_ONE_SHOT);
}
}
catch (e)
View
36 extension/content/firebug/debugger/commands.js
@@ -9,6 +9,9 @@ function(FBTrace, RDP) {
// ********************************************************************************************* //
// Constants
+// ********************************************************************************************* //
+// Command Implementation
+
function pauseGrip(context, args)
{
var actor = args[0];
@@ -44,6 +47,34 @@ function pauseGrip(context, args)
return Firebug.Console.getDefaultReturnValue(context.window);
}
+function tabGrip(context, args)
+{
+ var actor = args[0];
+ var type = args[1];
+
+ var context = Firebug.currentContext;
+ if (!context)
+ return "No current context";
+
+ if (!actor)
+ return "No actor specified";
+
+ if (!type)
+ return "No type specified";
+
+ var packet = {
+ to: actor,
+ type: type
+ };
+
+ Firebug.proxy.connection.request(packet, function(response)
+ {
+ Firebug.Console.log(response);
+ });
+
+ return Firebug.Console.getDefaultReturnValue(context.window);
+}
+
// ********************************************************************************************* //
// Registration
@@ -52,6 +83,11 @@ Firebug.registerCommand("pauseGrip", {
description: "Helper command for accessing server side Grips. For debugging purposes only."
})
+Firebug.registerCommand("tabGrip", {
+ handler: tabGrip.bind(this),
+ description: "Helper command for accessing server side tab child Grips. For debugging purposes only."
+})
+
return {};
// ********************************************************************************************* //
View
10 extension/content/firebug/moduleConfig.js
@@ -1,5 +1,9 @@
/* See license.txt for terms of usage */
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
var EXPORTED_SYMBOLS = ["Firebug"];
var Firebug = Firebug || {};
@@ -118,10 +122,12 @@ Firebug.registerExtension = function(extName, extConfig)
//config.paths[extName] = extName + "/content";
config.paths[extName] = "chrome://" + extName + "/content";
+ var main = extConfig.main ? extConfig.main : "main";
+
// Load main.js module (the entry point of the extension) and support for tracing.
// All other extension modules should be loaded within "main" module.
Firebug.require(config, [
- extName + "/main",
+ extName + "/" + main,
"firebug/lib/trace"
],
function(Extension, FBTrace)
@@ -130,7 +136,7 @@ Firebug.registerExtension = function(extName, extConfig)
{
extConfig.app = Extension;
- // Extension intialization procedure should be within this method (in main.js).
+ // Extension initialization procedure should be within this method (in main.js).
if (Extension.initialize)
Extension.initialize();
View
12 extension/content/firebug/remoting/connection.js
@@ -57,14 +57,14 @@ Connection.prototype =
host = host || Options.get("serverHost");
port = port || Options.get("serverPort");
- // Initialize the server to allow connections throug pipe transport.
+ // Initialize the server to allow connections through pipe transport.
if (this.local)
{
DebuggerServer.init(function () { return true; });
DebuggerServer.addBrowserActors();
}
- // This objet should be probably created somewhere else and passed as an argument
+ // This object should be probably created somewhere else and passed as an argument
// to this method. Depending on whether Firebug want to connect remote browser
// instance or the one it's running within.
this.transport = this.local ? DebuggerServer.connectPipe() :
@@ -211,7 +211,15 @@ Connection.prototype =
this.pendingRequests = this.pendingRequests.filter(function(request)
{
if (request.to in self.activeRequests)
+ {
+ if (FBTrace.DBG_CONNECTION)
+ {
+ FBTrace.sysout("connection.send; already active request " +
+ JSON.stringify(request), {newrequest: request, oldrequest:
+ self.activeRequests[request.to]});
+ }
return true;
+ }
self.activeRequests[request.to] = request;
View
9 extension/content/firebug/server/main.js
@@ -9,10 +9,15 @@ var require = Cu.import("resource://firebug/mini-require.js").require;
var Firebug = Cu.import("chrome://firebug/content/moduleConfig.js", {}).Firebug;
+// Expose require also in the server mode (extensions might also need it).
+Firebug.require = require;
+
// xxxHonza: get the same config as Firebug uses, but what about the
// stuff in firebug main? It should be moved into the config I guess.
var config = Firebug.getModuleLoaderConfig();
+Cu.import("resource://firebug/loader.js");
+
/**
* Load server
*/
@@ -45,6 +50,10 @@ try
// consoleService.logStringMessage("FirebugServer; Running at port: 2929");
//});
+ // xxxHonza: TODO find a better place for notifying extensions
+ // This is where Firebug extension can perform server mode initialization steps.
+ FirebugLoader.dispatchToScopes("firebugServerLoad", [Firebug, Server]);
+
// Set back-reference for the bootstrap.js so, shutdown can be sent to the Server object.
scope.FirebugServer = Server;
}
View
2 extension/content/firebug/server/server.js
@@ -59,7 +59,7 @@ var Server =
},
/**
- * Just for debuggin purposes only. Hook server side packet communication
+ * Just for debugging purposes only. Hook server side packet communication
* and log it into the tracing console.
*/
hookPackets: function()

0 comments on commit 38602d0

Please sign in to comment.
Something went wrong with that request. Please try again.