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) { function toComponentData(tabs) {
return tabs.map(tab => { return tabs.map(tab => {
const type = DEBUG_TARGETS.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;
const id = tab.browserId || "outerID-" + tab.outerWindowID;
const icon = tab.favicon const icon = tab.favicon
? `data:image/png;base64,${btoa( ? `data:image/png;base64,${btoa(
String.fromCharCode.apply(String, tab.favicon) String.fromCharCode.apply(String, tab.favicon)

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

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

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

@ -183,11 +183,6 @@ class TabDescriptorFront extends DescriptorMixin(
return this._form.browserId; 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() { get selected() {
return this._form.selected; return this._form.selected;
} }

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

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