diff options
Diffstat (limited to 'devtools/shared/protocol')
-rw-r--r-- | devtools/shared/protocol/Actor.js | 4 | ||||
-rw-r--r-- | devtools/shared/protocol/Front.js | 2 | ||||
-rw-r--r-- | devtools/shared/protocol/Pool.js | 8 | ||||
-rw-r--r-- | devtools/shared/protocol/lazy-pool.js | 13 | ||||
-rw-r--r-- | devtools/shared/protocol/tests/xpcshell/test_protocol_async.js | 4 | ||||
-rw-r--r-- | devtools/shared/protocol/tests/xpcshell/test_protocol_children.js | 10 | ||||
-rw-r--r-- | devtools/shared/protocol/tests/xpcshell/test_protocol_longstring.js | 2 | ||||
-rw-r--r-- | devtools/shared/protocol/types.js | 4 |
8 files changed, 23 insertions, 24 deletions
diff --git a/devtools/shared/protocol/Actor.js b/devtools/shared/protocol/Actor.js index ea37f6fea2..bb8282335f 100644 --- a/devtools/shared/protocol/Actor.js +++ b/devtools/shared/protocol/Actor.js @@ -93,11 +93,9 @@ class Actor extends Pool { /** * Override this method in subclasses to serialize the actor. - * @param [optional] string hint - * Optional string to customize the form. * @returns A jsonable object. */ - form(hint) { + form() { return { actor: this.actorID }; } diff --git a/devtools/shared/protocol/Front.js b/devtools/shared/protocol/Front.js index 1298f3a075..d3649e7bd1 100644 --- a/devtools/shared/protocol/Front.js +++ b/devtools/shared/protocol/Front.js @@ -268,7 +268,7 @@ class Front extends Pool { * Update the actor from its representation. * Subclasses should override this. */ - form(form) {} + form() {} /** * Send a packet on the connection. diff --git a/devtools/shared/protocol/Pool.js b/devtools/shared/protocol/Pool.js index b5cb4c3eb1..0bbad46161 100644 --- a/devtools/shared/protocol/Pool.js +++ b/devtools/shared/protocol/Pool.js @@ -212,8 +212,12 @@ class Pool extends EventEmitter { actor.destroy = destroy; } } - this.conn.removeActorPool(this); - this.conn = null; + + // `conn` might be null for LazyPool in an unexplained way. + if (this.conn) { + this.conn.removeActorPool(this); + this.conn = null; + } } } diff --git a/devtools/shared/protocol/lazy-pool.js b/devtools/shared/protocol/lazy-pool.js index 0829fef1e0..91a9fb24cf 100644 --- a/devtools/shared/protocol/lazy-pool.js +++ b/devtools/shared/protocol/lazy-pool.js @@ -4,7 +4,6 @@ "use strict"; -const { extend } = require("devtools/shared/extend"); const { Pool } = require("devtools/shared/protocol"); /** @@ -19,11 +18,11 @@ const { Pool } = require("devtools/shared/protocol"); * addActorPool, removeActorPool, and poolFor. * @constructor */ -function LazyPool(conn) { - this.conn = conn; -} +class LazyPool extends Pool { + constructor(conn) { + super(conn); + } -LazyPool.prototype = extend(Pool.prototype, { // The actor for a given actor id stored in this pool getActorByID(actorID) { if (this.__poolMap) { @@ -34,8 +33,8 @@ LazyPool.prototype = extend(Pool.prototype, { return entry; } return null; - }, -}); + } +} exports.LazyPool = LazyPool; diff --git a/devtools/shared/protocol/tests/xpcshell/test_protocol_async.js b/devtools/shared/protocol/tests/xpcshell/test_protocol_async.js index dd7196710b..ffe60db8fa 100644 --- a/devtools/shared/protocol/tests/xpcshell/test_protocol_async.js +++ b/devtools/shared/protocol/tests/xpcshell/test_protocol_async.js @@ -138,7 +138,7 @@ add_task(async function () { () => { Assert.ok(false, "simpleThrow shouldn't succeed!"); }, - error => { + () => { // Check right return order Assert.equal(sequence++, 3); } @@ -150,7 +150,7 @@ add_task(async function () { () => { Assert.ok(false, "promiseThrow shouldn't succeed!"); }, - error => { + () => { // Check right return order Assert.equal(sequence++, 4); Assert.ok(true, "simple throw should throw"); diff --git a/devtools/shared/protocol/tests/xpcshell/test_protocol_children.js b/devtools/shared/protocol/tests/xpcshell/test_protocol_children.js index 728e58c6b9..7e72f4f91c 100644 --- a/devtools/shared/protocol/tests/xpcshell/test_protocol_children.js +++ b/devtools/shared/protocol/tests/xpcshell/test_protocol_children.js @@ -193,7 +193,7 @@ class ChildFront extends protocol.FrontClassWithSpec(childSpec) { }); } - onEvent2b(a, b, c) { + onEvent2b(a, b) { this.event2arg2 = b; } } @@ -596,7 +596,7 @@ async function testManyChildren(trace) { Assert.equal(ret.more[1].childID, "child7"); } -async function testGenerator(trace) { +async function testGenerator() { // Test accepting a generator. const f = function* () { for (const i of [1, 2, 3, 4, 5]) { @@ -623,7 +623,7 @@ async function testGenerator(trace) { Assert.ok(ret[1] instanceof ChildFront); } -async function testPolymorphism(trace) { +async function testPolymorphism() { // Check polymorphic types returned by an actor const firstChild = await rootFront.getPolymorphism(0); Assert.ok(firstChild instanceof ChildFront); @@ -653,7 +653,7 @@ async function testPolymorphism(trace) { }, /Was expecting one of these actors 'childActor,otherChildActor' but instead got an actor of type: 'root'/); } -async function testUnmanageChildren(trace) { +async function testUnmanageChildren() { // There is already one front of type OtherChildFront Assert.equal(childrenOfType(rootFront, OtherChildFront).length, 1); @@ -671,7 +671,7 @@ async function testUnmanageChildren(trace) { Assert.equal(childrenOfType(rootFront, OtherChildFront).length, 0); } -async function testDestroy(trace) { +async function testDestroy() { const front = await rootFront.getOtherChild(); const otherChildFront = await front.getOtherChild(); Assert.equal( diff --git a/devtools/shared/protocol/tests/xpcshell/test_protocol_longstring.js b/devtools/shared/protocol/tests/xpcshell/test_protocol_longstring.js index cda1708520..3d8912cd2a 100644 --- a/devtools/shared/protocol/tests/xpcshell/test_protocol_longstring.js +++ b/devtools/shared/protocol/tests/xpcshell/test_protocol_longstring.js @@ -124,7 +124,7 @@ function run_test() { Assert.equal(rootFront.__poolMap.size, size + 1); }; - client.connect().then(([applicationType, traits]) => { + client.connect().then(([applicationType]) => { rootFront = client.mainRoot; // Root actor has no children yet. diff --git a/devtools/shared/protocol/types.js b/devtools/shared/protocol/types.js index 41764fbd79..31c71276ea 100644 --- a/devtools/shared/protocol/types.js +++ b/devtools/shared/protocol/types.js @@ -138,12 +138,10 @@ function identityWrite(v) { * @param object typeObject * An object whose properties will be stored in the type, including * the `read` and `write` methods. - * @param object options - * Can specify `thawed` to prevent the type from being frozen. * * @returns a type object that can be used in protocol definitions. */ -types.addType = function (name, typeObject = {}, options = {}) { +types.addType = function (name, typeObject = {}) { if (registeredTypes.has(name)) { throw Error("Type '" + name + "' already exists."); } |