Bug 1595012 - Remove WebConsoleFront evaluateJS. r=jdescottes.

The function is only used in tests, which is a bit concerning
as we should test the actual function being used (evaluateJSAsync).

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Chevobbe 2019-11-10 11:47:45 +00:00
Родитель 9cdd87b0eb
Коммит 116dcd0e39
22 изменённых файлов: 119 добавлений и 176 удалений

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

@ -199,11 +199,6 @@ export type Actions = {
};
type ConsoleClient = {
evaluateJS: (
script: Script,
func: Function,
params?: { frameActor: ?FrameId }
) => void,
evaluateJSAsync: (
script: Script,
func: Function,

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

@ -1870,7 +1870,7 @@ async function evaluateInTopFrame(dbg, text) {
const { frames } = await threadFront.getFrames(0, 1);
ok(frames.length == 1, "Got one frame");
const options = { thread: threadFront.actor, frameActor: frames[0].actorID };
const response = await consoleFront.evaluateJS(text, options);
const response = await consoleFront.evaluateJSAsync(text, options);
return response.result.type == "undefined" ? undefined : response.result;
}

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

@ -33,7 +33,7 @@ async function obtainObjectWithCPOW(hud) {
info("Open the browser content toolbox and send a message");
const toolbox = await gDevToolsBrowser.openContentProcessToolbox(gBrowser);
await toolbox.target.activeConsole.evaluateJS(`
await toolbox.target.activeConsole.evaluateJSAsync(`
let {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.cpmm.sendAsyncMessage("cpow", null, {cpow: {a:1}});
`);

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

@ -64,7 +64,7 @@ async function generateEvaluationResultStubs() {
const toolbox = await openNewTabAndToolbox(TEST_URI, "webconsole");
for (const [key, code] of getCommands()) {
const packet = await toolbox.target.activeConsole.evaluateJS(code);
const packet = await toolbox.target.activeConsole.evaluateJSAsync(code);
stubs.set(key, getCleanedPacket(key, packet));
}

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

@ -63,6 +63,10 @@ function getCleanedPacket(key, packet) {
res.channelId = existingPacket.channelId;
}
if (res.resultID) {
res.resultID = existingPacket.resultID;
}
if (res.message) {
// Clean timeStamp on the message prop.
res.message.timeStamp = existingPacket.message.timeStamp;

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

@ -16,6 +16,7 @@ const {
const stubPackets = new Map();
stubPackets.set(`new Date(0)`, {
"resultID": "1573385647471-0",
"input": "new Date(0)",
"result": {
"type": "object",
@ -30,19 +31,12 @@ stubPackets.set(`new Date(0)`, {
}
},
"timestamp": 1572868073590,
"exception": null,
"frame": null,
"helperResult": null,
"notes": null,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`asdf()`, {
"input": "asdf()",
"result": {
"type": "undefined"
},
"timestamp": 1572868073933,
"resultID": "1573385647554-1",
"errorMessageName": "JSMSG_NOT_DEFINED",
"exception": {
"type": "object",
"actor": "server0.conn0.child1/obj25",
@ -72,23 +66,22 @@ stubPackets.set(`asdf()`, {
"functionName": null
}
],
"errorMessageName": "JSMSG_NOT_DEFINED",
"frame": {
"source": "debugger eval code",
"line": 1,
"column": 1
},
"helperResult": null,
"notes": null,
"input": "asdf()",
"result": {
"type": "undefined"
},
"timestamp": 1572868073933,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`1 + @`, {
"input": "1 + @",
"result": {
"type": "undefined"
},
"timestamp": 1572868073955,
"resultID": "1573385647562-2",
"errorMessageName": "JSMSG_ILLEGAL_CHARACTER",
"exception": {
"type": "object",
"actor": "server0.conn0.child1/obj26",
@ -109,26 +102,21 @@ stubPackets.set(`1 + @`, {
},
"exceptionMessage": "SyntaxError: illegal character",
"exceptionDocURL": "https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default",
"exceptionStack": null,
"errorMessageName": "JSMSG_ILLEGAL_CHARACTER",
"frame": {
"source": "debugger eval code",
"line": 1,
"column": 4
},
"helperResult": null,
"notes": null,
"input": "1 + @",
"result": {
"type": "undefined"
},
"timestamp": 1572868073955,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`inspect({a: 1})`, {
"input": "inspect({a: 1})",
"result": {
"type": "undefined"
},
"timestamp": 1572868073976,
"exception": null,
"frame": null,
"resultID": "1573385647565-3",
"helperResult": {
"type": "inspectObject",
"input": "inspect({a: 1})",
@ -157,45 +145,40 @@ stubPackets.set(`inspect({a: 1})`, {
}
}
},
"notes": null,
"input": "inspect({a: 1})",
"result": {
"type": "undefined"
},
"timestamp": 1572868073976,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`cd(document)`, {
"resultID": "1573385647570-4",
"helperResult": {
"type": "error",
"message": "cdFunctionInvalidArgument"
},
"input": "cd(document)",
"result": {
"type": "undefined"
},
"timestamp": 1572868074010,
"exception": null,
"frame": null,
"helperResult": {
"type": "error",
"message": "cdFunctionInvalidArgument"
},
"notes": null,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`undefined`, {
"resultID": "1573385647572-5",
"input": "undefined",
"result": {
"type": "undefined"
},
"timestamp": 1572868074023,
"exception": null,
"frame": null,
"helperResult": null,
"notes": null,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`longString message Error`, {
"input": "throw new Error(\"Long error \".repeat(10000))",
"result": {
"type": "undefined"
},
"timestamp": 1572868074038,
"resultID": "1573385647576-6",
"exception": {
"type": "object",
"actor": "server0.conn0.child1/obj32",
@ -240,17 +223,16 @@ stubPackets.set(`longString message Error`, {
"line": 1,
"column": 7
},
"helperResult": null,
"notes": null,
"input": "throw new Error(\"Long error \".repeat(10000))",
"result": {
"type": "undefined"
},
"timestamp": 1572868074038,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`eval throw ""`, {
"input": "throw \"\"",
"result": {
"type": "undefined"
},
"timestamp": 1572868074059,
"resultID": "1573385647580-7",
"exception": "",
"exceptionMessage": "",
"exceptionStack": [
@ -268,17 +250,16 @@ stubPackets.set(`eval throw ""`, {
"line": 1,
"column": 1
},
"helperResult": null,
"notes": null,
"input": "throw \"\"",
"result": {
"type": "undefined"
},
"timestamp": 1572868074059,
"from": "server0.conn0.child1/consoleActor2"
});
stubPackets.set(`eval throw "tomato"`, {
"input": "throw \"tomato\"",
"result": {
"type": "undefined"
},
"timestamp": 1572868074071,
"resultID": "1573385647583-8",
"exception": "tomato",
"exceptionMessage": "tomato",
"exceptionStack": [
@ -296,8 +277,11 @@ stubPackets.set(`eval throw "tomato"`, {
"line": 1,
"column": 1
},
"helperResult": null,
"notes": null,
"input": "throw \"tomato\"",
"result": {
"type": "undefined"
},
"timestamp": 1572868074071,
"from": "server0.conn0.child1/consoleActor2"
});

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

@ -105,7 +105,7 @@ async function checkEvaluateInTopFrameThrows(dbg, text) {
const { frames } = await threadFront.getFrames(0, 1);
ok(frames.length == 1, "Got one frame");
const options = { thread: threadFront.actor, frameActor: frames[0].actor };
const response = await consoleFront.evaluateJS(text, options);
const response = await consoleFront.evaluateJSAsync(text, options);
ok(response.exception, "Eval threw an exception");
}

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

@ -65,7 +65,7 @@ async function getFrames(target) {
ok(front.hasActor("thread"), "Got the thread actor");
// Ensure sending at least one request to an actor...
const consoleFront = await front.getFront("console");
const { result } = await consoleFront.evaluateJS("var a = 42; a");
const { result } = await consoleFront.evaluateJSAsync("var a = 42; a");
is(result, 42, "console.eval worked");
// Although we can get metadata about the child frames,

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

@ -345,7 +345,7 @@ add_task(async function test_exception_inspectedWindowReload() {
await waitForNoBypassCacheReload;
const noBypassCacheEval = await webConsoleFront.evaluateJS(
const noBypassCacheEval = await webConsoleFront.evaluateJSAsync(
"document.body.textContent"
);
@ -362,7 +362,7 @@ add_task(async function test_exception_inspectedWindowReload() {
await waitForForceBypassCacheReload;
const forceBypassCacheEval = await webConsoleFront.evaluateJS(
const forceBypassCacheEval = await webConsoleFront.evaluateJSAsync(
"document.body.textContent"
);
@ -394,7 +394,7 @@ add_task(async function test_exception_inspectedWindowReload_customUserAgent() {
await waitForCustomUserAgentReload;
const customUserAgentEval = await webConsoleFront.evaluateJS(
const customUserAgentEval = await webConsoleFront.evaluateJSAsync(
"document.body.textContent"
);
@ -411,7 +411,7 @@ add_task(async function test_exception_inspectedWindowReload_customUserAgent() {
await waitForNoCustomUserAgentReload;
const noCustomUserAgentEval = await webConsoleFront.evaluateJS(
const noCustomUserAgentEval = await webConsoleFront.evaluateJSAsync(
"document.body.textContent"
);
@ -442,7 +442,7 @@ add_task(async function test_exception_inspectedWindowReload_injectedScript() {
});
await waitForInjectedScriptReload;
const injectedScriptEval = await webConsoleFront.evaluateJS(
const injectedScriptEval = await webConsoleFront.evaluateJSAsync(
`(${collectEvalResults})()`
);
@ -460,7 +460,7 @@ add_task(async function test_exception_inspectedWindowReload_injectedScript() {
await inspectedWindowFront.reload(fakeExtCallerInfo, {});
await waitForNoInjectedScriptReload;
const noInjectedScriptEval = await webConsoleFront.evaluateJS(
const noInjectedScriptEval = await webConsoleFront.evaluateJSAsync(
`(${collectEvalResults})()`
);
@ -499,7 +499,7 @@ add_task(async function test_exception_inspectedWindowReload_multiple_calls() {
await waitForCustomUserAgentReload;
const customUserAgentEval = await webConsoleFront.evaluateJS(
const customUserAgentEval = await webConsoleFront.evaluateJSAsync(
"document.body.textContent"
);
@ -516,7 +516,7 @@ add_task(async function test_exception_inspectedWindowReload_multiple_calls() {
await waitForNoCustomUserAgentReload;
const noCustomUserAgentEval = await webConsoleFront.evaluateJS(
const noCustomUserAgentEval = await webConsoleFront.evaluateJSAsync(
"document.body.textContent"
);
@ -557,7 +557,7 @@ add_task(async function test_exception_inspectedWindowReload_stopped() {
});
await waitForInjectedScriptReload;
const injectedScriptEval = await webConsoleFront.evaluateJS(
const injectedScriptEval = await webConsoleFront.evaluateJSAsync(
`(${collectEvalResults})()`
);
@ -578,7 +578,7 @@ add_task(async function test_exception_inspectedWindowReload_stopped() {
await inspectedWindowFront.reload(fakeExtCallerInfo, {});
await waitForNoInjectedScriptReload;
const noInjectedScriptEval = await webConsoleFront.evaluateJS(
const noInjectedScriptEval = await webConsoleFront.evaluateJSAsync(
`(${collectEvalResults})()`
);

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

@ -92,7 +92,7 @@ function runTests() {
// Ensure sending at least one request to an actor...
const consoleFront = await front.getFront("console");
const { result } = await consoleFront.evaluateJS("var a = 42; a");
const { result } = await consoleFront.evaluateJSAsync("var a = 42; a");
is(result, 42, "console.eval worked");
getProcessAgain(front, content.id);
@ -151,5 +151,5 @@ function runTests() {
</script>
</pre>
</body>
</body>
</html>

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

@ -30,28 +30,28 @@ window.onload = async function() {
async function testNotInTreeElementNode(webConsoleFront) {
info("Testing isConnected property on a ElementNode not in the DOM tree");
const {result} = await webConsoleFront.evaluateJS("document.createElement(\"div\")");
const {result} = await webConsoleFront.evaluateJSAsync("document.createElement(\"div\")");
is(result.preview.isConnected, false,
"isConnected is false since we only created the element");
}
async function testInTreeElementNode(webConsoleFront) {
info("Testing isConnected property on a ElementNode in the DOM tree");
const {result} = await webConsoleFront.evaluateJS("document.body");
const {result} = await webConsoleFront.evaluateJSAsync("document.body");
is(result.preview.isConnected, true,
"isConnected is true as expected, since the element was retrieved from the DOM tree");
}
async function testNotInTreeTextNode(webConsoleFront) {
info("Testing isConnected property on a TextNode not in the DOM tree");
const {result} = await webConsoleFront.evaluateJS("document.createTextNode(\"Hello\")");
const {result} = await webConsoleFront.evaluateJSAsync("document.createTextNode(\"Hello\")");
is(result.preview.isConnected, false,
"isConnected is false since we only created the element");
}
async function testInTreeTextNode(webConsoleFront) {
info("Testing isConnected property on a TextNode in the DOM tree");
const {result} = await webConsoleFront.evaluateJS("document.body.firstChild");
const {result} = await webConsoleFront.evaluateJSAsync("document.body.firstChild");
is(result.preview.isConnected, true,
"isConnected is true as expected, since the element was retrieved from the DOM tree");
}

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

@ -163,42 +163,28 @@ class WebConsoleFront extends FrontClassWithSpec(webconsoleSpec) {
}
/**
* Evaluate a JavaScript expression.
* Evaluate a JavaScript expression asynchronously.
*
* @param string string
* The code you want to evaluate.
* @param object [options={}]
* Options for evaluation:
* @param {String} string: The code you want to evaluate.
* @param {Object} opts: Options for evaluation:
*
* - frameActor: a FrameActor ID. The FA holds a reference to
* - {String} frameActor: a FrameActor ID. The FA holds a reference to
* a Debugger.Frame. This option allows you to evaluate the string in
* the frame of the given FA.
*
* - url: the url to evaluate the script as. Defaults to
* - {String} url: the url to evaluate the script as. Defaults to
* "debugger eval code".
*
* - selectedNodeActor: the NodeActor ID of the current
* - {String} selectedNodeActor: the NodeActor ID of the current
* selection in the Inspector, if such a selection
* exists. This is used by helper functions that can
* reference the currently selected node in the Inspector,
* like $0.
* @return request
* Request object that implements both Promise and EventEmitter interfaces
*/
evaluateJS(string, opts = {}) {
const options = {
text: string,
frameActor: opts.frameActor,
url: opts.url,
selectedNodeActor: opts.selectedNodeActor,
selectedObjectActor: opts.selectedObjectActor,
};
return super.evaluateJS(options);
}
/**
* Evaluate a JavaScript expression asynchronously.
* See evaluateJS for parameter and response information.
* reference the currently selected node in the Inspector, like $0.
*
* - {String} selectedObjectActor: the actorID of a given objectActor.
* This is used by context menu entries to get a reference to an object, in order
* to perform some operation on it (copy it, store it as a global variable, ).
*
* @return {Promise}: A promise that resolves with the response.
*/
async evaluateJSAsync(string, opts = {}) {
const options = {

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

@ -145,17 +145,6 @@ const webconsoleSpecPrototype = {
// response
response: RetVal("console.cachedmessages"),
},
evaluateJS: {
request: {
text: Option(0, "string"),
frameActor: Option(0, "string"),
url: Option(0, "string"),
selectedNodeActor: Option(0, "string"),
selectedObjectActor: Option(0, "string"),
mapped: Option(0, "nullable:json"),
},
response: RetVal("json"),
},
evaluateJSAsync: {
request: {
text: Option(0, "string"),

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

@ -32,7 +32,7 @@ add_task(async function() {
});
async function evaluateJSAndCheckResult(webConsoleFront, input, expected) {
const response = await webConsoleFront.evaluateJS(input);
const response = await webConsoleFront.evaluateJSAsync(input);
checkObject(response, expected);
}
@ -51,7 +51,6 @@ async function registerNewCommand(webConsoleFront) {
const command = "setFoo('bar')";
await evaluateJSAndCheckResult(webConsoleFront, command, {
from: webConsoleFront.actor,
input: command,
result: "ok",
});
@ -84,12 +83,10 @@ async function wrapCommand(webConsoleFront) {
});
await evaluateJSAndCheckResult(webConsoleFront, "keys('>o_/')", {
from: webConsoleFront.actor,
result: "bang!",
});
await evaluateJSAndCheckResult(webConsoleFront, "keys({foo: 'bar'})", {
from: webConsoleFront.actor,
result: {
class: "Array",
preview: {
@ -115,7 +112,6 @@ async function unregisterCommand(webConsoleFront) {
});
await evaluateJSAndCheckResult(webConsoleFront, "setFoo", {
from: webConsoleFront.actor,
input: "setFoo",
result: {
type: "undefined",
@ -136,7 +132,6 @@ async function registerAccessor(webConsoleFront) {
const command = "$foo.textContent = '>o_/'";
await evaluateJSAndCheckResult(webConsoleFront, command, {
from: webConsoleFront.actor,
input: command,
result: ">o_/",
});

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

@ -37,15 +37,24 @@ async function connectToDebugger() {
async function attachConsole(listeners, callback) {
const { state, response } = await _attachConsole(listeners);
callback(state, response);
if (callback) {
return callback(state, response);
}
return { state, response };
}
async function attachConsoleToTab(listeners, callback) {
const { state, response } = await _attachConsole(listeners, true);
callback(state, response);
if (callback) {
return callback(state, response);
}
return { state, response };
}
async function attachConsoleToWorker(listeners, callback) {
const { state, response } = await _attachConsole(listeners, true, true);
callback(state, response);
if (callback) {
return callback(state, response);
}
return { state, response };
}
var _attachConsole = async function(listeners, attachToTab, attachToWorker) {
@ -146,6 +155,10 @@ function checkConsoleAPICall(call, expected) {
}
function checkObject(object, expected) {
if (object && object.getGrip) {
object = object.getGrip();
}
for (const name of Object.keys(expected)) {
const expectedValue = expected[name];
const value = object[name];

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

@ -23,13 +23,12 @@ function startTest()
function onAttach(aState, aResponse)
{
onEvaluate = onEvaluate.bind(null, aState);
aState.webConsoleFront.evaluateJS("document.__proto__").then(onEvaluate);
aState.webConsoleFront.evaluateJSAsync("document.__proto__").then(onEvaluate);
}
function onEvaluate(aState, aResponse)
{
checkObject(aResponse, {
from: aState.actor,
input: "document.__proto__",
result: {
type: "object",

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

@ -18,7 +18,7 @@ let gWin;
let tests;
function evaluateJS(input) {
return gState.webConsoleFront.evaluateJS(input);
return gState.webConsoleFront.evaluateJSAsync(input);
}
function startTest() {
@ -38,7 +38,6 @@ tests = [
async function keys() {
let response = await evaluateJS("keys({foo: 'bar'})");
checkObject(response, {
from: gState.actor,
result: {
class: "Array",
preview: {
@ -51,7 +50,6 @@ tests = [
async function values() {
let response = await evaluateJS("values({foo: 'bar'})");
checkObject(response, {
from: gState.actor,
result: {
class: "Array",
preview: {

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

@ -71,7 +71,7 @@ let testConsoleAPI = async function (state) {
info("testConsoleAPI: adding listener for consoleAPICall");
state.webConsoleFront.on("consoleAPICall", onConsoleAPICall);
state.webConsoleFront.evaluateJS("console.log('Log was requested from worker')",
state.webConsoleFront.evaluateJSAsync("console.log('Log was requested from worker')",
() => { });
});
};

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

@ -20,15 +20,9 @@ let gState;
let {MAX_AUTOCOMPLETE_ATTEMPTS,MAX_AUTOCOMPLETIONS} = require("devtools/shared/webconsole/js-property-provider");
// This test runs all of its assertions twice - once with
// evaluateJS and once with evaluateJSAsync.
let evaluatingSync = true;
function evaluateJS(input, options = {}) {
if (evaluatingSync) {
return gState.webConsoleFront.evaluateJS(input, options);
} else {
return gState.webConsoleFront.evaluateJSAsync(input, options);
}
return gState.webConsoleFront.evaluateJSAsync(input, options);
}
function startTest()
@ -266,12 +260,7 @@ function testEnd()
// Otherwise, end the test.
closeDebugger(gState, function() {
gState = null;
if (evaluatingSync) {
evaluatingSync = false;
startTest();
} else {
SimpleTest.finish();
}
SimpleTest.finish();
});
}

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

@ -47,14 +47,13 @@ function onAttach(aState, aResponse)
function doCheckParent()
{
info("check parent window");
gState.webConsoleFront.evaluateJS("window.foobarObject.bug609872")
gState.webConsoleFront.evaluateJSAsync("window.foobarObject.bug609872")
.then(onFooObjectFromParent);
}
function onFooObjectFromParent(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "window.foobarObject.bug609872",
result: "parent",
});
@ -68,13 +67,12 @@ function onFooObjectFromParent(aResponse)
function doCdIframe()
{
info("test cd('iframe')");
gState.webConsoleFront.evaluateJS("cd('iframe')").then(onCdIframe);
gState.webConsoleFront.evaluateJSAsync("cd('iframe')").then(onCdIframe);
}
function onCdIframe(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "cd('iframe')",
result: { type: "undefined" },
helperResult: { type: "cd" },
@ -88,14 +86,13 @@ function onCdIframe(aResponse)
function doCheckIframe()
{
info("check foobarObject from the iframe");
gState.webConsoleFront.evaluateJS("window.foobarObject.bug609872")
gState.webConsoleFront.evaluateJSAsync("window.foobarObject.bug609872")
.then(onFooObjectFromIframe);
}
function onFooObjectFromIframe(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "window.foobarObject.bug609872",
result: "child",
});
@ -109,13 +106,12 @@ function onFooObjectFromIframe(aResponse)
function doCdContentIframe()
{
info("test cd('#content-iframe')");
gState.webConsoleFront.evaluateJS("cd('#content-iframe')").then(onCdContentIframe);
gState.webConsoleFront.evaluateJSAsync("cd('#content-iframe')").then(onCdContentIframe);
}
function onCdContentIframe(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "cd('#content-iframe')",
result: { type: "undefined" },
helperResult: { type: "cd" },
@ -131,13 +127,12 @@ function doCdSandboxedIframe()
// when passing a content window reference.
let cmd = "cd(document.getElementById('sandboxed-iframe').contentWindow)";
info("test " + cmd);
gState.webConsoleFront.evaluateJS(cmd).then(onCdSandboxedIframe.bind(null, cmd));
gState.webConsoleFront.evaluateJSAsync(cmd).then(onCdSandboxedIframe.bind(null, cmd));
}
function onCdSandboxedIframe(cmd, aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: cmd,
result: { type: "undefined" },
helperResult: { type: "cd" },
@ -151,14 +146,13 @@ function onCdSandboxedIframe(cmd, aResponse)
function doCheckSandboxedIframe()
{
info("check foobarObject from the sandboxed iframe");
gState.webConsoleFront.evaluateJS("window.foobarObject.bug1051224")
gState.webConsoleFront.evaluateJSAsync("window.foobarObject.bug1051224")
.then(onFooObjectFromSandboxedIframe);
}
function onFooObjectFromSandboxedIframe(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "window.foobarObject.bug1051224",
result: "sandboxed",
});
@ -172,13 +166,12 @@ function onFooObjectFromSandboxedIframe(aResponse)
function doCdParent()
{
info("test cd() back to parent");
gState.webConsoleFront.evaluateJS("cd()").then(onCdParent);
gState.webConsoleFront.evaluateJSAsync("cd()").then(onCdParent);
}
function onCdParent(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "cd()",
result: { type: "undefined" },
helperResult: { type: "cd" },
@ -191,14 +184,13 @@ function onCdParent(aResponse)
function doCheckParent2()
{
gState.webConsoleFront.evaluateJS("window.foobarObject.bug609872")
gState.webConsoleFront.evaluateJSAsync("window.foobarObject.bug609872")
.then(onFooObjectFromParent2);
}
function onFooObjectFromParent2(aResponse)
{
checkObject(aResponse, {
from: gState.actor,
input: "window.foobarObject.bug609872",
result: "parent",
});

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

@ -17,7 +17,7 @@ let gState;
let gWin;
function evaluateJS(input) {
return gState.webConsoleFront.evaluateJS(input);
return gState.webConsoleFront.evaluateJSAsync(input);
}
function startTest() {
@ -128,7 +128,6 @@ let checkQuerySelectorAllException = async function () {
function basicResultCheck(response, input, output) {
checkObject(response, {
from: gState.actor,
input: input,
result: output,
});

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

@ -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.webConsoleFront.evaluateJS("throw " + value + ";")
const aResponse = await aState.webConsoleFront.evaluateJSAsync("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.webConsoleFront.evaluateJS("throw " + value + ";")
const aResponse = await aState.webConsoleFront.evaluateJSAsync("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.webConsoleFront.evaluateJS("throw '" + longString + "';")
const aResponse = await aState.webConsoleFront.evaluateJSAsync("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.webConsoleFront.evaluateJS("throw " + expr + ";");
const aResponse = await aState.webConsoleFront.evaluateJSAsync("throw " + expr + ";");
is(aResponse.exceptionMessage, message,
"response.exception for throw " + expr);
nextTest();