зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1494796 - get rid of ThreadClient specifics in DebuggerClient, interrupt method; r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D32847 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
844b51e01a
Коммит
2e3fde9d0e
|
@ -553,7 +553,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
const pkt = onPacket(packet);
|
const pkt = onPacket(packet);
|
||||||
|
|
||||||
this._priorPause = pkt;
|
this._priorPause = pkt;
|
||||||
this.conn.send(pkt);
|
this.conn.sendActorEvent(this.actorID, "paused", pkt);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
reportError(error);
|
reportError(error);
|
||||||
this.conn.send({
|
this.conn.send({
|
||||||
|
@ -1151,31 +1151,30 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
/**
|
/**
|
||||||
* Handle a protocol request to pause the debuggee.
|
* Handle a protocol request to pause the debuggee.
|
||||||
*/
|
*/
|
||||||
onInterrupt: function(request) {
|
onInterrupt: function({when}) {
|
||||||
if (this.state == "exited") {
|
if (this.state == "exited") {
|
||||||
return { type: "exited" };
|
return { type: "exited" };
|
||||||
} else if (this.state == "paused") {
|
} else if (this.state == "paused") {
|
||||||
// TODO: return the actual reason for the existing pause.
|
// TODO: return the actual reason for the existing pause.
|
||||||
return { type: "paused", why: { type: "alreadyPaused" } };
|
this.conn.sendActorEvent(this.actorID, "paused", { why: { type: "alreadyPaused" }});
|
||||||
|
return {};
|
||||||
} else if (this.state != "running") {
|
} else if (this.state != "running") {
|
||||||
return { error: "wrongState",
|
return { error: "wrongState",
|
||||||
message: "Received interrupt request in " + this.state +
|
message: "Received interrupt request in " + this.state +
|
||||||
" state." };
|
" state." };
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// If execution should pause just before the next JavaScript bytecode is
|
// If execution should pause just before the next JavaScript bytecode is
|
||||||
// executed, just set an onEnterFrame handler.
|
// executed, just set an onEnterFrame handler.
|
||||||
if (request.when == "onNext" && !this.dbg.replaying) {
|
if (when == "onNext" && !this.dbg.replaying) {
|
||||||
const onEnterFrame = (frame) => {
|
const onEnterFrame = (frame) => {
|
||||||
return this._pauseAndRespond(frame, { type: "interrupted", onNext: true });
|
this._pauseAndRespond(frame, { type: "interrupted", onNext: true });
|
||||||
};
|
};
|
||||||
this.dbg.onEnterFrame = onEnterFrame;
|
this.dbg.onEnterFrame = onEnterFrame;
|
||||||
|
|
||||||
this.conn.sendActorEvent(this.actorID, "willInterrupt");
|
this.conn.sendActorEvent(this.actorID, "willInterrupt");
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.dbg.replaying) {
|
if (this.dbg.replaying) {
|
||||||
this.dbg.replayPause();
|
this.dbg.replayPause();
|
||||||
}
|
}
|
||||||
|
@ -1194,7 +1193,8 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||||
// Send the response to the interrupt request now (rather than
|
// Send the response to the interrupt request now (rather than
|
||||||
// returning it), because we're going to start a nested event loop
|
// returning it), because we're going to start a nested event loop
|
||||||
// here.
|
// here.
|
||||||
this.conn.send(packet);
|
this.conn.send({from: this.actorID, type: "interrupt"});
|
||||||
|
this.conn.sendActorEvent(this.actorID, "paused", packet);
|
||||||
|
|
||||||
// Start a nested event loop.
|
// Start a nested event loop.
|
||||||
this._pushThreadPause();
|
this._pushThreadPause();
|
||||||
|
|
|
@ -40,12 +40,12 @@ async function test_nesting() {
|
||||||
try {
|
try {
|
||||||
await gThreadClient1.resume();
|
await gThreadClient1.resume();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Assert.equal(e.error, "wrongOrder");
|
Assert.ok(e.includes("wrongOrder"));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await gThreadClient2.resume();
|
await gThreadClient2.resume();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Assert.ok(!e.error);
|
Assert.ok(!e);
|
||||||
}
|
}
|
||||||
|
|
||||||
gThreadClient1.resume().then(response => {
|
gThreadClient1.resume().then(response => {
|
||||||
|
|
|
@ -72,7 +72,6 @@ const threadSpec = generateActorSpec({
|
||||||
request: {
|
request: {
|
||||||
when: Arg(0, "json"),
|
when: Arg(0, "json"),
|
||||||
},
|
},
|
||||||
response: RetVal("nullable:json"),
|
|
||||||
},
|
},
|
||||||
sources: {
|
sources: {
|
||||||
response: RetVal("array:json"),
|
response: RetVal("array:json"),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче