Bug 1589001 - Rename (web)consoleClient variables and properties to webConsoleFront. r=Honza.

The webconsole actor now has an associated front for some
time, but the naming of variables and properties didn't
reflect that (most weren't updated and were still calling
it a client).
This patch tries to rename all those variables so it's more
obvious we're dealing with an actual front.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-10-17 10:16:46 +00:00
parent de0b357887
commit 7ef8a79951
49 changed files with 341 additions and 346 deletions

View File

@ -58,10 +58,10 @@ class FirefoxConnector {
// The owner object (NetMonitorAPI) received all events.
this.owner = connection.owner;
this.webConsoleClient = this.tabTarget.activeConsole;
this.webConsoleFront = this.tabTarget.activeConsole;
this.dataProvider = new FirefoxDataProvider({
webConsoleClient: this.webConsoleClient,
webConsoleFront: this.webConsoleFront,
actions: this.actions,
owner: this.owner,
});
@ -111,7 +111,7 @@ class FirefoxConnector {
this.tabTarget = null;
}
this.webConsoleClient = null;
this.webConsoleFront = null;
this.dataProvider = null;
}
@ -125,12 +125,12 @@ class FirefoxConnector {
async addListeners() {
this.tabTarget.on("close", this.disconnect);
this.webConsoleClient.on("networkEvent", this.dataProvider.onNetworkEvent);
this.webConsoleClient.on(
this.webConsoleFront.on("networkEvent", this.dataProvider.onNetworkEvent);
this.webConsoleFront.on(
"networkEventUpdate",
this.dataProvider.onNetworkEventUpdate
);
this.webConsoleClient.on("documentEvent", this.onDocEvent);
this.webConsoleFront.on("documentEvent", this.onDocEvent);
// Support for WebSocket monitoring is currently hidden behind this pref.
if (Services.prefs.getBoolPref("devtools.netmonitor.features.webSockets")) {
@ -159,7 +159,7 @@ class FirefoxConnector {
// The console actor supports listening to document events like
// DOMContentLoaded and load.
await this.webConsoleClient.startListeners(["DocumentEvents"]);
await this.webConsoleFront.startListeners(["DocumentEvents"]);
}
removeListeners() {
@ -181,16 +181,16 @@ class FirefoxConnector {
this.webSocketFront.off("frameSent", this.dataProvider.onFrameSent);
}
}
if (this.webConsoleClient) {
this.webConsoleClient.off(
if (this.webConsoleFront) {
this.webConsoleFront.off(
"networkEvent",
this.dataProvider.onNetworkEvent
);
this.webConsoleClient.off(
this.webConsoleFront.off(
"networkEventUpdate",
this.dataProvider.onNetworkEventUpdate
);
this.webConsoleClient.off("docEvent", this.onDocEvent);
this.webConsoleFront.off("docEvent", this.onDocEvent);
}
}
@ -252,7 +252,7 @@ class FirefoxConnector {
* Display any network events already in the cache.
*/
displayCachedEvents() {
for (const networkInfo of this.webConsoleClient.getNetworkEvents()) {
for (const networkInfo of this.webConsoleFront.getNetworkEvents()) {
// First add the request to the timeline.
this.dataProvider.onNetworkEvent(networkInfo);
// Then replay any updates already received.
@ -285,7 +285,7 @@ class FirefoxConnector {
* @param {function} callback callback will be invoked after the request finished
*/
sendHTTPRequest(data, callback) {
this.webConsoleClient.sendHTTPRequest(data).then(callback);
this.webConsoleFront.sendHTTPRequest(data).then(callback);
}
/**
@ -294,7 +294,7 @@ class FirefoxConnector {
* @param {object} filter request filter specifying what to block
*/
blockRequest(filter) {
return this.webConsoleClient.blockRequest(filter);
return this.webConsoleFront.blockRequest(filter);
}
/**
@ -303,7 +303,7 @@ class FirefoxConnector {
* @param {object} filter request filter specifying what to unblock
*/
unblockRequest(filter) {
return this.webConsoleClient.unblockRequest(filter);
return this.webConsoleFront.unblockRequest(filter);
}
/**
@ -312,7 +312,7 @@ class FirefoxConnector {
* @param {object} urls An array of URL strings
*/
setBlockedUrls(urls) {
return this.webConsoleClient.setBlockedUrls(urls);
return this.webConsoleFront.setBlockedUrls(urls);
}
/**
@ -322,7 +322,7 @@ class FirefoxConnector {
* @param {function} callback callback will be invoked after the request finished
*/
setPreferences(request) {
return this.webConsoleClient.setPreferences(request);
return this.webConsoleFront.setPreferences(request);
}
/**

View File

@ -21,13 +21,13 @@ class FirefoxDataProvider {
/**
* Constructor for data provider
*
* @param {Object} webConcoleClient represents the client object for Console actor.
* @param {Object} webConsoleFront represents the client object for Console actor.
* @param {Object} actions set of actions fired during data fetching process
* @params {Object} owner all events are fired on this object
*/
constructor({ webConsoleClient, actions, owner }) {
constructor({ webConsoleFront, actions, owner }) {
// Options
this.webConsoleClient = webConsoleClient;
this.webConsoleFront = webConsoleFront;
this.actions = actions || {};
this.actionsEnabled = true;
this.owner = owner;
@ -326,7 +326,7 @@ class FirefoxDataProvider {
* @return {object} networkInfo data packet
*/
getNetworkRequest(id) {
return this.webConsoleClient.getNetworkRequest(id);
return this.webConsoleFront.getNetworkRequest(id);
}
/**
@ -341,7 +341,7 @@ class FirefoxDataProvider {
* are available, or rejected if something goes wrong.
*/
getLongString(stringGrip) {
return this.webConsoleClient.getString(stringGrip).then(payload => {
return this.webConsoleFront.getString(stringGrip).then(payload => {
this.emitForTests(EVENTS.LONGSTRING_RESOLVED, { payload });
return payload;
});
@ -609,10 +609,10 @@ class FirefoxDataProvider {
let response = await new Promise((resolve, reject) => {
// Do a RDP request to fetch data from the actor.
if (typeof this.webConsoleClient[clientMethodName] === "function") {
if (typeof this.webConsoleFront[clientMethodName] === "function") {
// Make sure we fetch the real actor data instead of cloned actor
// e.g. CustomRequestPanel will clone a request with additional '-clone' actor id
this.webConsoleClient[clientMethodName](
this.webConsoleFront[clientMethodName](
actor.replace("-clone", ""),
res => {
if (res.error) {

View File

@ -65,7 +65,7 @@ HarAutomation.prototype = {
}
this.debuggerClient = client;
this.webConsoleClient = this.toolbox.target.activeConsole;
this.webConsoleFront = this.toolbox.target.activeConsole;
this.tabWatcher = new TabWatcher(this.toolbox, this);
this.tabWatcher.connect();
@ -83,7 +83,7 @@ HarAutomation.prototype = {
// A page is about to be loaded, start collecting HTTP
// data from events sent from the backend.
this.collector = new HarCollector({
webConsoleClient: this.webConsoleClient,
webConsoleFront: this.webConsoleFront,
debuggerClient: this.debuggerClient,
});
@ -196,7 +196,7 @@ HarAutomation.prototype = {
* Fetches the full text of a string.
*/
getString: function(stringGrip) {
return this.webConsoleClient.getString(stringGrip);
return this.webConsoleFront.getString(stringGrip);
},
};

View File

@ -16,7 +16,7 @@ const trace = {
* HTTP requests executed by the page (including inner iframes).
*/
function HarCollector(options) {
this.webConsoleClient = options.webConsoleClient;
this.webConsoleFront = options.webConsoleFront;
this.debuggerClient = options.debuggerClient;
this.onNetworkEvent = this.onNetworkEvent.bind(this);
@ -158,7 +158,7 @@ HarCollector.prototype = {
onNetworkEvent: function(packet) {
// Skip events from different console actors.
if (packet.from != this.webConsoleClient.actor) {
if (packet.from != this.webConsoleFront.actor) {
return;
}
@ -287,7 +287,7 @@ HarCollector.prototype = {
getData: function(actor, method, callback) {
return new Promise(resolve => {
if (!this.webConsoleClient[method]) {
if (!this.webConsoleFront[method]) {
console.error("HarCollector.getData: ERROR Unknown method!");
resolve();
}
@ -299,7 +299,7 @@ HarCollector.prototype = {
file
);
this.webConsoleClient[method](actor, response => {
this.webConsoleFront[method](actor, response => {
trace.log(
"HarCollector.getData; RESPONSE " + method + ", " + file.url,
response
@ -442,7 +442,7 @@ HarCollector.prototype = {
* are available, or rejected if something goes wrong.
*/
getString: function(stringGrip) {
const promise = this.webConsoleClient.getString(stringGrip);
const promise = this.webConsoleFront.getString(stringGrip);
this.requests.push(promise);
return promise;
},

View File

@ -80,7 +80,7 @@ async function performRequestAndWait(tab, monitor) {
* Execute simple GET request
*/
async function performPausedRequest(connector, tab, monitor) {
const wait = connector.connector.webConsoleClient.once("networkEvent");
const wait = connector.connector.webConsoleFront.once("networkEvent");
await ContentTask.spawn(tab.linkedBrowser, SIMPLE_SJS, async function(url) {
await content.wrappedJSObject.performRequests(url);
});

View File

@ -554,13 +554,10 @@ var Scratchpad = {
}
const evalOptions = { url: this.uniqueName };
const { debuggerClient, webConsoleClient } = await connection;
const { debuggerClient, webConsoleFront } = await connection;
this.debuggerClient = debuggerClient;
this.webConsoleClient = webConsoleClient;
const response = await webConsoleClient.evaluateJSAsync(
string,
evalOptions
);
this.webConsoleFront = webConsoleFront;
const response = await webConsoleFront.evaluateJSAsync(string, evalOptions);
if (response.error) {
throw new Error(response.error);
@ -851,8 +848,7 @@ var Scratchpad = {
*/
async _writePrimitiveAsComment(value) {
if (value.type == "longString") {
const client = this.webConsoleClient;
const response = await client
const response = await this.webConsoleFront
.longString(value)
.substring(0, value.length);
if (response.error) {
@ -1906,7 +1902,7 @@ var Scratchpad = {
}
scratchpadTargets = null;
this.webConsoleClient = null;
this.webConsoleFront = null;
this.debuggerClient = null;
this.initialized = false;
},
@ -2158,7 +2154,7 @@ function ScratchpadTab(aTab) {
var scratchpadTargets = new WeakMap();
/**
* Returns the object containing the DebuggerClient and WebConsoleClient for a
* Returns the object containing the DebuggerClient and WebConsoleFront for a
* given tab or window.
*
* @param object aSubject
@ -2204,7 +2200,7 @@ ScratchpadTab.prototype = {
const target = await this._attach(subject);
clearTimeout(connectTimer);
resolve({
webConsoleClient: target.activeConsole,
webConsoleFront: target.activeConsole,
debuggerClient: target.client,
});
} catch (error) {
@ -2347,7 +2343,7 @@ ScratchpadSidebar.prototype = {
return new ObjectClient(this._scratchpad.debuggerClient, grip);
},
getLongStringClient: actor => {
return this._scratchpad.webConsoleClient.longString(actor);
return this._scratchpad.webConsoleFront.longString(actor);
},
releaseActor: actor => {
// Ignore release failure, since the object actor may have been already GC.

View File

@ -26,7 +26,10 @@ function autocompleteUpdate(force, getterPath) {
}
const inputValue = hud.getInputValue();
const { frameActor: frameActorId, client } = webConsoleUI.getFrameActor();
const {
frameActor: frameActorId,
webConsoleFront,
} = webConsoleUI.getFrameActor();
const cursor = webConsoleUI.getInputCursor();
const state = getState().autocomplete;
@ -76,7 +79,7 @@ function autocompleteUpdate(force, getterPath) {
autocompleteDataFetch({
input,
frameActorId,
client,
webConsoleFront,
authorizedEvaluations,
force,
})
@ -118,7 +121,7 @@ function generateRequestId() {
* - {String} input: the expression that we want to complete.
* - {String} frameActorId: The id of the frame we want to autocomplete in.
* - {Boolean} force: true if the user forced an autocompletion (with Ctrl+Space).
* - {WebConsoleClient} client: The webconsole client.
* - {WebConsoleFront} client: The webconsole front.
* - {Array} authorizedEvaluations: Array of the properties access which can be
* executed by the engine.
* Example: [["x", "myGetter"], ["x", "myGetter", "y", "glitter"]]
@ -128,14 +131,14 @@ function autocompleteDataFetch({
input,
frameActorId,
force,
client,
webConsoleFront,
authorizedEvaluations,
}) {
return ({ dispatch, webConsoleUI }) => {
const selectedNodeActor = webConsoleUI.getSelectedNodeActor();
const id = generateRequestId();
dispatch({ type: AUTOCOMPLETE_PENDING_REQUEST, id });
client
webConsoleFront
.autocomplete(
input,
undefined,

View File

@ -72,13 +72,13 @@ function evaluateExpression(expression) {
? mappedExpressionRes.expression
: expression;
const { frameActor, client } = webConsoleUI.getFrameActor();
const { frameActor, webConsoleFront } = webConsoleUI.getFrameActor();
// Even if the evaluation fails,
// we still need to pass the error response to onExpressionEvaluated.
const onSettled = res => res;
const response = await client
const response = await webConsoleFront
.evaluateJSAsync(expression, {
frameActor,
selectedNodeActor: webConsoleUI.getSelectedNodeActor(),

View File

@ -16,7 +16,7 @@ class ConsoleCommands {
}
evaluateJSAsync(expression, options) {
return this.proxy.webConsoleClient.evaluateJSAsync(expression, options);
return this.proxy.webConsoleFront.evaluateJSAsync(expression, options);
}
createObjectClient(object) {

View File

@ -8,7 +8,7 @@ const { MESSAGES_CLEAR } = require("devtools/client/webconsole/constants");
/**
* This enhancer is responsible for clearing the messages caches using the
* webconsoleClient when the user clear the messages (either by direct UI action, or via
* webconsoleFront when the user clear the messages (either by direct UI action, or via
* `console.clear()`).
*/
function enableMessagesCacheClearing(webConsoleUI) {

View File

@ -67,8 +67,8 @@ class WebConsoleConnectionProxy {
const connection = (async () => {
this.client = this.target.client;
this.webConsoleClient = await this.target.getFront("console");
this._addWebConsoleClientEventListeners();
this.webConsoleFront = await this.target.getFront("console");
this._addWebConsoleFrontEventListeners();
await this._attachConsole();
// There is no way to view response bodies from the Browser Console, so do
@ -86,7 +86,7 @@ class WebConsoleConnectionProxy {
messages.sort((a, b) => a.timeStamp - b.timeStamp);
this.dispatchMessagesAdd(messages);
if (!this.webConsoleClient.hasNativeConsoleAPI) {
if (!this.webConsoleFront.hasNativeConsoleAPI) {
await this.webConsoleUI.logWarningAboutReplacedAPI();
}
})();
@ -126,7 +126,7 @@ class WebConsoleConnectionProxy {
if (this.needContentProcessMessagesListener) {
listeners.push("ContentProcessMessages");
}
return this.webConsoleClient.startListeners(listeners);
return this.webConsoleFront.startListeners(listeners);
}
/**
@ -134,17 +134,17 @@ class WebConsoleConnectionProxy {
*
* @private
*/
_addWebConsoleClientEventListeners() {
this.webConsoleClient.on("networkEvent", this._onNetworkEvent);
this.webConsoleClient.on("networkEventUpdate", this._onNetworkEventUpdate);
this.webConsoleClient.on("logMessage", this._onLogMessage);
this.webConsoleClient.on("pageError", this._onPageError);
this.webConsoleClient.on("consoleAPICall", this._onConsoleAPICall);
this.webConsoleClient.on(
_addWebConsoleFrontEventListeners() {
this.webConsoleFront.on("networkEvent", this._onNetworkEvent);
this.webConsoleFront.on("networkEventUpdate", this._onNetworkEventUpdate);
this.webConsoleFront.on("logMessage", this._onLogMessage);
this.webConsoleFront.on("pageError", this._onPageError);
this.webConsoleFront.on("consoleAPICall", this._onConsoleAPICall);
this.webConsoleFront.on(
"lastPrivateContextExited",
this._onLastPrivateContextExited
);
this.webConsoleClient.on(
this.webConsoleFront.on(
"clearLogpointMessages",
this._clearLogpointMessages
);
@ -155,17 +155,17 @@ class WebConsoleConnectionProxy {
*
* @private
*/
_removeWebConsoleClientEventListeners() {
this.webConsoleClient.off("networkEvent", this._onNetworkEvent);
this.webConsoleClient.off("networkEventUpdate", this._onNetworkEventUpdate);
this.webConsoleClient.off("logMessage", this._onLogMessage);
this.webConsoleClient.off("pageError", this._onPageError);
this.webConsoleClient.off("consoleAPICall", this._onConsoleAPICall);
this.webConsoleClient.off(
_removeWebConsoleFrontEventListeners() {
this.webConsoleFront.off("networkEvent", this._onNetworkEvent);
this.webConsoleFront.off("networkEventUpdate", this._onNetworkEventUpdate);
this.webConsoleFront.off("logMessage", this._onLogMessage);
this.webConsoleFront.off("pageError", this._onPageError);
this.webConsoleFront.off("consoleAPICall", this._onConsoleAPICall);
this.webConsoleFront.off(
"lastPrivateContextExited",
this._onLastPrivateContextExited
);
this.webConsoleClient.off(
this.webConsoleFront.off(
"clearLogpointMessages",
this._clearLogpointMessages
);
@ -179,7 +179,7 @@ class WebConsoleConnectionProxy {
* went wront.
*/
async _getCachedMessages() {
const response = await this.webConsoleClient.getCachedMessages([
const response = await this.webConsoleFront.getCachedMessages([
"PageError",
"ConsoleAPI",
]);
@ -202,7 +202,7 @@ class WebConsoleConnectionProxy {
* @returns An array of network messages.
*/
_getNetworkMessages() {
return Array.from(this.webConsoleClient.getNetworkEvents());
return Array.from(this.webConsoleFront.getNetworkEvents());
}
/**
@ -377,12 +377,12 @@ class WebConsoleConnectionProxy {
return;
}
this._removeWebConsoleClientEventListeners();
this._removeWebConsoleFrontEventListeners();
this.target.off("will-navigate", this._onTabWillNavigate);
this.target.off("navigate", this._onTabNavigated);
this.client = null;
this.webConsoleClient = null;
this.webConsoleFront = null;
}
}

View File

@ -70,17 +70,17 @@ class WebConsoleUI {
}
/**
* Getter for the debugger WebConsoleClient.
* Getter for the WebConsoleFront.
* @type object
*/
get webConsoleClient() {
get webConsoleFront() {
const proxy = this.getProxy();
if (!proxy) {
return null;
}
return proxy.webConsoleClient;
return proxy.webConsoleFront;
}
/**
@ -112,7 +112,7 @@ class WebConsoleUI {
// Ignore Fronts that are already destroyed
if (filterDisconnectedProxies) {
proxies = proxies.filter(proxy => {
return proxy.webConsoleClient && !!proxy.webConsoleClient.actorID;
return proxy.webConsoleFront && !!proxy.webConsoleFront.actorID;
});
}
@ -238,13 +238,13 @@ class WebConsoleUI {
clearNetworkRequests() {
for (const proxy of this.getAllProxies()) {
proxy.webConsoleClient.clearNetworkRequests();
proxy.webConsoleFront.clearNetworkRequests();
}
}
clearMessagesCache() {
for (const proxy of this.getAllProxies()) {
proxy.webConsoleClient.clearMessagesCache();
proxy.webConsoleFront.clearMessagesCache();
}
}
@ -291,7 +291,7 @@ class WebConsoleUI {
* The new value you want to set.
*/
async setSaveRequestAndResponseBodies(value) {
if (!this.webConsoleClient) {
if (!this.webConsoleFront) {
// Don't continue if the webconsole disconnected.
return null;
}
@ -302,7 +302,7 @@ class WebConsoleUI {
};
// Make sure the web console client connection is established first.
return this.webConsoleClient.setPreferences(toSet);
return this.webConsoleFront.setPreferences(toSet);
}
/**
@ -507,14 +507,11 @@ class WebConsoleUI {
* @returns {Promise}
*/
evaluateJSAsync(expression, options) {
return this.getProxy().webConsoleClient.evaluateJSAsync(
expression,
options
);
return this.getProxy().webConsoleFront.evaluateJSAsync(expression, options);
}
getLongString(grip) {
this.getProxy().webConsoleClient.getString(grip);
this.getProxy().webConsoleFront.getString(grip);
}
/**
@ -573,27 +570,26 @@ class WebConsoleUI {
* Retrieve the FrameActor ID given a frame depth, or the selected one if no
* frame depth given.
*
* @return { frameActor: String|null, client: Object }:
* @return { frameActor: String|null, webConsoleFront: WebConsoleFront }:
* frameActor is the FrameActor ID for the given frame depth
* (or the selected frame if it exists), null if no frame was found.
* client is the WebConsole client for the thread the frame is
* associated with.
* webConsoleFront is the front for the thread the frame is associated with.
*/
getFrameActor() {
const state = this.hud.getDebuggerFrames();
if (!state) {
return { frameActor: null, client: this.webConsoleClient };
return { frameActor: null, webConsoleFront: this.webConsoleFront };
}
const grip = state.frames[state.selected];
if (!grip) {
return { frameActor: null, client: this.webConsoleClient };
return { frameActor: null, webConsoleFront: this.webConsoleFront };
}
return {
frameActor: grip.actor,
client: state.target.activeConsole,
webConsoleFront: state.target.activeConsole,
};
}

View File

@ -71,13 +71,13 @@ class WebConsoleWrapper {
const { webConsoleUI } = this;
const debuggerClient = this.hud.currentTarget.client;
const webConsoleClient = await this.hud.currentTarget.getFront("console");
const webConsoleFront = await this.hud.currentTarget.getFront("console");
this.networkDataProvider = new DataProvider({
actions: {
updateRequest: (id, data) => this.batchedRequestUpdates({ id, data }),
},
webConsoleClient,
webConsoleFront,
});
return new Promise(resolve => {

View File

@ -28,7 +28,7 @@ async function setup(pageUrl) {
await target.attach();
const { client } = target;
const consoleClient = target.activeConsole;
const webConsoleFront = target.activeConsole;
const inspectedWindowFront = await target.getFront(
"webExtensionInspectedWindow"
);
@ -36,7 +36,7 @@ async function setup(pageUrl) {
return {
client,
target,
consoleClient,
webConsoleFront,
inspectedWindowFront,
extension,
fakeExtCallerInfo,
@ -128,12 +128,12 @@ add_task(async function test_successfull_inspectedWindowEval_resultAsGrip() {
inspectedWindowFront,
extension,
fakeExtCallerInfo,
consoleClient,
webConsoleFront,
} = await setup(MAIN_DOMAIN);
let result = await inspectedWindowFront.eval(fakeExtCallerInfo, "window", {
evalResultAsGrip: true,
toolboxConsoleActorID: consoleClient.actor,
toolboxConsoleActorID: webConsoleFront.actor,
});
ok(result.valueGrip, "Got a result from inspectedWindow eval");
@ -324,7 +324,7 @@ add_task(async function test_exception_inspectedWindowEval_result() {
add_task(async function test_exception_inspectedWindowReload() {
const {
client,
consoleClient,
webConsoleFront,
inspectedWindowFront,
extension,
fakeExtCallerInfo,
@ -345,7 +345,7 @@ add_task(async function test_exception_inspectedWindowReload() {
await waitForNoBypassCacheReload;
const noBypassCacheEval = await consoleClient.evaluateJS(
const noBypassCacheEval = await webConsoleFront.evaluateJS(
"document.body.textContent"
);
@ -362,7 +362,7 @@ add_task(async function test_exception_inspectedWindowReload() {
await waitForForceBypassCacheReload;
const forceBypassCacheEval = await consoleClient.evaluateJS(
const forceBypassCacheEval = await webConsoleFront.evaluateJS(
"document.body.textContent"
);
@ -378,7 +378,7 @@ add_task(async function test_exception_inspectedWindowReload() {
add_task(async function test_exception_inspectedWindowReload_customUserAgent() {
const {
client,
consoleClient,
webConsoleFront,
inspectedWindowFront,
extension,
fakeExtCallerInfo,
@ -394,7 +394,7 @@ add_task(async function test_exception_inspectedWindowReload_customUserAgent() {
await waitForCustomUserAgentReload;
const customUserAgentEval = await consoleClient.evaluateJS(
const customUserAgentEval = await webConsoleFront.evaluateJS(
"document.body.textContent"
);
@ -411,7 +411,7 @@ add_task(async function test_exception_inspectedWindowReload_customUserAgent() {
await waitForNoCustomUserAgentReload;
const noCustomUserAgentEval = await consoleClient.evaluateJS(
const noCustomUserAgentEval = await webConsoleFront.evaluateJS(
"document.body.textContent"
);
@ -427,7 +427,7 @@ add_task(async function test_exception_inspectedWindowReload_customUserAgent() {
add_task(async function test_exception_inspectedWindowReload_injectedScript() {
const {
client,
consoleClient,
webConsoleFront,
inspectedWindowFront,
extension,
fakeExtCallerInfo,
@ -442,7 +442,7 @@ add_task(async function test_exception_inspectedWindowReload_injectedScript() {
});
await waitForInjectedScriptReload;
const injectedScriptEval = await consoleClient.evaluateJS(
const injectedScriptEval = await webConsoleFront.evaluateJS(
`(${collectEvalResults})()`
);
@ -460,7 +460,7 @@ add_task(async function test_exception_inspectedWindowReload_injectedScript() {
await inspectedWindowFront.reload(fakeExtCallerInfo, {});
await waitForNoInjectedScriptReload;
const noInjectedScriptEval = await consoleClient.evaluateJS(
const noInjectedScriptEval = await webConsoleFront.evaluateJS(
`(${collectEvalResults})()`
);
@ -478,7 +478,7 @@ add_task(async function test_exception_inspectedWindowReload_injectedScript() {
add_task(async function test_exception_inspectedWindowReload_multiple_calls() {
const {
client,
consoleClient,
webConsoleFront,
inspectedWindowFront,
extension,
fakeExtCallerInfo,
@ -499,7 +499,7 @@ add_task(async function test_exception_inspectedWindowReload_multiple_calls() {
await waitForCustomUserAgentReload;
const customUserAgentEval = await consoleClient.evaluateJS(
const customUserAgentEval = await webConsoleFront.evaluateJS(
"document.body.textContent"
);
@ -516,7 +516,7 @@ add_task(async function test_exception_inspectedWindowReload_multiple_calls() {
await waitForNoCustomUserAgentReload;
const noCustomUserAgentEval = await consoleClient.evaluateJS(
const noCustomUserAgentEval = await webConsoleFront.evaluateJS(
"document.body.textContent"
);
@ -532,7 +532,7 @@ add_task(async function test_exception_inspectedWindowReload_multiple_calls() {
add_task(async function test_exception_inspectedWindowReload_stopped() {
const {
client,
consoleClient,
webConsoleFront,
inspectedWindowFront,
extension,
fakeExtCallerInfo,
@ -557,7 +557,7 @@ add_task(async function test_exception_inspectedWindowReload_stopped() {
});
await waitForInjectedScriptReload;
const injectedScriptEval = await consoleClient.evaluateJS(
const injectedScriptEval = await webConsoleFront.evaluateJS(
`(${collectEvalResults})()`
);
@ -578,7 +578,7 @@ add_task(async function test_exception_inspectedWindowReload_stopped() {
await inspectedWindowFront.reload(fakeExtCallerInfo, {});
await waitForNoInjectedScriptReload;
const noInjectedScriptEval = await consoleClient.evaluateJS(
const noInjectedScriptEval = await webConsoleFront.evaluateJS(
`(${collectEvalResults})()`
);

View File

@ -16,42 +16,42 @@ window.onload = async function() {
try {
const {
consoleClient,
webConsoleFront,
} = await attachURL(TEST_URL);
await testNotInTreeElementNode(consoleClient);
await testInTreeElementNode(consoleClient);
await testNotInTreeTextNode(consoleClient);
await testInTreeTextNode(consoleClient);
await testNotInTreeElementNode(webConsoleFront);
await testInTreeElementNode(webConsoleFront);
await testNotInTreeTextNode(webConsoleFront);
await testInTreeTextNode(webConsoleFront);
} catch (e) {
ok(false, `Error thrown: ${e.message}`);
}
SimpleTest.finish();
};
async function testNotInTreeElementNode(consoleClient) {
async function testNotInTreeElementNode(webConsoleFront) {
info("Testing isConnected property on a ElementNode not in the DOM tree");
const {result} = await consoleClient.evaluateJS("document.createElement(\"div\")");
const {result} = await webConsoleFront.evaluateJS("document.createElement(\"div\")");
is(result.preview.isConnected, false,
"isConnected is false since we only created the element");
}
async function testInTreeElementNode(consoleClient) {
async function testInTreeElementNode(webConsoleFront) {
info("Testing isConnected property on a ElementNode in the DOM tree");
const {result} = await consoleClient.evaluateJS("document.body");
const {result} = await webConsoleFront.evaluateJS("document.body");
is(result.preview.isConnected, true,
"isConnected is true as expected, since the element was retrieved from the DOM tree");
}
async function testNotInTreeTextNode(consoleClient) {
async function testNotInTreeTextNode(webConsoleFront) {
info("Testing isConnected property on a TextNode not in the DOM tree");
const {result} = await consoleClient.evaluateJS("document.createTextNode(\"Hello\")");
const {result} = await webConsoleFront.evaluateJS("document.createTextNode(\"Hello\")");
is(result.preview.isConnected, false,
"isConnected is false since we only created the element");
}
async function testInTreeTextNode(consoleClient) {
async function testInTreeTextNode(webConsoleFront) {
info("Testing isConnected property on a TextNode in the DOM tree");
const {result} = await consoleClient.evaluateJS("document.body.firstChild");
const {result} = await webConsoleFront.evaluateJS("document.body.firstChild");
is(result.preview.isConnected, true,
"isConnected is true as expected, since the element was retrieved from the DOM tree");
}

View File

@ -30,7 +30,7 @@ if (!DebuggerServer.initialized) {
* The Promise resolves with an object containing :
* - tab: the attached tab
* - targetFront: the target front
* - consoleClient: the console client
* - webConsoleFront: the console front
* - cleanup: a generator function which can be called to close
* the opened tab and disconnect its debugger client.
*/
@ -39,7 +39,7 @@ async function attachURL(url) {
const target = await TargetFactory.forTab(tab);
await target.attach();
return {
consoleClient: target.activeConsole,
webConsoleFront: target.activeConsole,
};
}

View File

@ -13,7 +13,7 @@ const {
const { webconsoleSpec } = require("devtools/shared/specs/webconsole");
/**
* A WebConsoleClient is used as a front end for the WebConsoleActor that is
* A WebConsoleFront is used as a front end for the WebConsoleActor that is
* created on the server, hiding implementation details.
*
* @param object client
@ -464,7 +464,7 @@ class WebConsoleFront extends FrontClassWithSpec(webconsoleSpec) {
}
/**
* Close the WebConsoleClient.
* Close the WebConsoleFront.
*
*/
destroy() {

View File

@ -9,7 +9,7 @@ add_task(async function() {
const tab = await addTab("data:text/html,<div id=quack></div>");
const target = await getTargetForTab(tab);
const consoleClient = target.activeConsole;
const webConsoleFront = target.activeConsole;
// Fetch WebConsoleCommands so that it is available for next Content Tasks
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
@ -24,19 +24,19 @@ add_task(async function() {
this.WebConsoleCommands = WebConsoleCommands;
});
await registerNewCommand(consoleClient);
await wrapCommand(consoleClient);
await unregisterCommand(consoleClient);
await registerAccessor(consoleClient);
await unregisterAfterOverridingTwice(consoleClient);
await registerNewCommand(webConsoleFront);
await wrapCommand(webConsoleFront);
await unregisterCommand(webConsoleFront);
await registerAccessor(webConsoleFront);
await unregisterAfterOverridingTwice(webConsoleFront);
});
async function evaluateJSAndCheckResult(consoleClient, input, expected) {
const response = await consoleClient.evaluateJS(input);
async function evaluateJSAndCheckResult(webConsoleFront, input, expected) {
const response = await webConsoleFront.evaluateJS(input);
checkObject(response, expected);
}
async function registerNewCommand(consoleClient) {
async function registerNewCommand(webConsoleFront) {
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
this.WebConsoleCommands.register("setFoo", (owner, value) => {
owner.window.foo = value;
@ -50,8 +50,8 @@ async function registerNewCommand(consoleClient) {
});
const command = "setFoo('bar')";
await evaluateJSAndCheckResult(consoleClient, command, {
from: consoleClient.actor,
await evaluateJSAndCheckResult(webConsoleFront, command, {
from: webConsoleFront.actor,
input: command,
result: "ok",
});
@ -61,7 +61,7 @@ async function registerNewCommand(consoleClient) {
});
}
async function wrapCommand(consoleClient) {
async function wrapCommand(webConsoleFront) {
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
const origKeys = this.WebConsoleCommands.getCommand("keys");
@ -83,13 +83,13 @@ async function wrapCommand(consoleClient) {
this.origKeys = origKeys;
});
await evaluateJSAndCheckResult(consoleClient, "keys('>o_/')", {
from: consoleClient.actor,
await evaluateJSAndCheckResult(webConsoleFront, "keys('>o_/')", {
from: webConsoleFront.actor,
result: "bang!",
});
await evaluateJSAndCheckResult(consoleClient, "keys({foo: 'bar'})", {
from: consoleClient.actor,
await evaluateJSAndCheckResult(webConsoleFront, "keys({foo: 'bar'})", {
from: webConsoleFront.actor,
result: {
class: "Array",
preview: {
@ -109,13 +109,13 @@ async function wrapCommand(consoleClient) {
});
}
async function unregisterCommand(consoleClient) {
async function unregisterCommand(webConsoleFront) {
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
this.WebConsoleCommands.unregister("setFoo");
});
await evaluateJSAndCheckResult(consoleClient, "setFoo", {
from: consoleClient.actor,
await evaluateJSAndCheckResult(webConsoleFront, "setFoo", {
from: webConsoleFront.actor,
input: "setFoo",
result: {
type: "undefined",
@ -124,7 +124,7 @@ async function unregisterCommand(consoleClient) {
});
}
async function registerAccessor(consoleClient) {
async function registerAccessor(webConsoleFront) {
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
this.WebConsoleCommands.register("$foo", {
get(owner) {
@ -135,8 +135,8 @@ async function registerAccessor(consoleClient) {
});
const command = "$foo.textContent = '>o_/'";
await evaluateJSAndCheckResult(consoleClient, command, {
from: consoleClient.actor,
await evaluateJSAndCheckResult(webConsoleFront, command, {
from: webConsoleFront.actor,
input: command,
result: ">o_/",
});
@ -155,13 +155,13 @@ async function registerAccessor(consoleClient) {
});
}
async function unregisterAfterOverridingTwice(consoleClient) {
async function unregisterAfterOverridingTwice(webConsoleFront) {
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
this.WebConsoleCommands.register("keys", (owner, obj) => "command 1");
});
info("checking the value of the first override");
await evaluateJSAndCheckResult(consoleClient, "keys('foo');", {
await evaluateJSAndCheckResult(webConsoleFront, "keys('foo');", {
result: "command 1",
});
@ -176,10 +176,10 @@ async function unregisterAfterOverridingTwice(consoleClient) {
});
info("checking the values after the second override");
await evaluateJSAndCheckResult(consoleClient, "keys({});", {
await evaluateJSAndCheckResult(webConsoleFront, "keys({});", {
result: "command 1",
});
await evaluateJSAndCheckResult(consoleClient, "keys('quack');", {
await evaluateJSAndCheckResult(webConsoleFront, "keys('quack');", {
result: "bang!",
});
@ -191,7 +191,7 @@ async function unregisterAfterOverridingTwice(consoleClient) {
"checking the value after unregistration (should restore " +
"the original command)"
);
await evaluateJSAndCheckResult(consoleClient, "keys({});", {
await evaluateJSAndCheckResult(webConsoleFront, "keys({});", {
result: {
class: "Array",
preview: { items: [] },

View File

@ -15,9 +15,9 @@ add_task(async function() {
const target = await getTargetForTab(tab);
const { client } = target;
const consoleClient = target.activeConsole;
const webConsoleFront = target.activeConsole;
await consoleClient.startListeners(["NetworkActivity"]);
await webConsoleFront.startListeners(["NetworkActivity"]);
// Override the default long string settings to lower values.
// This is done from the parent process's DebuggerServer as the LongString
@ -32,7 +32,7 @@ add_task(async function() {
info("test network POST request");
const onNetworkEvent = consoleClient.once("serverNetworkEvent");
const onNetworkEvent = webConsoleFront.once("serverNetworkEvent");
const updates = [];
let netActor = null;
const onAllNetworkEventUpdateReceived = new Promise(resolve => {
@ -57,23 +57,23 @@ add_task(async function() {
info("Waiting for networkEvent");
const netEvent = await onNetworkEvent;
netActor = assertNetworkEvent(client, consoleClient, netEvent);
netActor = assertNetworkEvent(client, webConsoleFront, netEvent);
info("Waiting for all networkEventUpdate");
await onAllNetworkEventUpdateReceived;
const requestHeaders = await consoleClient.getRequestHeaders(netActor);
const requestHeaders = await webConsoleFront.getRequestHeaders(netActor);
assertRequestHeaders(requestHeaders);
const requestCookies = await consoleClient.getRequestCookies(netActor);
const requestCookies = await webConsoleFront.getRequestCookies(netActor);
assertRequestCookies(requestCookies);
const requestPostData = await consoleClient.getRequestPostData(netActor);
const requestPostData = await webConsoleFront.getRequestPostData(netActor);
assertRequestPostData(requestPostData);
const responseHeaders = await consoleClient.getResponseHeaders(netActor);
const responseHeaders = await webConsoleFront.getResponseHeaders(netActor);
assertResponseHeaders(responseHeaders);
const responseCookies = await consoleClient.getResponseCookies(netActor);
const responseCookies = await webConsoleFront.getResponseCookies(netActor);
assertResponseCookies(responseCookies);
const responseContent = await consoleClient.getResponseContent(netActor);
const responseContent = await webConsoleFront.getResponseContent(netActor);
assertResponseContent(responseContent);
const eventTimings = await consoleClient.getEventTimings(netActor);
const eventTimings = await webConsoleFront.getEventTimings(netActor);
assertEventTimings(eventTimings);
await target.destroy();
@ -82,7 +82,7 @@ add_task(async function() {
DebuggerServer.LONG_STRING_INITIAL_LENGTH = ORIGINAL_LONG_STRING_INITIAL_LENGTH;
});
function assertNetworkEvent(client, consoleClient, packet) {
function assertNetworkEvent(client, webConsoleFront, packet) {
info("checking the network event packet");
const netActor = packet.eventActor;

View File

@ -88,16 +88,16 @@ var _attachConsole = async function(listeners, attachToTab, attachToWorker) {
const [, threadFront] = await target.attachThread();
await threadFront.resume();
const webConsoleClient = target.activeConsole;
const webConsoleFront = target.activeConsole;
// By default the console isn't listening for anything,
// request listeners from here
const response = await webConsoleClient.startListeners(listeners);
const response = await webConsoleFront.startListeners(listeners);
return {
state: {
dbgClient: client,
client: webConsoleClient,
actor: webConsoleClient.actor,
webConsoleFront,
actor: webConsoleFront.actor,
// Keep a strong reference to the Worker to avoid it being
// GCd during the test (bug 1237492).
// eslint-disable-next-line camelcase

View File

@ -46,7 +46,7 @@ function onStartPageErrorAndConsoleAPI(aState, aResponse)
ok(!aResponse.nativeConsoleAPI, "!nativeConsoleAPI");
top.console = top.console_;
aState.client.stopListeners(["ConsoleAPI", "foo"])
aState.webConsoleFront.stopListeners(["ConsoleAPI", "foo"])
.then(onStopConsoleAPI.bind(null, aState));
}

View File

@ -23,7 +23,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onEvaluate = onEvaluate.bind(null, aState);
aState.client.evaluateJS("document.__proto__").then(onEvaluate);
aState.webConsoleFront.evaluateJS("document.__proto__").then(onEvaluate);
}
function onEvaluate(aState, aResponse)

View File

@ -153,7 +153,7 @@ function checkConsoleAPICache() {
}
function onAttach1(state, response) {
state.client.getCachedMessages(["ConsoleAPI"])
state.webConsoleFront.getCachedMessages(["ConsoleAPI"])
.then(onCachedConsoleAPI.bind(null, state));
}
@ -191,7 +191,7 @@ function testPageErrors() {
}
function onAttach2(state, response) {
state.client.getCachedMessages(["PageError"])
state.webConsoleFront.getCachedMessages(["PageError"])
.then(onCachedPageErrors.bind(null, state));
}

View File

@ -18,7 +18,7 @@ let gWin;
let tests;
function evaluateJS(input) {
return gState.client.evaluateJS(input);
return gState.webConsoleFront.evaluateJS(input);
}
function startTest() {

View File

@ -17,13 +17,13 @@ window.onload = async function () {
state = await new Promise(resolve =>
attachConsole(["ConsoleAPI"], resolve)
);
const {client} = state;
const {webConsoleFront} = state;
await testFalseAssert(client);
await testFalsyAssert(client);
await testUndefinedAssert(client);
await testNullAssert(client);
await testTrueAssert(client);
await testFalseAssert(webConsoleFront);
await testFalsyAssert(webConsoleFront);
await testUndefinedAssert(webConsoleFront);
await testNullAssert(webConsoleFront);
await testTrueAssert(webConsoleFront);
} catch (e) {
ok(false, `Error thrown: ${e.message}`);

View File

@ -21,7 +21,7 @@ window.onload = async function () {
(consoleState, response) => resolve(consoleState)
));
state = await onAttachConsole;
const consoleFront = state.client;
const consoleFront = state.webConsoleFront;
await testSingleCustomStyleGroup(consoleFront);
await testSingleCustomStyleGroupCollapsed(consoleFront);

View File

@ -116,7 +116,7 @@ addEventListener("load", startTest);
let onAttach = async function (state, response) {
onConsoleAPICall = onConsoleAPICall.bind(null, state);
state.client.on("consoleAPICall", onConsoleAPICall);
state.webConsoleFront.on("consoleAPICall", onConsoleAPICall);
let currentFrame;
try {
@ -174,7 +174,7 @@ let onAttach = async function (state, response) {
await unregisterServiceWorker(currentFrame.contentWindow);
info('Service worker unregistered. Checking console calls.');
state.client.off("consoleAPICall", onConsoleAPICall);
state.webConsoleFront.off("consoleAPICall", onConsoleAPICall);
checkConsoleAPICalls(consoleCalls, expectedConsoleCalls);
} catch(error) {
ok(false, 'unexpected error: ' + error);

View File

@ -62,7 +62,7 @@ let startTest = async function () {
await new Promise(resolve => {
info("Attaching console to tab 1");
attachConsoleToTab(["ConsoleAPI"], function(state) {
state.client.getCachedMessages(["ConsoleAPI"]).then(function(calls) {
state.webConsoleFront.getCachedMessages(["ConsoleAPI"]).then(function(calls) {
checkConsoleAPICalls(calls.messages, firstTabExpectedCalls);
closeDebugger(state, resolve);
});
@ -77,7 +77,7 @@ let startTest = async function () {
await new Promise(resolve => {
info("Attaching console to tab 2");
attachConsoleToTab(["ConsoleAPI"], function(state) {
state.client.getCachedMessages(["ConsoleAPI"]).then(function(calls) {
state.webConsoleFront.getCachedMessages(["ConsoleAPI"]).then(function(calls) {
checkConsoleAPICalls(calls.messages, secondTabExpectedCalls);
closeDebugger(state, resolve);
});

View File

@ -89,7 +89,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onConsoleAPICall = onConsoleAPICall.bind(null, aState);
aState.client.on("consoleAPICall", onConsoleAPICall);
aState.webConsoleFront.on("consoleAPICall", onConsoleAPICall);
doConsoleCalls(aState.actor);
}
@ -104,7 +104,7 @@ function onConsoleAPICall(aState, aPacket)
return;
}
aState.client.off("consoleAPICall", onConsoleAPICall);
aState.webConsoleFront.off("consoleAPICall", onConsoleAPICall);
expectedConsoleCalls.forEach(function(aMessage, aIndex) {
info("checking received console call #" + aIndex);

View File

@ -21,7 +21,7 @@ window.onload = async function () {
(consoleState, response) => resolve(consoleState)
));
state = await onAttachConsole;
const consoleFront = state.client;
const consoleFront = state.webConsoleFront;
info("Testing console.log packet timestamp correctness");
const clientLogTimestamp = Date.now();

View File

@ -54,7 +54,7 @@ let testCachedMessages = async function (state) {
checkConsoleAPICalls(consoleCalls, expectedCachedConsoleCalls);
resolve();
};
state.client.getCachedMessages(["ConsoleAPI"]).then(onCachedConsoleAPI);
state.webConsoleFront.getCachedMessages(["ConsoleAPI"]).then(onCachedConsoleAPI);
})
};
@ -64,14 +64,14 @@ let testConsoleAPI = async function (state) {
let onConsoleAPICall = (packet) => {
info("received message level: " + packet.message.level);
checkConsoleAPICalls([packet.message], expectedConsoleAPICalls);
state.client.off("consoleAPICall", onConsoleAPICall);
state.webConsoleFront.off("consoleAPICall", onConsoleAPICall);
resolve();
}
info("testConsoleAPI: adding listener for consoleAPICall");
state.client.on("consoleAPICall", onConsoleAPICall);
state.webConsoleFront.on("consoleAPICall", onConsoleAPICall);
state.client.evaluateJS("console.log('Log was requested from worker')",
state.webConsoleFront.evaluateJS("console.log('Log was requested from worker')",
() => { });
});
};

View File

@ -196,7 +196,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onConsoleAPICall = onConsoleAPICall.bind(null, aState);
aState.client.on("consoleAPICall", onConsoleAPICall);
aState.webConsoleFront.on("consoleAPICall", onConsoleAPICall);
doConsoleCalls(aState.actor);
}
@ -211,7 +211,7 @@ function onConsoleAPICall(aState, aPacket)
return;
}
aState.client.off("consoleAPICall", onConsoleAPICall);
aState.webConsoleFront.off("consoleAPICall", onConsoleAPICall);
expectedConsoleCalls.forEach(function(aMessage, aIndex) {
info("checking received console call #" + aIndex);

View File

@ -125,7 +125,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onConsoleAPICall = onConsoleAPICall.bind(null, aState);
aState.client.on("consoleAPICall", onConsoleAPICall);
aState.webConsoleFront.on("consoleAPICall", onConsoleAPICall);
doConsoleCalls(aState.actor);
}
@ -140,7 +140,7 @@ function onConsoleAPICall(aState, aPacket)
return;
}
aState.client.off("consoleAPICall", onConsoleAPICall);
aState.webConsoleFront.off("consoleAPICall", onConsoleAPICall);
expectedConsoleCalls.forEach(function(aMessage, aIndex) {
info("checking received console call #" + aIndex);

View File

@ -59,13 +59,13 @@ function startTest()
function onAttach(aState, aResponse)
{
gState = aState;
gState.client.on("fileActivity", onFileActivity);
gState.webConsoleFront.on("fileActivity", onFileActivity);
doFileActivity();
}
function onFileActivity(aPacket)
{
gState.client.off("fileActivity", onFileActivity);
gState.webConsoleFront.off("fileActivity", onFileActivity);
info("aPacket.uri: " + aPacket.uri);
ok(/\bbug798764\b.*\.html$/.test(aPacket.uri), "file URI match");

View File

@ -25,9 +25,9 @@ let {MAX_AUTOCOMPLETE_ATTEMPTS,MAX_AUTOCOMPLETIONS} = require("devtools/shared/w
let evaluatingSync = true;
function evaluateJS(input, options = {}) {
if (evaluatingSync) {
return gState.client.evaluateJS(input, options);
return gState.webConsoleFront.evaluateJS(input, options);
} else {
return gState.client.evaluateJSAsync(input, options);
return gState.webConsoleFront.evaluateJSAsync(input, options);
}
}

View File

@ -90,7 +90,7 @@
window.varify = true;
`;
await state.client.evaluateJSAsync(script);
await state.webConsoleFront.evaluateJSAsync(script);
const tests = [
doAutocomplete1,
@ -125,20 +125,20 @@
}
for (const test of tests) {
await test(state.client);
await test(state.webConsoleFront);
}
// Null out proxy1 and proxy2: the proxy handlers use scripted functions
// that can keep the debugger sandbox alive longer than necessary via their
// environment chain (due to the webconsole helper functions defined there).
await state.client.evaluateJSAsync(`this.proxy1 = null; this.proxy2 = null;`);
await state.webConsoleFront.evaluateJSAsync(`this.proxy1 = null; this.proxy2 = null;`);
await closeDebugger(state);
}
async function doAutocomplete1(client) {
async function doAutocomplete1(webConsoleFront) {
info("test autocomplete for 'window.foo'");
let response = await client.autocomplete("window.foo");
let response = await webConsoleFront.autocomplete("window.foo");
let matches = response.matches;
is(response.matchProp, "foo", "matchProp");
@ -146,9 +146,9 @@
is(matches[0], "foobarObject", "matches[0]");
}
async function doAutocomplete2(client) {
async function doAutocomplete2(webConsoleFront) {
info("test autocomplete for 'window.foobarObject.'");
let response = await client.autocomplete("window.foobarObject.");
let response = await webConsoleFront.autocomplete("window.foobarObject.");
let matches = response.matches;
ok(!response.matchProp, "matchProp");
@ -157,10 +157,10 @@
["foo", "foobar", "foobaz", "omg", "omgfoo", "omgstr", "strfoo"]);
}
async function doAutocomplete3(client) {
async function doAutocomplete3(webConsoleFront) {
// Check that completion suggestions are offered inside the string.
info("test autocomplete for 'dump(window.foobarObject.)'");
let response = await client.autocomplete("dump(window.foobarObject.)", 25);
let response = await webConsoleFront.autocomplete("dump(window.foobarObject.)", 25);
let matches = response.matches;
ok(!response.matchProp, "matchProp");
@ -169,55 +169,55 @@
["foo", "foobar", "foobaz", "omg", "omgfoo", "omgstr", "strfoo"]);
}
async function doAutocomplete4(client) {
async function doAutocomplete4(webConsoleFront) {
// Check that completion requests can have no suggestions.
info("test autocomplete for 'dump(window.foobarObject.)'");
let response = await client.autocomplete("dump(window.foobarObject.)");
let response = await webConsoleFront.autocomplete("dump(window.foobarObject.)");
ok(!response.matchProp, "matchProp");
is(response.matches, null, "matches is null");
}
async function doAutocompleteLarge1(client) {
async function doAutocompleteLarge1(webConsoleFront) {
// Check that completion requests with too large objects will
// have no suggestions.
info("test autocomplete for 'window.largeObject1.'");
let response = await client.autocomplete("window.largeObject1.");
let response = await webConsoleFront.autocomplete("window.largeObject1.");
ok(!response.matchProp, "matchProp");
info (response.matches.join("|"));
is(response.matches.length, 0, "Bailed out with too many properties");
}
async function doAutocompleteLarge2(client) {
async function doAutocompleteLarge2(webConsoleFront) {
// Check that completion requests with pretty large objects will
// have MAX_AUTOCOMPLETIONS suggestions
info("test autocomplete for 'window.largeObject2.'");
let response = await client.autocomplete("window.largeObject2.");
let response = await webConsoleFront.autocomplete("window.largeObject2.");
ok(!response.matchProp, "matchProp");
is(response.matches.length, MAX_AUTOCOMPLETIONS, "matches.length is MAX_AUTOCOMPLETIONS");
}
async function doAutocompleteProxyThrowsPrototype(client) {
async function doAutocompleteProxyThrowsPrototype(webConsoleFront) {
// Check that completion provides own properties even if [[GetPrototypeOf]] throws.
info("test autocomplete for 'window.proxy1.'");
let response = await client.autocomplete("window.proxy1.");
let response = await webConsoleFront.autocomplete("window.proxy1.");
ok(!response.matchProp, "matchProp");
is(response.matches.length, 1, "matches.length");
checkObject(response.matches, ["foo"]);
}
async function doAutocompleteProxyThrowsOwnKeys(client) {
async function doAutocompleteProxyThrowsOwnKeys(webConsoleFront) {
// Check that completion provides inherited properties even if [[OwnPropertyKeys]] throws.
info("test autocomplete for 'window.proxy2.'");
let response = await client.autocomplete("window.proxy2.");
let response = await webConsoleFront.autocomplete("window.proxy2.");
ok(!response.matchProp, "matchProp");
is(response.matches.length, 1, "matches.length");
checkObject(response.matches, ["foo"]);
}
async function doAutocompleteSandbox(client) {
async function doAutocompleteSandbox(webConsoleFront) {
// Check that completion provides inherited properties even if [[OwnPropertyKeys]] throws.
info("test autocomplete for 'Cu.Sandbox.'");
let response = await client.autocomplete("Cu.Sandbox.");
let response = await webConsoleFront.autocomplete("Cu.Sandbox.");
ok(!response.matchProp, "matchProp");
let keys = Object.getOwnPropertyNames(Object.prototype).sort();
is(response.matches.length, keys.length, "matches.length");
@ -225,9 +225,9 @@
is(response.matches.join(" - "), keys.join(" - "));
}
async function doAutocompleteArray(client) {
async function doAutocompleteArray(webConsoleFront) {
info("test autocomplete for [1,2,3]");
let response = await client.autocomplete("[1,2,3].");
let response = await webConsoleFront.autocomplete("[1,2,3].");
let {matches} = response;
ok(matches.length > 0, "There are completion results for the array");
@ -235,40 +235,40 @@
"Array autocomplete contains expected results");
info("test autocomplete for '[] . '");
matches = (await client.autocomplete("[] . ")).matches;
matches = (await webConsoleFront.autocomplete("[] . ")).matches;
ok(matches.length > 1);
ok(matches.includes("length") && matches.includes("filter"),
"Array autocomplete contains expected results");
ok(!matches.includes("copy"), "Array autocomplete does not contain helpers");
info("test autocomplete for '[1,2,3]['");
matches = (await client.autocomplete("[1,2,3][")).matches;
matches = (await webConsoleFront.autocomplete("[1,2,3][")).matches;
ok(matches.length > 1);
ok(matches.includes('"length"') && matches.includes('"filter"'),
"Array autocomplete contains expected results, surrounded by quotes");
info("test autocomplete for '[1,2,3]['");
matches = (await client.autocomplete("[1,2,3]['")).matches;
matches = (await webConsoleFront.autocomplete("[1,2,3]['")).matches;
ok(matches.length > 1);
ok(matches.includes("'length'") && matches.includes("'filter'"),
"Array autocomplete contains expected results, surrounded by quotes");
info("test autocomplete for '[1,2,3][l");
matches = (await client.autocomplete("[1,2,3][l")).matches;
matches = (await webConsoleFront.autocomplete("[1,2,3][l")).matches;
ok(matches.length >= 1);
ok(matches.includes('"length"'),
"Array autocomplete contains expected results, surrounded by quotes");
info("test autocomplete for '[1,2,3]['l");
matches = (await client.autocomplete("[1,2,3]['l")).matches;
matches = (await webConsoleFront.autocomplete("[1,2,3]['l")).matches;
ok(matches.length >= 1);
ok(matches.includes("'length'"),
"Array autocomplete contains expected results, surrounded by quotes");
}
async function doAutocompleteString(client) {
async function doAutocompleteString(webConsoleFront) {
info(`test autocomplete for "foo".`);
let response = await client.autocomplete(`"foo".`);
let response = await webConsoleFront.autocomplete(`"foo".`);
let {matches} = response;
ok(matches.length > 0, "There are completion results for the string");
@ -276,111 +276,111 @@
"String autocomplete contains expected results");
info("test autocomplete for `foo`[");
matches = (await client.autocomplete("`foo`[")).matches;
matches = (await webConsoleFront.autocomplete("`foo`[")).matches;
ok(matches.length > 1, "autocomplete string with bracket works");
ok(matches.includes('"substr"') && matches.includes('"trim"'),
"String autocomplete contains expected results, surrounded by quotes");
}
async function doAutocompleteDotSurroundedBySpaces(client) {
async function doAutocompleteDotSurroundedBySpaces(webConsoleFront) {
info("test autocomplete for 'window.foobarObject\n .'");
let {matches} = await client.autocomplete("window.foobarObject\n .");
let {matches} = await webConsoleFront.autocomplete("window.foobarObject\n .");
is(matches.length, 7);
checkObject(matches,
["foo", "foobar", "foobaz", "omg", "omgfoo", "omgstr", "strfoo"]);
info("test autocomplete for 'window.foobarObject\n .o'");
matches = (await client.autocomplete("window.foobarObject\n .o")).matches;
matches = (await webConsoleFront.autocomplete("window.foobarObject\n .o")).matches;
is(matches.length, 3);
checkObject(matches, ["omg", "omgfoo", "omgstr"]);
info("test autocomplete for 'window.foobarObject\n .\n s'");
matches = (await client.autocomplete("window.foobarObject\n .\n s")).matches;
matches = (await webConsoleFront.autocomplete("window.foobarObject\n .\n s")).matches;
is(matches.length, 1);
checkObject(matches, ["strfoo"]);
info("test autocomplete for 'window.foobarObject\n . '");
matches = (await client.autocomplete("window.foobarObject\n . ")).matches;
matches = (await webConsoleFront.autocomplete("window.foobarObject\n . ")).matches;
is(matches.length, 7);
checkObject(matches,
["foo", "foobar", "foobaz", "omg", "omgfoo", "omgstr", "strfoo"]);
matches =
(await client.autocomplete("window.foobarObject. foo ; window.foo")).matches;
(await webConsoleFront.autocomplete("window.foobarObject. foo ; window.foo")).matches;
is(matches.length, 1);
checkObject(matches, ["foobarObject"]);
}
async function doAutocompleteBracketSurroundedBySpaces(client) {
async function doAutocompleteBracketSurroundedBySpaces(webConsoleFront) {
const wrap = (arr, quote = `"`) => arr.map(x => `${quote}${x}${quote}`);
let matches = await getAutocompleteMatches(client, "window.foobarObject\n [")
let matches = await getAutocompleteMatches(webConsoleFront, "window.foobarObject\n [")
is(matches.length, 7);
checkObject(matches,
wrap(["foo", "foobar", "foobaz", "omg", "omgfoo", "omgstr", "strfoo"]));
matches = await getAutocompleteMatches(client, "window.foobarObject\n ['o")
matches = await getAutocompleteMatches(webConsoleFront, "window.foobarObject\n ['o")
is(matches.length, 3);
checkObject(matches, wrap(["omg", "omgfoo", "omgstr"], "'"));
matches = await getAutocompleteMatches(client, "window.foobarObject\n [\n s");
matches = await getAutocompleteMatches(webConsoleFront, "window.foobarObject\n [\n s");
is(matches.length, 1);
checkObject(matches, [`"strfoo"`]);
matches = await getAutocompleteMatches(client, "window.foobarObject\n [ ");
matches = await getAutocompleteMatches(webConsoleFront, "window.foobarObject\n [ ");
is(matches.length, 7);
checkObject(matches,
wrap(["foo", "foobar", "foobaz", "omg", "omgfoo", "omgstr", "strfoo"]));
matches = await getAutocompleteMatches(client, "window.emojiObject [ '");
matches = await getAutocompleteMatches(webConsoleFront, "window.emojiObject [ '");
is(matches.length, 1);
checkObject(matches, [`'😎'`]);
}
async function doAutocompleteAfterOr(client) {
async function doAutocompleteAfterOr(webConsoleFront) {
info("test autocomplete for 'true || foo'");
const {matches} = await client.autocomplete("true || foobar");
const {matches} = await webConsoleFront.autocomplete("true || foobar");
is(matches.length, 1, "autocomplete returns expected results");
is(matches.join("-"), "foobarObject");
}
async function doInsensitiveAutocomplete(client) {
async function doInsensitiveAutocomplete(webConsoleFront) {
info("test autocomplete for 'window.insensitiveTestCase.'");
let {matches} = await client.autocomplete("window.insensitiveTestCase.");
let {matches} = await webConsoleFront.autocomplete("window.insensitiveTestCase.");
is(matches.join("-"), "prop-pröp-Prop-PROP-PRÖP",
"autocomplete returns the expected items, in the expected order");
info("test autocomplete for 'window.insensitiveTestCase.p'");
matches = (await client.autocomplete("window.insensitiveTestCase.p")).matches;
matches = (await webConsoleFront.autocomplete("window.insensitiveTestCase.p")).matches;
is(matches.join("-"), "prop-pröp-Prop-PROP-PRÖP",
"autocomplete is case-insensitive when first letter is lowercased");
info("test autocomplete for 'window.insensitiveTestCase.pRoP'");
matches = (await client.autocomplete("window.insensitiveTestCase.pRoP")).matches;
matches = (await webConsoleFront.autocomplete("window.insensitiveTestCase.pRoP")).matches;
is(matches.join("-"), "prop-Prop-PROP",
"autocomplete is case-insensitive when first letter is lowercased");
info("test autocomplete for 'window.insensitiveTestCase.P'");
matches = (await client.autocomplete("window.insensitiveTestCase.P")).matches;
matches = (await webConsoleFront.autocomplete("window.insensitiveTestCase.P")).matches;
is(matches.join("-"), "Prop-PROP-PRÖP",
"autocomplete is case-sensitive when first letter is uppercased");
info("test autocomplete for 'window.insensitiveTestCase.PROP'");
matches = (await client.autocomplete("window.insensitiveTestCase.PROP")).matches;
matches = (await webConsoleFront.autocomplete("window.insensitiveTestCase.PROP")).matches;
is(matches.join("-"), "PROP",
"autocomplete is case-sensitive when first letter is uppercased");
info("test autocomplete for 'window.insensitiveTestCase.prö'");
matches = (await client.autocomplete("window.insensitiveTestCase.prö")).matches;
matches = (await webConsoleFront.autocomplete("window.insensitiveTestCase.prö")).matches;
is(matches.join("-"), "pröp-PRÖP", "expected result with lowercase diacritic");
info("test autocomplete for 'window.insensitiveTestCase.PRÖ'");
matches = (await client.autocomplete("window.insensitiveTestCase.PRÖ")).matches;
matches = (await webConsoleFront.autocomplete("window.insensitiveTestCase.PRÖ")).matches;
is(matches.join("-"), "PRÖP", "expected result with uppercase diacritic");
}
async function doElementAccessAutocomplete(client) {
async function doElementAccessAutocomplete(webConsoleFront) {
info("test autocomplete for 'window.elementAccessTestCase['");
let res = (await client.autocomplete("window.elementAccessTestCase["));
let res = (await webConsoleFront.autocomplete("window.elementAccessTestCase["));
is(
res.matches.join("|"),
`"bar"|"da'ta'test"|"da\\"ta\\"test"|"da\`ta\`test"|"data-test"|"dataTest"|"BAR"`,
@ -388,7 +388,7 @@
is(res.isElementAccess, true);
info("test autocomplete for 'window.elementAccessTestCase[d'");
res = await client.autocomplete("window.elementAccessTestCase[d");
res = await webConsoleFront.autocomplete("window.elementAccessTestCase[d");
is(
res.matches.join("|"),
`"da'ta'test"|"da\\"ta\\"test"|"da\`ta\`test"|"data-test"|"dataTest"`,
@ -396,7 +396,7 @@
is(res.isElementAccess, true);
info(`test autocomplete for 'window.elementAccessTestCase["d'`);
res = await client.autocomplete(`window.elementAccessTestCase["d`);
res = await webConsoleFront.autocomplete(`window.elementAccessTestCase["d`);
is(
res.matches.join("|"),
`"da'ta'test"|"da\\"ta\\"test"|"da\`ta\`test"|"data-test"|"dataTest"`,
@ -404,13 +404,13 @@
is(res.isElementAccess, true);
info(`test autocomplete for 'window.elementAccessTestCase["data-`);
res = await client.autocomplete(`window.elementAccessTestCase["data-`);
res = await webConsoleFront.autocomplete(`window.elementAccessTestCase["data-`);
is(res.matches.join("|"), `"data-test"`,
"autocomplete returns the expected items, wrapped in quotes");
is(res.isElementAccess, true);
info(`test autocomplete for 'window.elementAccessTestCase['d'`);
res = await client.autocomplete(`window.elementAccessTestCase['d`);
res = await webConsoleFront.autocomplete(`window.elementAccessTestCase['d`);
is(
res.matches.join("|"),
`'da"ta"test'|'da\\'ta\\'test'|'da\`ta\`test'|'data-test'|'dataTest'`,
@ -418,7 +418,7 @@
is(res.isElementAccess, true);
info("test autocomplete for 'window.elementAccessTestCase[`d'");
res = await client.autocomplete("window.elementAccessTestCase[`d");
res = await webConsoleFront.autocomplete("window.elementAccessTestCase[`d");
is(
res.matches.join("|"),
"`da'ta'test`|`da\"ta\"test`|`da\\`ta\\`test`|`data-test`|`dataTest`",
@ -426,61 +426,61 @@
is(res.isElementAccess, true);
info(`test autocomplete for '['`);
res = await client.autocomplete(`[`);
res = await webConsoleFront.autocomplete(`[`);
is(res.matches, null, "it does not return anything");
info(`test autocomplete for '[1,2,3'`);
res = await client.autocomplete(`[1,2,3`);
res = await webConsoleFront.autocomplete(`[1,2,3`);
is(res.matches, null, "it does not return anything");
info(`test autocomplete for '["'`);
res = await client.autocomplete(`["`);
res = await webConsoleFront.autocomplete(`["`);
is(res.matches, null, "it does not return anything");
info(`test autocomplete for '[;'`);
res = await client.autocomplete(`[;`);
res = await webConsoleFront.autocomplete(`[;`);
is(res.matches, null, "it does not return anything");
}
async function doAutocompleteCommands(client) {
async function doAutocompleteCommands(webConsoleFront) {
info("test autocomplete for 'c'");
let matches = (await client.autocomplete("c")).matches;
let matches = (await webConsoleFront.autocomplete("c")).matches;
ok(matches.includes("cd") && matches.includes("clear"), "commands are returned");
info("test autocomplete for 's'");
matches = (await client.autocomplete("s")).matches;
matches = (await webConsoleFront.autocomplete("s")).matches;
is(matches.includes("screenshot"), false, "screenshot is not returned");
info("test autocomplete for ':s'");
matches = (await client.autocomplete(":s")).matches;
matches = (await webConsoleFront.autocomplete(":s")).matches;
is(matches.includes(":screenshot"), true, "screenshot is returned");
info("test autocomplete for 'window.c'");
matches = (await client.autocomplete("window.c")).matches;
matches = (await webConsoleFront.autocomplete("window.c")).matches;
ok(!matches.includes("cd") && !matches.includes("clear"), "commands are not returned");
info("test autocomplete for 'window[c'");
matches = (await client.autocomplete("window[c")).matches;
matches = (await webConsoleFront.autocomplete("window[c")).matches;
ok(!matches.includes("cd") && !matches.includes("clear"), "commands are not returned");
info(`test autocomplete for 'window["c'`);
matches = (await client.autocomplete(`window["c`)).matches;
matches = (await webConsoleFront.autocomplete(`window["c`)).matches;
ok(!matches.includes("cd") && !matches.includes("clear"), "commands are not returned");
info(`test autocomplete for 'window["c'`);
matches = (await client.autocomplete(`window["c`)).matches;
matches = (await webConsoleFront.autocomplete(`window["c`)).matches;
ok(!matches.includes("cd") && !matches.includes("clear"), "commands are not returned");
info(`test autocomplete for 'window[";c'`);
matches = (await client.autocomplete(`window[";c`)).matches;
matches = (await webConsoleFront.autocomplete(`window[";c`)).matches;
ok(!matches.includes("cd") && !matches.includes("clear"), "commands are not returned");
info(`test autocomplete for 'window[;c'`);
matches = (await client.autocomplete(`window[;c`)).matches;
matches = (await webConsoleFront.autocomplete(`window[;c`)).matches;
ok(!matches.includes("cd") && !matches.includes("clear"), "commands are not returned");
}
async function doAutocompleteAfterOperator(client) {
async function doAutocompleteAfterOperator(webConsoleFront) {
const inputs = [
"true;foob",
"true,foob",
@ -512,64 +512,64 @@
for (const input of inputs) {
info(`test autocomplete for "${input}"`);
let matches = (await client.autocomplete(input)).matches;
let matches = (await webConsoleFront.autocomplete(input)).matches;
ok(matches.includes("foobarObject"), `Expected autocomplete result for ${input}"`);
}
}
async function dontAutocompleteAfterDeclaration(client) {
async function dontAutocompleteAfterDeclaration(webConsoleFront) {
info("test autocomplete for 'var win'");
let matches = (await client.autocomplete("var win")).matches;
let matches = (await webConsoleFront.autocomplete("var win")).matches;
is(matches, null, "no autocompletion on a var declaration");
info("test autocomplete for 'const win'");
matches = (await client.autocomplete("const win")).matches;
matches = (await webConsoleFront.autocomplete("const win")).matches;
is(matches, null, "no autocompletion on a const declaration");
info("test autocomplete for 'let win'");
matches = (await client.autocomplete("let win")).matches;
matches = (await webConsoleFront.autocomplete("let win")).matches;
is(matches, null, "no autocompletion on a let declaration");
info("test autocomplete for 'function win'");
matches = (await client.autocomplete("function win")).matches;
matches = (await webConsoleFront.autocomplete("function win")).matches;
is(matches, null, "no autocompletion on a function declaration");
info("test autocomplete for 'class win'");
matches = (await client.autocomplete("class win")).matches;
matches = (await webConsoleFront.autocomplete("class win")).matches;
is(matches, null, "no autocompletion on a class declaration");
info("test autocomplete for 'const win = win'");
matches = (await client.autocomplete("const win = win")).matches;
matches = (await webConsoleFront.autocomplete("const win = win")).matches;
ok(matches.includes("window"), "autocompletion still happens after the `=` sign");
info("test autocomplete for 'in var'");
matches = (await client.autocomplete("in var")).matches;
matches = (await webConsoleFront.autocomplete("in var")).matches;
ok(matches.includes("varify"),
"autocompletion still happens with a property name starting with 'var'");
}
async function doKeywordsAutocomplete(client) {
async function doKeywordsAutocomplete(webConsoleFront) {
info("test autocomplete for 'func'");
let matches = (await client.autocomplete("func")).matches;
let matches = (await webConsoleFront.autocomplete("func")).matches;
ok(matches.includes("function"), "keywords are returned");
info("test autocomplete for ':func'");
matches = (await client.autocomplete(":func")).matches;
matches = (await webConsoleFront.autocomplete(":func")).matches;
is(!matches.includes("function"), true,
"'function' is not returned when prefixed with ':'");
info("test autocomplete for 'window.func'");
matches = (await client.autocomplete("window.func")).matches;
matches = (await webConsoleFront.autocomplete("window.func")).matches;
ok(!matches.includes("function"),
"'function' is not returned when doing a property access");
info("test autocomplete for 'window[func'");
matches = (await client.autocomplete("window[func")).matches;
matches = (await webConsoleFront.autocomplete("window[func")).matches;
ok(!matches.includes("function"),
"'function' is not returned when doing an element access");
}
async function dontAutocomplete(client) {
async function dontAutocomplete(webConsoleFront) {
const inputs = [
"",
" ",
@ -608,14 +608,14 @@ async function doKeywordsAutocomplete(client) {
];
for (const input of inputs) {
info(`test autocomplete for "${input}"`);
let matches = (await client.autocomplete(input)).matches;
let matches = (await webConsoleFront.autocomplete(input)).matches;
is(matches, null, `No autocomplete result for ${input}"`);
}
}
async function getAutocompleteMatches(client, input) {
async function getAutocompleteMatches(webConsoleFront, input) {
info(`test autocomplete for "${input}"`);
const res = (await client.autocomplete(input));
const res = (await webConsoleFront.autocomplete(input));
return res.matches;
}
</script>

View File

@ -47,7 +47,7 @@ function onAttach(aState, aResponse)
function doCheckParent()
{
info("check parent window");
gState.client.evaluateJS("window.foobarObject.bug609872")
gState.webConsoleFront.evaluateJS("window.foobarObject.bug609872")
.then(onFooObjectFromParent);
}
@ -68,7 +68,7 @@ function onFooObjectFromParent(aResponse)
function doCdIframe()
{
info("test cd('iframe')");
gState.client.evaluateJS("cd('iframe')").then(onCdIframe);
gState.webConsoleFront.evaluateJS("cd('iframe')").then(onCdIframe);
}
function onCdIframe(aResponse)
@ -88,7 +88,7 @@ function onCdIframe(aResponse)
function doCheckIframe()
{
info("check foobarObject from the iframe");
gState.client.evaluateJS("window.foobarObject.bug609872")
gState.webConsoleFront.evaluateJS("window.foobarObject.bug609872")
.then(onFooObjectFromIframe);
}
@ -109,7 +109,7 @@ function onFooObjectFromIframe(aResponse)
function doCdContentIframe()
{
info("test cd('#content-iframe')");
gState.client.evaluateJS("cd('#content-iframe')").then(onCdContentIframe);
gState.webConsoleFront.evaluateJS("cd('#content-iframe')").then(onCdContentIframe);
}
function onCdContentIframe(aResponse)
@ -131,7 +131,7 @@ function doCdSandboxedIframe()
// when passing a content window reference.
let cmd = "cd(document.getElementById('sandboxed-iframe').contentWindow)";
info("test " + cmd);
gState.client.evaluateJS(cmd).then(onCdSandboxedIframe.bind(null, cmd));
gState.webConsoleFront.evaluateJS(cmd).then(onCdSandboxedIframe.bind(null, cmd));
}
function onCdSandboxedIframe(cmd, aResponse)
@ -151,7 +151,7 @@ function onCdSandboxedIframe(cmd, aResponse)
function doCheckSandboxedIframe()
{
info("check foobarObject from the sandboxed iframe");
gState.client.evaluateJS("window.foobarObject.bug1051224")
gState.webConsoleFront.evaluateJS("window.foobarObject.bug1051224")
.then(onFooObjectFromSandboxedIframe);
}
@ -172,7 +172,7 @@ function onFooObjectFromSandboxedIframe(aResponse)
function doCdParent()
{
info("test cd() back to parent");
gState.client.evaluateJS("cd()").then(onCdParent);
gState.webConsoleFront.evaluateJS("cd()").then(onCdParent);
}
function onCdParent(aResponse)
@ -191,7 +191,7 @@ function onCdParent(aResponse)
function doCheckParent2()
{
gState.client.evaluateJS("window.foobarObject.bug609872")
gState.webConsoleFront.evaluateJS("window.foobarObject.bug609872")
.then(onFooObjectFromParent2);
}

View File

@ -18,7 +18,7 @@ SimpleTest.waitForExplicitFinish();
let gState;
function evaluateJS(input) {
return gState.client.evaluateJSAsync(input);
return gState.webConsoleFront.evaluateJSAsync(input);
}
function startTest()

View File

@ -17,7 +17,7 @@ let gState;
let gWin;
function evaluateJS(input) {
return gState.client.evaluateJS(input);
return gState.webConsoleFront.evaluateJS(input);
}
function startTest() {

View File

@ -27,7 +27,7 @@ function onAttach(aState, aResponse)
info("test network GET request");
onNetworkEvent = onNetworkEvent.bind(null, aState);
aState.client.on("serverNetworkEvent", onNetworkEvent);
aState.webConsoleFront.on("serverNetworkEvent", onNetworkEvent);
onNetworkEventUpdate = onNetworkEventUpdate.bind(null, aState);
aState.dbgClient.on("networkEventUpdate", onNetworkEventUpdate);
@ -50,7 +50,7 @@ function onNetworkEvent(aState, aPacket)
aState.netActor = netActor.actor;
aState.client.off("serverNetworkEvent", onNetworkEvent);
aState.webConsoleFront.off("serverNetworkEvent", onNetworkEvent);
}
let updates = [];
@ -128,7 +128,7 @@ function onNetworkEventUpdate(aState, aPacket)
onNetworkEventUpdate);
onRequestHeaders = onRequestHeaders.bind(null, aState);
aState.client.getRequestHeaders(aState.netActor,
aState.webConsoleFront.getRequestHeaders(aState.netActor,
onRequestHeaders);
}
}
@ -152,7 +152,7 @@ function onRequestHeaders(aState, aResponse)
});
onRequestCookies = onRequestCookies.bind(null, aState);
aState.client.getRequestCookies(aState.netActor,
aState.webConsoleFront.getRequestCookies(aState.netActor,
onRequestCookies);
}
@ -169,7 +169,7 @@ function onRequestCookies(aState, aResponse)
});
onRequestPostData = onRequestPostData.bind(null, aState);
aState.client.getRequestPostData(aState.netActor,
aState.webConsoleFront.getRequestPostData(aState.netActor,
onRequestPostData);
}
@ -181,7 +181,7 @@ function onRequestPostData(aState, aResponse)
ok(!aResponse.postDataDiscarded, "request POST data was not discarded");
onResponseHeaders = onResponseHeaders.bind(null, aState);
aState.client.getResponseHeaders(aState.netActor,
aState.webConsoleFront.getResponseHeaders(aState.netActor,
onResponseHeaders);
}
@ -204,7 +204,7 @@ function onResponseHeaders(aState, aResponse)
});
onResponseCookies = onResponseCookies.bind(null, aState);
aState.client.getResponseCookies(aState.netActor,
aState.webConsoleFront.getResponseCookies(aState.netActor,
onResponseCookies);
}
@ -215,7 +215,7 @@ function onResponseCookies(aState, aResponse)
is(aResponse.cookies.length, 0, "response cookies length");
onResponseContent = onResponseContent.bind(null, aState);
aState.client.getResponseContent(aState.netActor,
aState.webConsoleFront.getResponseContent(aState.netActor,
onResponseContent);
}
@ -227,7 +227,7 @@ function onResponseContent(aState, aResponse)
ok(!aResponse.contentDiscarded, "response content was not discarded");
onEventTimings = onEventTimings.bind(null, aState);
aState.client.getEventTimings(aState.netActor,
aState.webConsoleFront.getEventTimings(aState.netActor,
onEventTimings);
}

View File

@ -28,7 +28,7 @@ function onAttach(aState, aResponse)
info("test network POST request");
onNetworkEvent = onNetworkEvent.bind(null, aState);
aState.client.on("serverNetworkEvent", onNetworkEvent);
aState.webConsoleFront.on("serverNetworkEvent", onNetworkEvent);
onNetworkEventUpdate = onNetworkEventUpdate.bind(null, aState);
aState.dbgClient.on("networkEventUpdate", onNetworkEventUpdate);
@ -51,7 +51,7 @@ function onNetworkEvent(aState, aPacket)
aState.netActor = netActor.actor;
aState.client.off("serverNetworkEvent", onNetworkEvent);
aState.webConsoleFront.off("serverNetworkEvent", onNetworkEvent);
}
let updates = [];
@ -130,7 +130,7 @@ function onNetworkEventUpdate(aState, aPacket)
onNetworkEvent);
onRequestHeaders = onRequestHeaders.bind(null, aState);
aState.client.getRequestHeaders(aState.netActor,
aState.webConsoleFront.getRequestHeaders(aState.netActor,
onRequestHeaders);
}
}
@ -154,7 +154,7 @@ function onRequestHeaders(aState, aResponse)
});
onRequestCookies = onRequestCookies.bind(null, aState);
aState.client.getRequestCookies(aState.netActor,
aState.webConsoleFront.getRequestCookies(aState.netActor,
onRequestCookies);
}
@ -171,7 +171,7 @@ function onRequestCookies(aState, aResponse)
});
onRequestPostData = onRequestPostData.bind(null, aState);
aState.client.getRequestPostData(aState.netActor,
aState.webConsoleFront.getRequestPostData(aState.netActor,
onRequestPostData);
}
@ -189,7 +189,7 @@ function onRequestPostData(aState, aResponse)
is(aResponse.postData.text.length, 552, "postData text length");
onResponseHeaders = onResponseHeaders.bind(null, aState);
aState.client.getResponseHeaders(aState.netActor,
aState.webConsoleFront.getResponseHeaders(aState.netActor,
onResponseHeaders);
}
@ -212,7 +212,7 @@ function onResponseHeaders(aState, aResponse)
});
onResponseCookies = onResponseCookies.bind(null, aState);
aState.client.getResponseCookies(aState.netActor,
aState.webConsoleFront.getResponseCookies(aState.netActor,
onResponseCookies);
}
@ -223,7 +223,7 @@ function onResponseCookies(aState, aResponse)
is(aResponse.cookies.length, 0, "response cookies length");
onResponseContent = onResponseContent.bind(null, aState);
aState.client.getResponseContent(aState.netActor,
aState.webConsoleFront.getResponseContent(aState.netActor,
onResponseContent);
}
@ -239,7 +239,7 @@ function onResponseContent(aState, aResponse)
});
onEventTimings = onEventTimings.bind(null, aState);
aState.client.getEventTimings(aState.netActor,
aState.webConsoleFront.getEventTimings(aState.netActor,
onEventTimings);
}

View File

@ -95,7 +95,7 @@ function onNetworkEventUpdate(state, packet) {
}
if (packet.updateType === "securityInfo") {
state.client.getSecurityInfo(packet.from, onSecurityInfo);
state.webConsoleFront.getSecurityInfo(packet.from, onSecurityInfo);
}
}

View File

@ -90,7 +90,7 @@ function onNetworkEventUpdate(aState, aPacket)
}
if (aPacket.updateType === "securityInfo") {
aState.client.getSecurityInfo(aPacket.from, onSecurityInfo);
aState.webConsoleFront.getSecurityInfo(aPacket.from, onSecurityInfo);
}
}

View File

@ -26,7 +26,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onLogMessage = onLogMessage.bind(null, aState);
aState.client.on("logMessage", onLogMessage);
aState.webConsoleFront.on("logMessage", onLogMessage);
expectedMessages = [{
message: "hello world! bug859756",
@ -60,7 +60,7 @@ function onLogMessage(aState, aPacket)
return;
}
aState.client.off("logMessage", onLogMessage);
aState.webConsoleFront.off("logMessage", onLogMessage);
checkObject(receivedMessages, expectedMessages);

View File

@ -27,7 +27,7 @@ function startTest() {
function onAttach(state, response) {
onConsoleCall = onConsoleCall.bind(null, state);
state.client.on("consoleAPICall", onConsoleCall);
state.webConsoleFront.on("consoleAPICall", onConsoleCall);
let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 3)).join("\u0629");
@ -146,7 +146,7 @@ function onConsoleCall(state, aPacket) {
}],
});
state.client.off("consoleAPICall", onConsoleCall);
state.webConsoleFront.off("consoleAPICall", onConsoleCall);
info("inspecting object properties");
let args = aPacket.message.arguments;

View File

@ -27,7 +27,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onConsoleCall = onConsoleCall.bind(null, aState);
aState.client.on("consoleAPICall", onConsoleCall);
aState.webConsoleFront.on("consoleAPICall", onConsoleCall);
top.console.log("hello", document);
@ -67,7 +67,7 @@ function onConsoleCall(aState, aPacket)
}],
});
aState.client.off("consoleAPICall", onConsoleCall);
aState.webConsoleFront.off("consoleAPICall", onConsoleCall);
info("inspecting object properties");
let args = aPacket.message.arguments;

View File

@ -25,7 +25,7 @@ function startTest()
function onAttach(aState, aResponse)
{
onConsoleCall = onConsoleCall.bind(null, aState);
aState.client.on("consoleAPICall", onConsoleCall);
aState.webConsoleFront.on("consoleAPICall", onConsoleCall);
let docAsProto = Object.create(document);
@ -46,7 +46,7 @@ function onConsoleCall(aState, aPacket)
}],
});
aState.client.off("consoleAPICall", onConsoleCall);
aState.webConsoleFront.off("consoleAPICall", onConsoleCall);
info("inspecting object properties");
let args = aPacket.message.arguments;

View File

@ -153,7 +153,7 @@ function startTest() {
function onAttach(state, response) {
onPageError = onPageError.bind(null, state);
state.client.on("pageError", onPageError);
state.webConsoleFront.on("pageError", onPageError);
doPageErrors();
}
@ -170,7 +170,7 @@ function onPageError(state, packet) {
return;
}
state.client.off("pageError", onPageError);
state.webConsoleFront.off("pageError", onPageError);
Object.values(expectedPageErrors).forEach(function(message, index) {
info("checking received page error #" + index);

View File

@ -27,7 +27,7 @@ function onAttach(aState, aResponse)
let falsyValues = ["-0", "null", "undefined", "Infinity", "-Infinity", "NaN"];
falsyValues.forEach(function(value) {
tests.push(async function() {
const aResponse = await aState.client.evaluateJS("throw " + value + ";")
const aResponse = await aState.webConsoleFront.evaluateJS("throw " + value + ";")
let type = aResponse.exception.type;
is(type, value, "exception.type for throw " + value);
nextTest();
@ -37,7 +37,7 @@ function onAttach(aState, aResponse)
let identityTestValues = [false, 0];
identityTestValues.forEach(function(value) {
tests.push(async function() {
const aResponse = await aState.client.evaluateJS("throw " + value + ";")
const aResponse = await aState.webConsoleFront.evaluateJS("throw " + value + ";")
let exception = aResponse.exception;
is(exception, value, "response.exception for throw " + value);
nextTest();
@ -49,7 +49,7 @@ function onAttach(aState, aResponse)
DebuggerServer.LONG_STRING_INITIAL_LENGTH
);
tests.push(async function() {
const aResponse = await aState.client.evaluateJS("throw '" + longString + "';")
const aResponse = await aState.webConsoleFront.evaluateJS("throw '" + longString + "';")
is(aResponse.exception.initial, shortedString,
"exception.initial for throw longString"
);
@ -66,7 +66,7 @@ function onAttach(aState, aResponse)
];
symbolTestValues.forEach(function([expr, message]) {
tests.push(async function() {
const aResponse = await aState.client.evaluateJS("throw " + expr + ";");
const aResponse = await aState.webConsoleFront.evaluateJS("throw " + expr + ";");
is(aResponse.exceptionMessage, message,
"response.exception for throw " + expr);
nextTest();