зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1172897 - Rename BrowserTabActor to FrameTargetActorProxy. r=ochameau
MozReview-Commit-ID: 4Lho3CLV1t8 --HG-- rename : devtools/server/actors/browser-tab.js => devtools/server/actors/targets/frame-proxy.js extra : rebase_source : e8d4db9cc6dbd4e301cc4bc39568027a94f16c53
This commit is contained in:
Родитель
ff819eb8ce
Коммит
420ead8490
|
@ -52,26 +52,27 @@ and returns its `actorID`. That's the main role of RootActor.
|
|||
```
|
||||
RootActor (root.js)
|
||||
|
|
||||
|-- BrowserTabActor (webbrowser.js)
|
||||
| Targets tabs living in the parent or child process. Note that this is
|
||||
| just a proxy for FrameTargetActor, which is loaded via the tab's message
|
||||
| manager as a frame script in the process containing the tab. This proxy
|
||||
| via message manager is always used, even when e10s is disabled.
|
||||
|-- FrameTargetActorProxy (frame-proxy.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
|
||||
| the frame content. This proxy via message manager is always used, even
|
||||
| when the content happens to be in the same process.
|
||||
| Returned by "listTabs" or "getTab" requests.
|
||||
| |
|
||||
| \-- FrameTargetActor (frame.js)
|
||||
| The "real" target actor for a frame (such as a tab) which runs in
|
||||
| whichever process holds the content. BrowserTabActor communicates
|
||||
| with this via the frame's message manager.
|
||||
| whichever process holds the content. FrameTargetActorProxy
|
||||
| communicates with this via the frame's message manager.
|
||||
| Extends the abstract class BrowsingContextTargetActor.
|
||||
| Returned by "connect" on BrowserTabActor.
|
||||
| Returned by "connect" on FrameTargetActorProxy.
|
||||
|
|
||||
|-- WorkerActor (worker.js)
|
||||
| Targets a worker (applies to various kinds like web worker, service
|
||||
| worker, etc.).
|
||||
| Returned by "listWorkers" request to the root actor to get all workers.
|
||||
| Returned by "listWorkers" request to a BrowserTabActor to get workers for
|
||||
| a specific tab.
|
||||
| Returned by "listWorkers" request to a FrameTargetActorProxy to get
|
||||
| workers for a specific frame.
|
||||
| Returned by "listWorkers" request to a ChildProcessActor to get workers
|
||||
| for the chrome of the child process.
|
||||
|
|
||||
|
|
|
@ -105,8 +105,8 @@ ObservedActorFactory.prototype.createActor = function() {
|
|||
};
|
||||
exports.ObservedActorFactory = ObservedActorFactory;
|
||||
|
||||
/**
|
||||
* Methods shared between RootActor and BrowserTabActor.
|
||||
/*
|
||||
* Methods shared between RootActor and BrowsingContextTargetActor.
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -125,8 +125,8 @@ exports.ObservedActorFactory = ObservedActorFactory;
|
|||
* documented for addTabActor and addGlobalActor.
|
||||
*
|
||||
* @param this
|
||||
* The BrowserRootActor or BrowserTabActor with which the new actors will
|
||||
* be associated. It should support whatever API the |factories|
|
||||
* The RootActor or BrowsingContextTargetActor with which the new actors
|
||||
* will be associated. It should support whatever API the |factories|
|
||||
* constructor functions might be interested in, as it is passed to them.
|
||||
* For the sake of CommonCreateExtraActors itself, it should have at least
|
||||
* the following properties:
|
||||
|
@ -173,7 +173,7 @@ exports.createExtraActors = function createExtraActors(factories, pool) {
|
|||
* CommonCreateExtraActors.
|
||||
*
|
||||
* @param this
|
||||
* The BrowserRootActor or BrowserTabActor whose |_extraActors| table we
|
||||
* The RootActor or BrowsingContextTargetActor whose |_extraActors| table we
|
||||
* should use; see above.
|
||||
*/
|
||||
exports.appendExtraActors = function appendExtraActors(object) {
|
||||
|
|
|
@ -27,7 +27,6 @@ DevToolsModules(
|
|||
'animation.js',
|
||||
'array-buffer.js',
|
||||
'breakpoint.js',
|
||||
'browser-tab.js',
|
||||
'call-watcher.js',
|
||||
'canvas.js',
|
||||
'child-process.js',
|
||||
|
|
|
@ -4,11 +4,19 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
* Target actor proxy that represents a frame / docShell in the parent process. It
|
||||
* launches a FrameTargetActor in the content process to do the real work and tunnels the
|
||||
* data.
|
||||
*
|
||||
* See devtools/docs/backend/actor-hierarchy.md for more details.
|
||||
*/
|
||||
|
||||
const { DebuggerServer } = require("devtools/server/main");
|
||||
loader.lazyImporter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm");
|
||||
|
||||
/**
|
||||
* Creates a target actor for handling requests to a single browser frame.
|
||||
* Creates a target actor proxy for handling requests to a single browser frame.
|
||||
* Both <xul:browser> and <iframe mozbrowser> are supported.
|
||||
* This actor is a shim that connects to a FrameTargetActor in a remote browser process.
|
||||
* All RDP packets get forwarded using the message manager.
|
||||
|
@ -18,7 +26,7 @@ loader.lazyImporter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm
|
|||
* @param options
|
||||
* - {Boolean} favicons: true if the form should include the favicon for the tab.
|
||||
*/
|
||||
function BrowserTabActor(connection, browser, options = {}) {
|
||||
function FrameTargetActorProxy(connection, browser, options = {}) {
|
||||
this._conn = connection;
|
||||
this._browser = browser;
|
||||
this._form = null;
|
||||
|
@ -26,14 +34,14 @@ function BrowserTabActor(connection, browser, options = {}) {
|
|||
this.options = options;
|
||||
}
|
||||
|
||||
BrowserTabActor.prototype = {
|
||||
FrameTargetActorProxy.prototype = {
|
||||
async connect() {
|
||||
const onDestroy = () => {
|
||||
if (this._deferredUpdate) {
|
||||
// Reject the update promise if the tab was destroyed while requesting an update
|
||||
this._deferredUpdate.reject({
|
||||
error: "tabDestroyed",
|
||||
message: "Tab destroyed while performing a BrowserTabActor update"
|
||||
message: "Tab destroyed while performing a FrameTargetActorProxy update"
|
||||
});
|
||||
}
|
||||
this.exit();
|
||||
|
@ -75,10 +83,10 @@ BrowserTabActor.prototype = {
|
|||
|
||||
/**
|
||||
* @param {Object} options
|
||||
* See BrowserTabActor constructor.
|
||||
* See FrameTargetActorProxy constructor.
|
||||
*/
|
||||
async update(options = {}) {
|
||||
// Update the BrowserTabActor options.
|
||||
// Update the FrameTargetActorProxy options.
|
||||
this.options = options;
|
||||
|
||||
// If the child happens to be crashed/close/detach, it won't have _form set,
|
||||
|
@ -172,4 +180,4 @@ BrowserTabActor.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
exports.BrowserTabActor = BrowserTabActor;
|
||||
exports.FrameTargetActorProxy = FrameTargetActorProxy;
|
|
@ -6,5 +6,6 @@
|
|||
|
||||
DevToolsModules(
|
||||
'browsing-context.js',
|
||||
'frame-proxy.js',
|
||||
'frame.js',
|
||||
)
|
||||
|
|
|
@ -12,7 +12,7 @@ var { DebuggerServer } = require("devtools/server/main");
|
|||
var DevToolsUtils = require("devtools/shared/DevToolsUtils");
|
||||
|
||||
loader.lazyRequireGetter(this, "RootActor", "devtools/server/actors/root", true);
|
||||
loader.lazyRequireGetter(this, "BrowserTabActor", "devtools/server/actors/browser-tab", true);
|
||||
loader.lazyRequireGetter(this, "FrameTargetActorProxy", "devtools/server/actors/targets/frame-proxy", true);
|
||||
loader.lazyRequireGetter(this, "BrowserAddonActor", "devtools/server/actors/addon", true);
|
||||
loader.lazyRequireGetter(this, "WebExtensionParentActor", "devtools/server/actors/webextension-parent", true);
|
||||
loader.lazyRequireGetter(this, "WorkerActorList", "devtools/server/actors/worker-list", true);
|
||||
|
@ -84,11 +84,11 @@ function createRootActor(connection) {
|
|||
}
|
||||
|
||||
/**
|
||||
* A live list of BrowserTabActors representing the current browser tabs,
|
||||
* A live list of FrameTargetActorProxys 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
|
||||
* onCloseWindow notifications, and exiting the BrowserTabActors concerned.
|
||||
* onCloseWindow notifications, and exiting the target actors concerned.
|
||||
*
|
||||
* (See the documentation for RootActor for the definition of the "live
|
||||
* list" interface.)
|
||||
|
@ -230,9 +230,7 @@ BrowserTabList.prototype._getBrowsers = function* () {
|
|||
// Iterate over all navigator:browser XUL windows.
|
||||
for (const win of allAppShellDOMWindows(DebuggerServer.chromeWindowType)) {
|
||||
// For each tab in this XUL window, ensure that we have an actor for
|
||||
// it, reusing existing actors where possible. We actually iterate
|
||||
// over 'browser' XUL elements, and BrowserTabActor uses
|
||||
// browser.contentWindow as the debuggee global.
|
||||
// it, reusing existing actors where possible.
|
||||
for (const browser of this._getChildren(win)) {
|
||||
yield browser;
|
||||
}
|
||||
|
@ -309,7 +307,7 @@ BrowserTabList.prototype.getList = function(browserActorOptions) {
|
|||
};
|
||||
|
||||
/**
|
||||
* @param browserActorOptions see options argument of BrowserTabActor constructor.
|
||||
* @param browserActorOptions see options argument of FrameTargetActorProxy constructor.
|
||||
*/
|
||||
BrowserTabList.prototype._getActorForBrowser = function(browser, browserActorOptions) {
|
||||
// Do we have an existing actor for this browser? If not, create one.
|
||||
|
@ -319,7 +317,7 @@ BrowserTabList.prototype._getActorForBrowser = function(browser, browserActorOpt
|
|||
return actor.update(browserActorOptions);
|
||||
}
|
||||
|
||||
actor = new BrowserTabActor(this._connection, browser, browserActorOptions);
|
||||
actor = new FrameTargetActorProxy(this._connection, browser, browserActorOptions);
|
||||
this._actorByBrowser.set(browser, actor);
|
||||
this._checkListening();
|
||||
return actor.connect();
|
||||
|
@ -419,7 +417,7 @@ BrowserTabList.prototype._notifyListChanged = function() {
|
|||
BrowserTabList.prototype._handleActorClose = function(actor, browser) {
|
||||
if (this._testing) {
|
||||
if (this._actorByBrowser.get(browser) !== actor) {
|
||||
throw new Error("BrowserTabActor not stored in map under given browser");
|
||||
throw new Error("FrameTargetActorProxy not stored in map under given browser");
|
||||
}
|
||||
if (actor.browser !== browser) {
|
||||
throw new Error("actor's browser and map key don't match");
|
||||
|
|
|
@ -131,7 +131,7 @@ add_task(async function() {
|
|||
const { DebuggerServer } = require("devtools/server/main");
|
||||
const EventEmitter = require("devtools/shared/event-emitter");
|
||||
|
||||
// !Hack! Retrieve a server side object, the BrowserTabActor instance
|
||||
// !Hack! Retrieve a server side object, the FrameTargetActor instance
|
||||
const targetActor = DebuggerServer.searchAllConnectionsForActor(actorId);
|
||||
// In order to listen to internal will-navigate/navigate events
|
||||
EventEmitter.on(targetActor, "will-navigate", function(data) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче