зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1622219 - Stop returning any value from ThreadActor.attach. r=jdescottes
We weren't actually returning any value. The only case when we return something is when the RDP method throws and return an object response with an "error" attribute. I imagine this has been refactored incorectly from old style actor to protocol.js. We should throw in case of errors if we want to transfer a RDP message with "error" attribute. Differential Revision: https://phabricator.services.mozilla.com/D66132 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3130556e78
Коммит
9a3be4d3ab
|
@ -4,6 +4,10 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// protocol.js uses objects as exceptions in order to define
|
||||
// error packets.
|
||||
/* eslint-disable no-throw-literal */
|
||||
|
||||
const DebuggerNotificationObserver = require("DebuggerNotificationObserver");
|
||||
const Services = require("Services");
|
||||
const { Cr, Ci } = require("chrome");
|
||||
|
@ -341,14 +345,14 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
// Request handlers
|
||||
onAttach: function({ options }) {
|
||||
if (this.state === "exited") {
|
||||
return {
|
||||
throw {
|
||||
error: "exited",
|
||||
message: "threadActor has exited",
|
||||
};
|
||||
}
|
||||
|
||||
if (this.state !== "detached") {
|
||||
return {
|
||||
throw {
|
||||
error: "wrongState",
|
||||
message: "Current state is " + this.state,
|
||||
};
|
||||
|
@ -395,7 +399,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
// Put ourselves in the paused state.
|
||||
const packet = this._paused();
|
||||
if (!packet) {
|
||||
return {
|
||||
throw {
|
||||
error: "notAttached",
|
||||
message: "cannot attach, could not create pause packet",
|
||||
};
|
||||
|
@ -411,12 +415,12 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
|||
// Start a nested event loop.
|
||||
this._pushThreadPause();
|
||||
|
||||
// We already sent a response to this request, don't send one
|
||||
// now
|
||||
return null;
|
||||
// We already sent a response to this request via this.conn.send(),
|
||||
// don't send one now. But protocol.js probably still emits a second
|
||||
// empty packet.
|
||||
} catch (e) {
|
||||
reportException("DBG-SERVER", e);
|
||||
return {
|
||||
throw {
|
||||
error: "notAttached",
|
||||
message: e.toString(),
|
||||
};
|
||||
|
|
|
@ -208,15 +208,9 @@ class ThreadFront extends FrontClassWithSpec(threadSpec) {
|
|||
* attach to the thread actor.
|
||||
*/
|
||||
async attach(options) {
|
||||
let response;
|
||||
try {
|
||||
const onPaused = this.once("paused");
|
||||
response = await super.attach(options);
|
||||
await onPaused;
|
||||
} catch (e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
return response;
|
||||
const onPaused = this.once("paused");
|
||||
await super.attach(options);
|
||||
await onPaused;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,7 +73,7 @@ const threadSpec = generateActorSpec({
|
|||
request: {
|
||||
options: Arg(0, "json"),
|
||||
},
|
||||
response: RetVal("nullable:json"),
|
||||
response: {},
|
||||
},
|
||||
detach: {
|
||||
request: {},
|
||||
|
|
Загрузка…
Ссылка в новой задаче