Files
firefox/devtools/shared/fronts/environment.js
T
jaril d0be8e4c8f Bug 1588997 - Convert ObjectClient to protocol.js front. r=nchevobbe.
- Converted the ObjectClient into an protocoljs Front
- Converted the SymbolIteratorClient into a protocoljs Front and moved it to devtools/shared/fronts
- Converted the PropertyIteratorClient into a protocoljs Front and moved it to devtools/shared/fronts
- Converted the EnvironmentClient into a protocoljs Front and moved it to devtools/shared/fronts
- Modified calls to `DebuggerClient.release()` so that it tries to call the ObjectFront's release method first, and falls back on `DebuggerClient.release()` if there's no object front
- Changed reps so that it instantiates only one ObjectClient per grip
- Changed tests so that they expect what the Front's request method resolves to where applicable (i.e. ObjectFront.allocationStack resolves to allocationStack, not a packet object with an allocationStack property)
- Changed callbacks provided to ObjectClient methods to be chained to the ObjectFront methods (e.g. ObjectClient.getScope(callback) changed to ObjectFront.getScope().callback())
- Changed tests to use async/await (test_framebindings-x.js, test_functiongrips-x.js, test_objectgrips-x.js)
- Changed tests to expect protocoljs to throw an error string instead of an error object (test_objectgrips-fn-apply-03.js, test_threadlifetime-02.js, test_pauselifetime-03.js)

Differential Revision: https://phabricator.services.mozilla.com/D48182
2019-10-17 16:06:25 +00:00

49 lines
1.2 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const {
FrontClassWithSpec,
registerFront,
} = require("devtools/shared/protocol");
const { environmentSpec } = require("devtools/shared/specs/environment");
/**
* Environment fronts are used to manipulate the lexical environment actors.
*
* @param client DebuggerClient
* The debugger client parent.
* @param form Object
* The form sent across the remote debugging protocol.
*/
class EnvironmentFront extends FrontClassWithSpec(environmentSpec) {
constructor(client, form) {
super(client, form);
this._client = client;
if (form) {
this._form = form;
this.actorID = form.actor;
this.manage(this);
}
}
get actor() {
return this._form.actor;
}
get _transport() {
return this._client._transport;
}
/**
* Fetches the bindings introduced by this lexical environment.
*/
getBindings() {
return super.bindings();
}
}
exports.EnvironmentFront = EnvironmentFront;
registerFront(EnvironmentFront);