Bug 1643961 - Remove the backwards compatibility check for CompatibilityActor r=daisuke,mtigley

The backwards compatibility checks existed to support devtools
backend for version older than FF79. Now that FF79 has hit the
release channel, these tests for older backend can be removed.

Differential Revision: https://phabricator.services.mozilla.com/D86142
This commit is contained in:
Kriyszig 2020-08-06 22:39:57 +00:00
Родитель 98e23587ae
Коммит 5808376a46
2 изменённых файлов: 6 добавлений и 52 удалений

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

@ -80,15 +80,8 @@ class InspectorFront extends FrontClassWithSpec(inspectorSpec) {
}
async getCompatibilityFront() {
// DevTools supports a Compatibility actor from version FF79 and above.
// This check exists to maintain backwards compatibility with older
// backend. This check can be removed once FF79 hits the release channel.
if (this._compatibility === undefined) {
try {
this._compatibility = await super.getCompatibility();
} catch (error) {
this._compatibility = null;
}
if (!this._compatibility) {
this._compatibility = await super.getCompatibility();
}
return this._compatibility;

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

@ -6,12 +6,6 @@
const nodeConstants = require("devtools/shared/dom-node-constants");
loader.lazyGetter(this, "mdnCompatibility", () => {
const MDNCompatibility = require("devtools/shared/compatibility/MDNCompatibility");
const cssPropertiesCompatData = require("devtools/shared/compatibility/dataset/css-properties.json");
return new MDNCompatibility(cssPropertiesCompatData);
});
const UserSettings = require("devtools/client/inspector/compatibility/UserSettings");
const {
@ -251,44 +245,11 @@ function updateNode(node) {
}
async function _getNodeIssues(node, targetBrowsers) {
let declarationBlocksIssues = [];
const compatibility = await node.inspectorFront.getCompatibilityFront();
// Starting with FF79, DevTools include a separate CompatibilityActor to
// fetch compatibility issues for the given DOM node. This check exists
// to maintain backwards compatibility with FF version < 79 and can be
// safely removed once FF79 hits the release channel.
if (compatibility) {
declarationBlocksIssues = await compatibility.getNodeCssIssues(
node,
targetBrowsers
);
} else {
const pageStyle = node.inspectorFront.pageStyle;
const styles = await pageStyle.getApplied(node, {
skipPseudo: false,
});
const declarationBlocks = styles
.map(({ rule }) => rule.declarations.filter(d => !d.commentOffsets))
.filter(declarations => declarations.length);
declarationBlocksIssues = declarationBlocks
.map(declarationBlock =>
mdnCompatibility.getCSSDeclarationBlockIssues(
declarationBlock,
targetBrowsers
)
)
.flat()
.reduce((issues, issue) => {
// Get rid of duplicate issue
return issues.find(
i => i.type === issue.type && i.property === issue.property
)
? issues
: [...issues, issue];
}, []);
}
const declarationBlocksIssues = await compatibility.getNodeCssIssues(
node,
targetBrowsers
);
return declarationBlocksIssues;
}