Bug 1467565 - Replace all remaining actorPrefix properties. r=ochameau.

With all our actors supporting protocol.js, we can remove
support for the pre-protocol.js actorPrefix property.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2020-03-16 17:37:00 +00:00
Родитель 44f13d14ef
Коммит 0c09b836d2
7 изменённых файлов: 14 добавлений и 21 удалений

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

@ -33,7 +33,7 @@ add_task(async function() {
ok(globalActor, "Found the test global actor.");
ok(
globalActor.includes("testOne"),
"testGlobalActor1's actorPrefix should be used."
"testGlobalActor1's typeName should be used."
);
response = await client.request({ to: globalActor, type: "ping" });
@ -49,10 +49,10 @@ add_task(async function() {
DevToolsServer._connections
)) {
const conn = DevToolsServer._connections[connID];
const actorPrefix = conn._prefix + "testOne";
const computedPrefix = conn._prefix + "testOne";
for (const pool of conn._extraPools) {
for (const actor of pool.poolChildren()) {
if (actor.actorID.startsWith(actorPrefix)) {
if (actor.actorID.startsWith(computedPrefix)) {
count++;
}
}

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

@ -33,7 +33,7 @@ async function testTargetScopedActor(client, form) {
ok(form.testOneActor, "Found the test target-scoped actor.");
ok(
form.testOneActor.includes("testOne"),
"testOneActor's actorPrefix should be used."
"testOneActor's typeName should be used."
);
const response = await client.request({

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

@ -33,7 +33,7 @@ async function testTargetScopedActor(client, form) {
ok(form.testOneActor, "Found the test target-scoped actor.");
ok(
form.testOneActor.includes("testOne"),
"testOneActor's actorPrefix should be used."
"testOneActor's typeName should be used."
);
const response = await client.request({

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

@ -39,15 +39,10 @@ ActorPool.prototype = {
addActor: function APAddActor(actor) {
actor.conn = this.conn;
if (!actor.actorID) {
// Older style actors use actorPrefix, while protocol.js-based actors use typeName
const prefix = actor.actorPrefix || actor.typeName;
if (!prefix) {
throw new Error(
"Actor should precify either `actorPrefix` or `typeName` " +
"attribute"
);
if (!actor.typeName) {
throw new Error("Actor should a specify a `typeName` attribute");
}
actor.actorID = this.conn.allocID(prefix || undefined);
actor.actorID = this.conn.allocID(actor.typeName);
}
// If the actor is already in a pool, remove it without destroying it.

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

@ -2063,7 +2063,7 @@ function PauseActor(pool) {
}
PauseActor.prototype = {
actorPrefix: "pause",
typeName: "pause",
};
// Utility functions.

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

@ -278,9 +278,8 @@ const ActorRegistry = {
/**
* Registers handlers for new target-scoped request types defined dynamically.
*
* Note that the name or actorPrefix of the request type is not allowed to clash with
* existing protocol packet properties, like 'title', 'url' or 'actor', since that would
* break the protocol.
* Note that the name of the request type is not allowed to clash with existing protocol
* packet properties, like 'title', 'url' or 'actor', since that would break the protocol.
*
* @param options object
* - constructorName: (required)
@ -350,9 +349,8 @@ const ActorRegistry = {
/**
* Registers handlers for new browser-scoped request types defined dynamically.
*
* Note that the name or actorPrefix of the request type is not allowed to clash with
* existing protocol packet properties, like 'from', 'tabs' or 'selected', since that
* would break the protocol.
* Note that the name of the request type is not allowed to clash with existing protocol
* packet properties, like 'from', 'tabs' or 'selected', since that would break the protocol.
*
* @param options object
* - constructorName: (required)

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

@ -68,7 +68,7 @@ class Pool extends EventEmitter {
*/
manage(actor) {
if (!actor.actorID) {
actor.actorID = this.conn.allocID(actor.actorPrefix || actor.typeName);
actor.actorID = this.conn.allocID(actor.typeName);
} else {
// If the actor is already registered in a pool, remove it without destroying it.
// This happens for example when an addon is reloaded. To see this behavior, take a