Bug 1687205 - [devtools] Use the network event actor id when getting stacktraces r=ochameau,devtools-backward-compat-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D102116
This commit is contained in:
Hubert Boma Manilla 2021-01-18 12:50:14 +00:00
Родитель f62c623e39
Коммит 2f728bd220
3 изменённых файлов: 42 добавлений и 36 удалений

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

@ -518,38 +518,44 @@ class FirefoxDataProvider {
// Emit event that tell we just start fetching some data
this.emitForTests(EVENTS[updatingEventName], actor);
let response = await new Promise((resolve, reject) => {
// Do a RDP request to fetch data from the actor.
if (
clientMethodName == "getStackTrace" &&
this.resourceWatcher.hasResourceWatcherSupport(
this.resourceWatcher.TYPES.NETWORK_EVENT_STACKTRACE
)
) {
const requestInfo = this.stackTraceRequestInfoByActorID.get(actor);
resolve(this._getStackTraceFromWatcher(requestInfo));
} else 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.webConsoleFront[clientMethodName](
actor.replace("-clone", ""),
res => {
if (res.error) {
reject(
new Error(
`Error while calling method ${clientMethodName}: ${res.message}`
)
);
let response;
if (
clientMethodName == "getStackTrace" &&
this.resourceWatcher.hasResourceWatcherSupport(
this.resourceWatcher.TYPES.NETWORK_EVENT_STACKTRACE
)
) {
const requestInfo = this.stackTraceRequestInfoByActorID.get(
actor.replace("-clone", "")
);
const { stacktrace } = await this._getStackTraceFromWatcher(requestInfo);
response = { from: actor, stacktrace };
} else {
response = await new Promise((resolve, reject) => {
// Do a RDP request to fetch data from the actor.
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.webConsoleFront[clientMethodName](
actor.replace("-clone", ""),
res => {
if (res.error) {
reject(
new Error(
`Error while calling method ${clientMethodName}: ${res.message}`
)
);
}
resolve(res);
}
resolve(res);
}
);
} else {
reject(
new Error(`Error: No such client method '${clientMethodName}'!`)
);
}
});
);
} else {
reject(
new Error(`Error: No such client method '${clientMethodName}'!`)
);
}
});
}
// Restore clone actor id
if (actor.includes("-clone")) {

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

@ -137,9 +137,7 @@ const NetworkContentActor = ActorClassWithSpec(networkContentSpec, {
const stacktrace = this.networkEventStackTraceWatcher.getStackTrace(
resourceId
);
return {
stacktrace: WebConsoleUtils.removeFramesAboveDebuggerEval(stacktrace),
};
return WebConsoleUtils.removeFramesAboveDebuggerEval(stacktrace);
},
});

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

@ -17,8 +17,10 @@ const networkContentSpec = generateActorSpec({
},
getStackTrace: {
request: { resourceId: Arg(0) },
// stacktrace is an "array:string", but not always.
response: RetVal("json"),
response: {
// stacktrace is an "array:string", but not always.
stacktrace: RetVal("json"),
},
},
},
});