Bug 1570604 - Rename DebuggerClient.getActor to getFrontByID. r=jdescottes,yulia

Differential Revision: https://phabricator.services.mozilla.com/D40785

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-08-07 10:35:02 +00:00
Родитель 2b04f744b3
Коммит abb81825ef
9 изменённых файлов: 24 добавлений и 17 удалений

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

@ -55,11 +55,11 @@ const Actions = require("./index");
function isCachedActorNeeded(runtime, type, id) {
// Unique ids for workers were introduced in Firefox 68 (Bug 1539328). When debugging
// older browsers, the id falls back to the actor ID. Check if the target id is a worker
// actorID (which means getActor() should return an actor with id).
// actorID (which means getFrontByID() should return an actor with id).
// Can be removed when Firefox 68 is in Release channel.
return (
type === DEBUG_TARGETS.WORKER &&
runtime.runtimeDetails.clientWrapper.client.getActor(id)
runtime.runtimeDetails.clientWrapper.client.getFrontByID(id)
);
}

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

@ -20,9 +20,9 @@ add_task(async function() {
serviceWorkers: [],
sharedWorkers: [],
});
// Override getActor of client and getWorker function of root of client
// Override getFrontByID of client and getWorker function of root of client
// which is used in inspect action for worker.
thisFirefoxClient.client.getActor = id => null;
thisFirefoxClient.client.getFrontByID = id => null;
thisFirefoxClient.client.mainRoot = {
getWorker: id => {
return id === testWorker.id ? testWorker : null;

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

@ -109,7 +109,7 @@ async function assertOwnershipTrees(walker) {
// Verify that an actorID is inaccessible both from the client library and the server.
function checkMissing({ client }, actorID) {
return new Promise(resolve => {
const front = client.getActor(actorID);
const front = client.getFrontByID(actorID);
ok(
!front,
"Front shouldn't be accessible from the client for actorID: " + actorID

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

@ -588,7 +588,7 @@ DebuggerClient.prototype = {
// If we have a registered Front for this actor, let it handle the packet
// and skip all the rest of this unpleasantness.
const front = this.getActor(packet.from);
const front = this.getFrontByID(packet.from);
if (front) {
front.onPacket(packet);
return;
@ -635,7 +635,7 @@ DebuggerClient.prototype = {
// The code duplication here is intentional until we drop support for
// these versions. Once that happens this code can be deleted.
sendToDeprecatedThreadClient(packet) {
const deprecatedThreadClient = this.getActor(packet.from);
const deprecatedThreadClient = this.getFrontByID(packet.from);
if (deprecatedThreadClient && packet.type) {
const type = packet.type;
if (deprecatedThreadClient.events.includes(type)) {
@ -923,7 +923,13 @@ DebuggerClient.prototype = {
removeActorPool: function(pool) {
this._pools.delete(pool);
},
getActor: function(actorID) {
/**
* Return the Front for the Actor whose ID is the one passed in argument.
*
* @param {String} actorID: The actor ID to look for.
*/
getFrontByID: function(actorID) {
const pool = this.poolFor(actorID);
return pool ? pool.get(actorID) : null;
},

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

@ -34,7 +34,7 @@ class AnimationPlayerFront extends FrontClassWithSpec(animationPlayerSpec) {
return null;
}
return this.conn.getActor(this._form.animationTargetNodeActorID);
return this.conn.getFrontByID(this._form.animationTargetNodeActorID);
}
/**

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

@ -29,7 +29,7 @@ class FlexboxFront extends FrontClassWithSpec(flexboxSpec) {
return null;
}
return this.conn.getActor(this._form.containerNodeActorID);
return this.conn.getFrontByID(this._form.containerNodeActorID);
}
/**
@ -61,7 +61,7 @@ class FlexItemFront extends FrontClassWithSpec(flexItemSpec) {
return null;
}
return this.conn.getActor(this._form.nodeActorID);
return this.conn.getFrontByID(this._form.nodeActorID);
}
/**
@ -93,7 +93,7 @@ class GridFront extends FrontClassWithSpec(gridSpec) {
return null;
}
return this.conn.getActor(this._form.containerNodeActorID);
return this.conn.getFrontByID(this._form.containerNodeActorID);
}
/**

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

@ -168,15 +168,15 @@ class StyleRuleFront extends FrontClassWithSpec(styleRuleSpec) {
}
get parentRule() {
return this.conn.getActor(this._form.parentRule);
return this.conn.getFrontByID(this._form.parentRule);
}
get parentStyleSheet() {
return this.conn.getActor(this._form.parentStyleSheet);
return this.conn.getFrontByID(this._form.parentStyleSheet);
}
get element() {
return this.conn.getActor(this._form.element);
return this.conn.getFrontByID(this._form.element);
}
get href() {

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

@ -63,7 +63,7 @@ class MediaRuleFront extends FrontClassWithSpec(mediaRuleSpec) {
return this._form.column || -1;
}
get parentStyleSheet() {
return this.conn.getActor(this._form.parentStyleSheet);
return this.conn.getFrontByID(this._form.parentStyleSheet);
}
}

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

@ -314,7 +314,8 @@ types.addActorType = function(name) {
// existing front on the connection, and create the front
// if it isn't found.
const actorID = typeof v === "string" ? v : v.actor;
let front = ctx.conn.getActor(actorID);
// `ctx.conn` is a DebuggerClient
let front = ctx.conn.getFrontByID(actorID);
if (!front) {
// If front isn't instantiated yet, create one.
// Try lazy loading front if not already loaded.