objects-manager.js (1263B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { Actor } = require("resource://devtools/shared/protocol.js"); 8 const { 9 objectsManagerSpec, 10 } = require("resource://devtools/shared/specs/objects-manager.js"); 11 12 /** 13 * This actor is a singleton per Target which allows interacting with JS Object 14 * inspected by DevTools. Typically from the Console or Debugger. 15 */ 16 class ObjectsManagerActor extends Actor { 17 constructor(conn) { 18 super(conn, objectsManagerSpec); 19 } 20 21 /** 22 * Release Actors by bulk by specifying their actor IDs. 23 * (Passing the whole Front [i.e. Actor's form] would be more expensive than passing only their IDs) 24 * 25 * @param {Array<string>} actorIDs 26 * List of all actor's IDs to release. 27 */ 28 releaseObjects(actorIDs) { 29 for (const actorID of actorIDs) { 30 const actor = this.conn.getActor(actorID); 31 if (actor) { 32 actor.release(); 33 // The release method won't destroy the actor and unregister it from its parent pool 34 actor.destroy(); 35 } 36 } 37 } 38 } 39 40 exports.ObjectsManagerActor = ObjectsManagerActor;