mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 16:25:38 +00:00
Bug 1602709 - Remove unused DebuggerClient.close onClosed parameter. r=ladybenko.
Differential Revision: https://phabricator.services.mozilla.com/D56562 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
48455f980b
commit
155891ddb2
@ -1,61 +1,46 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
/* eslint-disable no-shadow, max-nested-callbacks */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test that we can detect nested event loops in tabs with the same URL.
|
||||
|
||||
var gClient1, gClient2, gThreadFront1, gThreadFront2;
|
||||
add_task(async function() {
|
||||
const GLOBAL_NAME = "test-nesting1";
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
addTestGlobal("test-nesting1");
|
||||
addTestGlobal("test-nesting1");
|
||||
addTestGlobal(GLOBAL_NAME);
|
||||
addTestGlobal(GLOBAL_NAME);
|
||||
// Conect the first client to the first debuggee.
|
||||
gClient1 = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient1.connect(function() {
|
||||
attachTestThread(gClient1, "test-nesting1", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadFront
|
||||
) {
|
||||
gThreadFront1 = threadFront;
|
||||
start_second_connection();
|
||||
});
|
||||
});
|
||||
do_test_pending();
|
||||
}
|
||||
const firstClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await firstClient.connect();
|
||||
const { threadFront: firstThreadFront } = await attachTestThread(
|
||||
firstClient,
|
||||
GLOBAL_NAME
|
||||
);
|
||||
|
||||
function start_second_connection() {
|
||||
gClient2 = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
gClient2.connect(function() {
|
||||
attachTestThread(gClient2, "test-nesting1", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadFront
|
||||
) {
|
||||
gThreadFront2 = threadFront;
|
||||
test_nesting();
|
||||
});
|
||||
});
|
||||
}
|
||||
const secondClient = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await secondClient.connect();
|
||||
const { threadFront: secondThreadFront } = await attachTestThread(
|
||||
secondClient,
|
||||
GLOBAL_NAME
|
||||
);
|
||||
|
||||
async function test_nesting() {
|
||||
let result;
|
||||
try {
|
||||
result = await gThreadFront1.resume();
|
||||
result = await firstThreadFront.resume();
|
||||
} catch (e) {
|
||||
Assert.ok(e.includes("wrongOrder"), "rejects with the wrong order");
|
||||
}
|
||||
Assert.ok(!result, "no response");
|
||||
|
||||
result = await gThreadFront2.resume();
|
||||
result = await secondThreadFront.resume();
|
||||
Assert.ok(true, "resumed as expected");
|
||||
|
||||
gThreadFront1.resume().then(response => {
|
||||
Assert.ok(true, "resumed as expected");
|
||||
await firstThreadFront.resume();
|
||||
|
||||
gClient1.close(() => finishClient(gClient2));
|
||||
});
|
||||
}
|
||||
Assert.ok(true, "resumed as expected");
|
||||
await firstClient.close();
|
||||
|
||||
await finishClient(secondClient);
|
||||
});
|
||||
|
@ -3,14 +3,17 @@
|
||||
const run_test = Test(async function() {
|
||||
initTestDebuggerServer();
|
||||
const connection = DebuggerServer.connectPipe();
|
||||
const client = Async(new DebuggerClient(connection));
|
||||
const client = new DebuggerClient(connection);
|
||||
|
||||
await client.connect();
|
||||
|
||||
const response = await client.mainRoot.protocolDescription();
|
||||
|
||||
assert(response.from == "root");
|
||||
assert(typeof response.types === "object");
|
||||
assert(response.from == "root", "response.from has expected value");
|
||||
assert(
|
||||
typeof response.types === "object",
|
||||
"response.types has expected type"
|
||||
);
|
||||
|
||||
await client.close();
|
||||
});
|
||||
|
@ -120,14 +120,10 @@ DebuggerClient.prototype = {
|
||||
/**
|
||||
* Shut down communication with the debugging server.
|
||||
*
|
||||
* @param onClosed function
|
||||
* If specified, will be called when the debugging connection
|
||||
* has been closed. This parameter is deprecated - please use
|
||||
* the returned Promise.
|
||||
* @return Promise
|
||||
* Resolves after the underlying transport is closed.
|
||||
*/
|
||||
close(onClosed) {
|
||||
close() {
|
||||
const promise = new Promise(resolve => {
|
||||
// Disable detach event notifications, because event handlers will be in a
|
||||
// cleared scope by the time they run.
|
||||
@ -154,10 +150,6 @@ DebuggerClient.prototype = {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
if (onClosed) {
|
||||
promise.then(onClosed);
|
||||
}
|
||||
|
||||
return promise;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user