Bug 1568185 - Remove unused bindObjectActor argument from console actor. r=nchevobbe

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alexandre Poirot 2019-07-24 08:35:41 +00:00
Родитель b478ba698c
Коммит 0d64e50e68
6 изменённых файлов: 6 добавлений и 59 удалений

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

@ -786,10 +786,6 @@ class JSTerm extends Component {
* String to execute.
* @param object [options]
* Options for evaluation:
* - bindObjectActor: tells the ObjectActor ID for which you want to do
* the evaluation. The Debugger.Object of the OA will be bound to
* |_self| during evaluation, such that it's usable in the string you
* execute.
* - selectedNodeActor: tells the NodeActor ID of the current selection
* in the Inspector, if such a selection exists. This is used by
* helper functions that can evaluate on the current selection.

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

@ -1155,7 +1155,6 @@ WebConsoleActor.prototype = {
const timestamp = Date.now();
const evalOptions = {
bindObjectActor: request.bindObjectActor,
frameActor: request.frameActor,
url: request.url,
selectedNodeActor: request.selectedNodeActor,

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

@ -7,7 +7,6 @@
/* global XPCNativeWrapper */
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const { Cu } = require("chrome");
loader.lazyRequireGetter(
this,
"Parser",
@ -41,7 +40,7 @@ function isObject(value) {
* Evaluates a string using the debugger API.
*
* To allow the variables view to update properties from the Web Console we
* provide the "bindObjectActor" mechanism: the Web Console tells the
* provide the "selectedObjectActor" mechanism: the Web Console tells the
* ObjectActor ID for which it desires to evaluate an expression. The
* Debugger.Object pointed at by the actor ID is bound such that it is
* available during expression evaluation (executeInGlobalWithBindings()).
@ -64,7 +63,7 @@ function isObject(value) {
* Console Commands helpers - they need to be Debugger.Objects coming from the
* jsdebugger's Debugger instance.
*
* When |bindObjectActor| is used objects can come from different iframes,
* When |selectedObjectActor| is used objects can come from different iframes,
* from different domains. To avoid permission-related errors when objects
* come from a different window, we also determine the object's own global,
* such that evaluation happens in the context of that global. This means that
@ -75,12 +74,10 @@ function isObject(value) {
* String to evaluate.
* @param object [options]
* Options for evaluation:
* - bindObjectActor: the ObjectActor ID to use for evaluation.
* - selectedObjectActor: the ObjectActor ID to use for evaluation.
* |evalWithBindings()| will be called with one additional binding:
* |_self| which will point to the Debugger.Object of the given
* ObjectActor.
* - selectedObjectActor: Like bindObjectActor, but executes with the
* top level window as the global.
* ObjectActor. Executes with the top level window as the global.
* - frameActor: the FrameActor ID to use for evaluation. The given
* debugger frame is used for evaluation, instead of the global window.
* - selectedNodeActor: the NodeActor ID of the currently selected node
@ -313,13 +310,11 @@ function getDbgWindow(options, dbg, webConsole) {
// If we have an object to bind to |_self|, create a Debugger.Object
// referring to that object, belonging to dbg.
if (!options.bindObjectActor && !options.selectedObjectActor) {
if (!options.selectedObjectActor) {
return { bindSelf: null, dbgWindow };
}
const objActor = webConsole.getActorByID(
options.bindObjectActor || options.selectedObjectActor
);
const objActor = webConsole.getActorByID(options.selectedObjectActor);
if (!objActor) {
return { bindSelf: null, dbgWindow };
@ -336,15 +331,6 @@ function getDbgWindow(options, dbg, webConsole) {
// that is, without wrappers. The evalWithBindings call will then wrap
// jsVal appropriately for the evaluation compartment.
const bindSelf = dbgWindow.makeDebuggeeValue(jsVal);
if (options.bindObjectActor) {
const global = Cu.getGlobalForObject(jsVal);
try {
const _dbgWindow = dbg.makeGlobalObjectReference(global);
return { bindSelf, dbgWindow: _dbgWindow };
} catch (err) {
// The above will throw if `global` is invisible to debugger.
}
}
return { bindSelf, dbgWindow };
}

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

@ -175,20 +175,6 @@ class WebConsoleFront extends FrontClassWithSpec(webconsoleSpec) {
* @param object [options={}]
* Options for evaluation:
*
* - bindObjectActor: an ObjectActor ID. The OA holds a reference to
* a Debugger.Object that wraps a content object. This option allows
* you to bind |_self| to the D.O of the given OA, during string
* evaluation.
*
* See: Debugger.Object.executeInGlobalWithBindings() for information
* about bindings.
*
* Use case: the variable view needs to update objects and it does so
* by knowing the ObjectActor it inspects and binding |_self| to the
* D.O of the OA. As such, variable view sends strings like these for
* eval:
* _self["prop"] = value;
*
* - frameActor: a FrameActor ID. The FA holds a reference to
* a Debugger.Frame. This option allows you to evaluate the string in
* the frame of the given FA.
@ -207,7 +193,6 @@ class WebConsoleFront extends FrontClassWithSpec(webconsoleSpec) {
evaluateJS(string, opts = {}) {
const options = {
text: string,
bindObjectActor: opts.bindObjectActor,
frameActor: opts.frameActor,
url: opts.url,
selectedNodeActor: opts.selectedNodeActor,
@ -223,7 +208,6 @@ class WebConsoleFront extends FrontClassWithSpec(webconsoleSpec) {
evaluateJSAsync(string, opts = {}) {
const options = {
text: string,
bindObjectActor: opts.bindObjectActor,
frameActor: opts.frameActor,
url: opts.url,
selectedNodeActor: opts.selectedNodeActor,

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

@ -152,7 +152,6 @@ const webconsoleSpecPrototype = {
evaluateJS: {
request: {
text: Option(0, "string"),
bindObjectActor: Option(0, "string"),
frameActor: Option(0, "string"),
url: Option(0, "string"),
selectedNodeActor: Option(0, "string"),
@ -164,7 +163,6 @@ const webconsoleSpecPrototype = {
evaluateJSAsync: {
request: {
text: Option(0, "string"),
bindObjectActor: Option(0, "string"),
frameActor: Option(0, "string"),
url: Option(0, "string"),
selectedNodeActor: Option(0, "string"),

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

@ -166,14 +166,6 @@ async function doEvalWithBinding() {
let response = await evaluateJS("document;");
let documentActor = response.result.actor;
info("running a command with _self as document using bindObjectActor");
let bindObjectSame = await evaluateJS("_self === document", {
bindObjectActor: documentActor
});
checkObject(bindObjectSame, {
result: true
});
info("running a command with _self as document using selectedObjectActor");
let selectedObjectSame = await evaluateJS("_self === document", {
selectedObjectActor: documentActor
@ -195,14 +187,6 @@ async function doEvalWithBindingFrame() {
let iframeObjectActor = response.result.actor;
ok(iframeObjectActor, "There is an actor associated with the response");
let bindObjectGlobal = await evaluateJS("this.temp0 = _self;", {
bindObjectActor: iframeObjectActor
});
ok(!top.temp0,
"Global doesn't match the top global with bindObjectActor");
ok(frameWin.temp0 && frameWin.temp0.bar === 1,
"Global matches the object's global with bindObjectActor");
let selectedObjectGlobal = await evaluateJS("this.temp1 = _self;", {
selectedObjectActor: iframeObjectActor
});