Bug 937172 - Add RemoteBrowserTabActor for e10s debugging (r=past)

This commit is contained in:
Bill McCloskey 2014-03-10 09:38:34 -07:00
Родитель 44cb1ef8c9
Коммит ed4e523f62
1 изменённых файлов: 42 добавлений и 1 удалений

Просмотреть файл

@ -217,6 +217,8 @@ BrowserTabList.prototype.getList = function() {
// the actors. Thus, the sequence yielded is always a snapshot of the
// actors that were live when we began the iteration.
let actorPromises = [];
// Iterate over all navigator:browser XUL windows.
for (let win of allAppShellDOMWindows(DebuggerServer.chromeWindowType)) {
let selectedBrowser = this._getSelectedBrowser(win);
@ -232,10 +234,20 @@ BrowserTabList.prototype.getList = function() {
// Do we have an existing actor for this browser? If not, create one.
let actor = this._actorByBrowser.get(browser);
if (actor) {
actorPromises.push(promise.resolve(actor));
foundCount++;
} else if (browser.isRemoteBrowser) {
actor = new RemoteBrowserTabActor(this._connection, browser);
this._actorByBrowser.set(browser, actor);
let promise = actor.connect().then((form) => {
actor._form = form;
return actor;
});
actorPromises.push(promise);
} else {
actor = new BrowserTabActor(this._connection, browser, win.gBrowser);
this._actorByBrowser.set(browser, actor);
actorPromises.push(promise.resolve(actor));
}
// Set the 'selected' properties on all actors correctly.
@ -249,7 +261,7 @@ BrowserTabList.prototype.getList = function() {
this._mustNotify = true;
this._checkListening();
return promise.resolve([actor for ([_, actor] of this._actorByBrowser)]);
return promise.all(actorPromises);
};
Object.defineProperty(BrowserTabList.prototype, 'onListChanged', {
@ -993,6 +1005,35 @@ BrowserTabActor.prototype.exit = function() {
this._tabbrowser = null;
};
/**
* This actor is a shim that connects to a ContentActor in a remote
* browser process. All RDP packets get forwarded using the message
* manager.
*
* @param aConnection The main RDP connection.
* @param aBrowser XUL <browser> element to connect to.
*/
function RemoteBrowserTabActor(aConnection, aBrowser)
{
this._conn = aConnection;
this._browser = aBrowser;
this._form = null;
}
RemoteBrowserTabActor.prototype = {
connect: function() {
return DebuggerServer.connectToChild(this._conn, this._browser.messageManager);
},
form: function() {
return this._form;
},
exit: function() {
this._browser = null;
},
};
function BrowserAddonList(aConnection)
{
this._connection = aConnection;