зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1485664 - use protocol js methods instead of hard coding it in the console front; r=ochameau
Just updating the stubs for tests Differential Revision: https://phabricator.services.mozilla.com/D18835 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
56b3c13f02
Коммит
d3412c26b4
|
@ -1282,7 +1282,6 @@ WebConsoleActor.prototype =
|
|||
if (this.parentActor.isRootActor) {
|
||||
Services.console.reset();
|
||||
}
|
||||
return {};
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const {types, generateActorSpec, RetVal, Option} = require("devtools/shared/protocol");
|
||||
const {types, generateActorSpec, RetVal, Option, Arg} = require("devtools/shared/protocol");
|
||||
|
||||
types.addDictType("console.traits", {
|
||||
evaluateJSAsync: "boolean",
|
||||
|
@ -96,21 +96,47 @@ const webconsoleSpecPrototype = {
|
|||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* Start the given Web Console listeners.
|
||||
*
|
||||
* @see webconsoleFront LISTENERS
|
||||
* @Arg array listeners
|
||||
* Array of listeners you want to start. See this.LISTENERS for
|
||||
* known listeners.
|
||||
*/
|
||||
startListeners: {
|
||||
request: {
|
||||
listeners: Option(0, "array:string"),
|
||||
listeners: Arg(0, "array:string"),
|
||||
},
|
||||
response: RetVal("console.startlisteners"),
|
||||
},
|
||||
/**
|
||||
* Stop the given Web Console listeners.
|
||||
*
|
||||
* @see webconsoleFront LISTENERS
|
||||
* @Arg array listeners
|
||||
* Array of listeners you want to stop. See this.LISTENERS for
|
||||
* known listeners.
|
||||
* @Arg function onResponse
|
||||
* Function to invoke when the server response is received.
|
||||
*/
|
||||
stopListeners: {
|
||||
request: {
|
||||
listeners: Option(0, "nullable:array:string"),
|
||||
listeners: Arg(0, "nullable:array:string"),
|
||||
},
|
||||
response: RetVal("array:string"),
|
||||
},
|
||||
/**
|
||||
* Retrieve the cached messages from the server.
|
||||
*
|
||||
* @see webconsoleFront CACHED_MESSAGES
|
||||
* @Arg array types
|
||||
* The array of message types you want from the server. See
|
||||
* this.CACHED_MESSAGES for known types.
|
||||
*/
|
||||
getCachedMessages: {
|
||||
request: {
|
||||
messageTypes: Option(0, "array:string"),
|
||||
messageTypes: Arg(0, "array:string"),
|
||||
},
|
||||
// the return value here has a field "string" which can either be a longStringActor
|
||||
// or a plain string. Since we do not have union types, we cannot fully type this
|
||||
|
@ -141,33 +167,70 @@ const webconsoleSpecPrototype = {
|
|||
},
|
||||
response: RetVal("console.evaluatejsasync"),
|
||||
},
|
||||
/**
|
||||
* Autocomplete a JavaScript expression.
|
||||
*
|
||||
* @Arg {String} string
|
||||
* The code you want to autocomplete.
|
||||
* @Arg {Number} cursor
|
||||
* Cursor location inside the string. Index starts from 0.
|
||||
* @Arg {String} frameActor
|
||||
* The id of the frame actor that made the call.
|
||||
* @Arg {String} selectedNodeActor: Actor id of the selected node in the inspector.
|
||||
* @Arg {Array} authorizedEvaluations
|
||||
* Array of the properties access which can be executed by the engine.
|
||||
* Example: [["x", "myGetter"], ["x", "myGetter", "y", "anotherGetter"]] to
|
||||
* retrieve properties of `x.myGetter.` and `x.myGetter.y.anotherGetter`.
|
||||
*/
|
||||
autocomplete: {
|
||||
request: {
|
||||
text: Option(0, "string"),
|
||||
cursor: Option(0, "nullable:number"),
|
||||
frameActor: Option(0, "nullable:string"),
|
||||
selectedNodeActor: Option(0, "nullable:string"),
|
||||
text: Arg(0, "string"),
|
||||
cursor: Arg(1, "nullable:number"),
|
||||
frameActor: Arg(2, "nullable:string"),
|
||||
selectedNodeActor: Arg(3, "nullable:string"),
|
||||
authorizedEvaluations: Arg(4, "nullable:json"),
|
||||
},
|
||||
response: RetVal("console.autocomplete"),
|
||||
},
|
||||
/**
|
||||
* Clear the cache of messages (page errors and console API calls) expects no response.
|
||||
*/
|
||||
clearMessagesCache: {
|
||||
oneway: true,
|
||||
},
|
||||
/**
|
||||
* Get Web Console-related preferences on the server.
|
||||
*
|
||||
* @Arg array preferences
|
||||
* An array with the preferences you want to retrieve.
|
||||
*/
|
||||
getPreferences: {
|
||||
request: {
|
||||
preferences: Option(0, "array:string"),
|
||||
preferences: Arg(0, "array:string"),
|
||||
},
|
||||
response: RetVal("json"),
|
||||
},
|
||||
/**
|
||||
* Set Web Console-related preferences on the server.
|
||||
*
|
||||
* @Arg object preferences
|
||||
* An object with the preferences you want to change.
|
||||
*/
|
||||
setPreferences: {
|
||||
request: {
|
||||
preferences: Option(0, "json"),
|
||||
preferences: Arg(0, "json"),
|
||||
},
|
||||
response: RetVal("json"),
|
||||
},
|
||||
/**
|
||||
* Send a HTTP request with the given data.
|
||||
*
|
||||
* @Arg object data
|
||||
* The details of the HTTP request.
|
||||
*/
|
||||
sendHTTPRequest: {
|
||||
request: {
|
||||
request: Option(0, "json"),
|
||||
request: Arg(0, "json"),
|
||||
},
|
||||
response: RetVal("json"),
|
||||
},
|
||||
|
|
|
@ -162,20 +162,6 @@ class WebConsoleClient extends FrontClassWithSpec(webconsoleSpec) {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the cached messages from the server.
|
||||
*
|
||||
* @see this.CACHED_MESSAGES
|
||||
* @param array types
|
||||
* The array of message types you want from the server. See
|
||||
* this.CACHED_MESSAGES for known types.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getCachedMessages(messageTypes) {
|
||||
return super.getCachedMessages({ messageTypes });
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluate a JavaScript expression.
|
||||
*
|
||||
|
@ -274,74 +260,6 @@ class WebConsoleClient extends FrontClassWithSpec(webconsoleSpec) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Autocomplete a JavaScript expression.
|
||||
*
|
||||
* @param {String} string
|
||||
* The code you want to autocomplete.
|
||||
* @param {Number} cursor
|
||||
* Cursor location inside the string. Index starts from 0.
|
||||
* @param {String} frameActor
|
||||
* The id of the frame actor that made the call.
|
||||
* @param {String} selectedNodeActor: Actor id of the selected node in the inspector.
|
||||
* @param {Array} authorizedEvaluations
|
||||
* Array of the properties access which can be executed by the engine.
|
||||
* Example: [["x", "myGetter"], ["x", "myGetter", "y", "anotherGetter"]] to
|
||||
* retrieve properties of `x.myGetter.` and `x.myGetter.y.anotherGetter`.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
autocomplete(
|
||||
string,
|
||||
cursor,
|
||||
frameActor,
|
||||
selectedNodeActor,
|
||||
authorizedEvaluations
|
||||
) {
|
||||
const options = {
|
||||
text: string,
|
||||
cursor,
|
||||
frameActor,
|
||||
selectedNodeActor,
|
||||
authorizedEvaluations,
|
||||
};
|
||||
return super.autocomplete(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cache of messages (page errors and console API calls).
|
||||
*
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
clearMessagesCache() {
|
||||
return super.clearMessagesCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Web Console-related preferences on the server.
|
||||
*
|
||||
* @param array preferences
|
||||
* An array with the preferences you want to retrieve.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
getPreferences(preferences) {
|
||||
return super.getPreferences({ preferences });
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Web Console-related preferences on the server.
|
||||
*
|
||||
* @param object preferences
|
||||
* An object with the preferences you want to change.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
setPreferences(preferences) {
|
||||
return super.setPreferences({ preferences });
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the request headers from the given NetworkEventActor.
|
||||
*
|
||||
|
@ -522,18 +440,6 @@ class WebConsoleClient extends FrontClassWithSpec(webconsoleSpec) {
|
|||
return this._client.request(packet, onResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a HTTP request with the given data.
|
||||
*
|
||||
* @param string data
|
||||
* The details of the HTTP request.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
sendHTTPRequest(data) {
|
||||
return super.sendHTTPRequest({ request: data });
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the given Web Console listeners.
|
||||
*
|
||||
|
@ -545,21 +451,7 @@ class WebConsoleClient extends FrontClassWithSpec(webconsoleSpec) {
|
|||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
startListeners(listeners) {
|
||||
return super.startListeners({ listeners });
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the given Web Console listeners.
|
||||
*
|
||||
* @see this.LISTENERS
|
||||
* @param array listeners
|
||||
* Array of listeners you want to stop. See this.LISTENERS for
|
||||
* known listeners.
|
||||
* @return request
|
||||
* Request object that implements both Promise and EventEmitter interfaces
|
||||
*/
|
||||
stopListeners(listeners) {
|
||||
return super.stopListeners({ listeners });
|
||||
return super.startListeners(listeners);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче