Bug 1763359 - [devtools] Remove backward compat code using outerWindowID. r=ochameau.

Depends on D143025

Differential Revision: https://phabricator.services.mozilla.com/D143026
This commit is contained in:
Nicolas Chevobbe 2022-04-12 11:59:30 +00:00
Родитель 8ab74459f2
Коммит 5527d8f73c
4 изменённых файлов: 15 добавлений и 48 удалений

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

@ -27,8 +27,7 @@ const tabComponentDataMiddleware = store => next => action => {
function toComponentData(tabs) {
return tabs.map(tab => {
const type = DEBUG_TARGETS.TAB;
// @backward-compat { version 99 } The fallback to outerWindowID can be removed once 100 is released
const id = tab.browserId || "outerID-" + tab.outerWindowID;
const id = tab.browserId;
const icon = tab.favicon
? `data:image/png;base64,${btoa(
String.fromCharCode.apply(String, tab.favicon)

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

@ -83,45 +83,22 @@ async function _descriptorFromURL(client, id, type) {
let descriptorFront;
if (type === "tab") {
// For remote debugging, about:debugging currently pass a browserId for remote Fx>=99
// or an outerWindowID for remote Fx <99
// @backward-compat { version 99 } This fallback to outerWindowID can be removed once 100 is released
if (id.startsWith("outerID-")) {
let outerWindowID = id.replace("outerID-", "");
if (isNaN(outerWindowID)) {
// Fetch target for a remote tab
id = parseInt(id, 10);
if (isNaN(id)) {
throw new Error(
`descriptorFromURL, wrong tab id '${id}', should be a number`
);
}
try {
descriptorFront = await client.mainRoot.getTab({ browserId: id });
} catch (ex) {
if (ex.message.startsWith("Protocol error (noTab)")) {
throw new Error(
`descriptorFromURL, wrong tab id '${outerWindowID}', should be a number`
`descriptorFromURL, tab with browserId '${id}' doesn't exist`
);
}
outerWindowID = parseInt(outerWindowID, 10);
try {
descriptorFront = await client.mainRoot.getTab({ outerWindowID });
} catch (ex) {
if (ex.message.startsWith("Protocol error (noTab)")) {
throw new Error(
`descriptorFromURL, tab with outerWindowID '${outerWindowID}' doesn't exist`
);
}
throw ex;
}
} else {
// Fetch target for a remote tab
id = parseInt(id, 10);
if (isNaN(id)) {
throw new Error(
`descriptorFromURL, wrong tab id '${id}', should be a number`
);
}
try {
descriptorFront = await client.mainRoot.getTab({ browserId: id });
} catch (ex) {
if (ex.message.startsWith("Protocol error (noTab)")) {
throw new Error(
`descriptorFromURL, tab with browserId '${id}' doesn't exist`
);
}
throw ex;
}
throw ex;
}
} else if (type === "extension") {
descriptorFront = await client.mainRoot.getAddon({ id });

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

@ -183,11 +183,6 @@ class TabDescriptorFront extends DescriptorMixin(
return this._form.browserId;
}
// @backward-compat { version 99 } This outerWindowID attribute can be removed once 100 is released
get outerWindowID() {
return this._form.outerWindowID;
}
get selected() {
return this._form.selected;
}

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

@ -212,8 +212,7 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
*
* @param [optional] object filter
* A dictionary object with following optional attributes:
* - browserId: use to match any tab (should become the new way to identify any remote tab)
* - outerWindowID: used to match tabs in parent process (obsolete, use browserId)
* - browserId: use to match any tab
* - tab: a reference to xul:tab element (used for local tab debugging)
* - isWebExtension: an optional boolean to flag TabDescriptors
* If nothing is specified, returns the actor for the currently
@ -224,9 +223,6 @@ class RootFront extends FrontClassWithSpec(rootSpec) {
if (filter) {
if (typeof filter.browserId == "number") {
packet.browserId = filter.browserId;
} else if (typeof filter.outerWindowID == "number") {
// @backward-compat { version 99 } The branch related to outerWindowID can be removed once 100 is released
packet.outerWindowID = filter.outerWindowID;
} else if ("tab" in filter) {
const browser = filter.tab.linkedBrowser;
packet.browserId = browser.browserId;