mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 1579042
- Rename FrameTargetProxyActor to TabDescriptorActor r=ochameau
Differential Revision: https://phabricator.services.mozilla.com/D63498 --HG-- rename : devtools/server/actors/targets/frame-proxy.js => devtools/server/actors/descriptors/tab.js extra : moz-landing-system : lando
This commit is contained in:
parent
a6f782307d
commit
fef1bfd954
@ -52,7 +52,7 @@ and returns its `actorID`. That's the main role of RootActor.
|
||||
```
|
||||
RootActor (root.js)
|
||||
|
|
||||
|-- FrameTargetActorProxy (frame-proxy.js)
|
||||
|-- TabDescriptorActor (descriptors/tab.js)
|
||||
| Targets frames (such as a tab) living in the parent or child process.
|
||||
| Note that this is just a proxy for FrameTargetActor, which is loaded via
|
||||
| the frame's message manager as a frame script in the process containing
|
||||
|
@ -7,6 +7,7 @@
|
||||
DevToolsModules(
|
||||
'frame.js',
|
||||
'process.js',
|
||||
'tab.js',
|
||||
'webextension.js',
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Target actor proxy that represents a frame / docShell in the parent process. It
|
||||
* Descriptor Actor that represents a Tab in the parent process. It
|
||||
* launches a FrameTargetActor in the content process to do the real work and tunnels the
|
||||
* data.
|
||||
*
|
||||
@ -15,7 +15,6 @@
|
||||
const {
|
||||
connectToFrame,
|
||||
} = require("devtools/server/connectors/frame-connector");
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
|
||||
loader.lazyImporter(
|
||||
this,
|
||||
@ -35,28 +34,19 @@ const { AppConstants } = require("resource://gre/modules/AppConstants.jsm");
|
||||
* @param options
|
||||
* - {Boolean} favicons: true if the form should include the favicon for the tab.
|
||||
*/
|
||||
// As this proxy is returned by RootActor.listTabs, it has to be inheriting from Actor
|
||||
// class in order to be correctly marshalled by protocol.js.
|
||||
// This is related to this very particular check in protocol.js:
|
||||
// https://searchfox.org/mozilla-central/rev/b243debf6235b050b42fd2eb615fdc729636ca6b/devtools/shared/protocol/types.js#354-367
|
||||
// But this isn't a real Actor. Only `form()` method is being called when protocol.js
|
||||
// marshall the proxy. We also register the proxy into Pools and so `typeName`
|
||||
// as well as `actorID` attributes are being used in this process.
|
||||
const proxySpec = protocol.generateActorSpec({
|
||||
typeName: "frameTargetProxy",
|
||||
methods: {},
|
||||
events: {},
|
||||
});
|
||||
exports.FrameTargetActorProxy = protocol.ActorClassWithSpec(proxySpec, {
|
||||
initialize: function(conn, browser, options = {}) {
|
||||
protocol.Actor.prototype.initialize.call(this, conn);
|
||||
function TabDescriptorActor(connection, browser, options = {}) {
|
||||
this._conn = connection;
|
||||
this._browser = browser;
|
||||
this._form = null;
|
||||
this.exited = false;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
this._conn = conn;
|
||||
this._browser = browser;
|
||||
this._form = null;
|
||||
this.exited = false;
|
||||
this.options = options;
|
||||
},
|
||||
TabDescriptorActor.prototype = {
|
||||
// As these proxies are added to pools, they are considered as actors and should have
|
||||
// a prefix set, even if that's never really used. TabDescriptorActor's actorID is going
|
||||
// to be used in form().
|
||||
actorPrefix: "tabDescriptor",
|
||||
|
||||
async connect() {
|
||||
const onDestroy = () => {
|
||||
@ -64,8 +54,7 @@ exports.FrameTargetActorProxy = protocol.ActorClassWithSpec(proxySpec, {
|
||||
// Reject the update promise if the tab was destroyed while requesting an update
|
||||
this._deferredUpdate.reject({
|
||||
error: "tabDestroyed",
|
||||
message:
|
||||
"Tab destroyed while performing a FrameTargetActorProxy update",
|
||||
message: "Tab destroyed while performing a TabDescriptorActor update",
|
||||
});
|
||||
}
|
||||
this.exit();
|
||||
@ -116,10 +105,10 @@ exports.FrameTargetActorProxy = protocol.ActorClassWithSpec(proxySpec, {
|
||||
|
||||
/**
|
||||
* @param {Object} options
|
||||
* See FrameTargetActorProxy constructor.
|
||||
* See TabDescriptorActor constructor.
|
||||
*/
|
||||
async update(options = {}) {
|
||||
// Update the FrameTargetActorProxy options.
|
||||
// Update the TabDescriptorActor options.
|
||||
this.options = options;
|
||||
|
||||
// If the child happens to be crashed/close/detach, it won't have _form set,
|
||||
@ -252,4 +241,6 @@ exports.FrameTargetActorProxy = protocol.ActorClassWithSpec(proxySpec, {
|
||||
this._form = null;
|
||||
this.exited = true;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
exports.TabDescriptorActor = TabDescriptorActor;
|
@ -8,7 +8,6 @@ DevToolsModules(
|
||||
'browsing-context.js',
|
||||
'chrome-window.js',
|
||||
'content-process.js',
|
||||
'frame-proxy.js',
|
||||
'frame.js',
|
||||
'parent-process.js',
|
||||
'webextension.js',
|
||||
|
@ -18,8 +18,8 @@ loader.lazyRequireGetter(
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"FrameTargetActorProxy",
|
||||
"devtools/server/actors/targets/frame-proxy",
|
||||
"TabDescriptorActor",
|
||||
"devtools/server/actors/descriptors/tab",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
@ -110,7 +110,7 @@ exports.createRootActor = function createRootActor(connection) {
|
||||
};
|
||||
|
||||
/**
|
||||
* A live list of FrameTargetActorProxys representing the current browser tabs,
|
||||
* A live list of TabDescriptorActors representing the current browser tabs,
|
||||
* to be provided to the root actor to answer 'listTabs' requests.
|
||||
*
|
||||
* This object also takes care of listening for TabClose events and
|
||||
@ -345,7 +345,7 @@ BrowserTabList.prototype.getList = function(browserActorOptions) {
|
||||
};
|
||||
|
||||
/**
|
||||
* @param browserActorOptions see options argument of FrameTargetActorProxy constructor.
|
||||
* @param browserActorOptions see options argument of TabDescriptorActor constructor.
|
||||
*/
|
||||
BrowserTabList.prototype._getActorForBrowser = function(
|
||||
browser,
|
||||
@ -358,7 +358,7 @@ BrowserTabList.prototype._getActorForBrowser = function(
|
||||
return actor.update(browserActorOptions);
|
||||
}
|
||||
|
||||
actor = new FrameTargetActorProxy(
|
||||
actor = new TabDescriptorActor(
|
||||
this._connection,
|
||||
browser,
|
||||
browserActorOptions
|
||||
@ -468,7 +468,7 @@ BrowserTabList.prototype._handleActorClose = function(actor, browser) {
|
||||
if (this._testing) {
|
||||
if (this._actorByBrowser.get(browser) !== actor) {
|
||||
throw new Error(
|
||||
"FrameTargetActorProxy not stored in map under given browser"
|
||||
"TabDescriptorActor not stored in map under given browser"
|
||||
);
|
||||
}
|
||||
if (actor.browser !== browser) {
|
||||
|
Loading…
Reference in New Issue
Block a user