Bug 1746366 - [devtools] Remove outdated backward compat code from debugger frontend. r=nchevobbe

* SourceActor's introductionUrl has been removed in Fx77 in bug 1607639.
* getBreakableLines has been added in Fx68 in bug 1537779.
* getAvailableEventBreakpoints changed to return an array in Fx69 in bug 1549999.

Differential Revision: https://phabricator.services.mozilla.com/D134003
This commit is contained in:
Alexandre Poirot 2021-12-21 09:15:31 +00:00
Родитель 26b695c671
Коммит 6dad0dbd64
2 изменённых файлов: 4 добавлений и 41 удалений

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

@ -156,17 +156,6 @@ async function onSourceAvailable(sources) {
})
.map(async sourceFront => {
const threadFront = await sourceFront.targetFront.getFront("thread");
// Maintain backward-compat with servers that only return introductionUrl and
// not sourceMapBaseURL.
if (
typeof sourceFront.sourceMapBaseURL === "undefined" &&
typeof sourceFront.introductionUrl !== "undefined"
) {
sourceFront.sourceMapBaseURL =
sourceFront.url || sourceFront.introductionUrl || null;
delete sourceFront.introductionUrl;
}
return { thread: threadFront.actor, sourceFront };
})
);

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

@ -355,23 +355,7 @@ async function setEventListenerBreakpoints(ids) {
}
async function getEventListenerBreakpointTypes() {
let categories;
try {
categories = await currentThreadFront().getAvailableEventBreakpoints();
if (!Array.isArray(categories)) {
// When connecting to older browser that had our placeholder
// implementation of the 'getAvailableEventBreakpoints' endpoint, we
// actually get back an object with a 'value' property containing
// the categories. Since that endpoint wasn't actually backed with a
// functional implementation, we just bail here instead of storing the
// 'value' property into the categories.
categories = null;
}
} catch (err) {
// Event bps aren't supported on this firefox version.
}
return categories || [];
return currentThreadFront().getAvailableEventBreakpoints();
}
function pauseGrip(thread, func) {
@ -407,24 +391,14 @@ async function getSourceActorBreakpointPositions({ thread, actor }, range) {
}
async function getSourceActorBreakableLines({ thread, actor }) {
let sourceFront;
let actorLines = [];
try {
const sourceThreadFront = lookupThreadFront(thread);
sourceFront = sourceThreadFront.source({ actor });
const sourceFront = sourceThreadFront.source({ actor });
actorLines = await sourceFront.getBreakableLines();
} catch (e) {
// Handle backward compatibility
if (
e.message &&
e.message.match(/does not recognize the packet type getBreakableLines/)
) {
const pos = await sourceFront.getBreakpointPositionsCompressed();
actorLines = Object.keys(pos).map(line => Number(line));
} else {
// Other exceptions could be due to the target thread being shut down.
console.warn(`getSourceActorBreakableLines failed: ${e}`);
}
// Exceptions could be due to the target thread being shut down.
console.warn(`getSourceActorBreakableLines failed: ${e}`);
}
return actorLines;