Bug 1680218 - [devtools] Remove supportResourceRequests trait in StyleSheetActor. r=daisuke.

The trait was added in 81, so we can safely remove it now.

Differential Revision: https://phabricator.services.mozilla.com/D98491
This commit is contained in:
Nicolas Chevobbe 2020-12-09 06:24:59 +00:00
Родитель 5dac76356c
Коммит 0093051061
2 изменённых файлов: 11 добавлений и 34 удалений

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

@ -276,16 +276,12 @@ StyleSheetEditor.prototype = {
*/
async _getSourceTextAndPrettify() {
const styleSheetsFront = await this._getStyleSheetsFront();
const traits = await styleSheetsFront.getTraits();
let longStr = null;
if (this.styleSheet.isOriginalSource) {
// If the stylesheet is OriginalSource, we should get the texts from SourceMapService.
// So, for now, we use OriginalSource.getText() as it is.
longStr = await this.styleSheet.getText();
} else if (!traits.supportResourceRequests) {
// @backward-compat { version 81 } Older server don't support resource requests.
longStr = await this.styleSheet.getText();
} else {
longStr = await styleSheetsFront.getText(this.resourceId);
}
@ -556,13 +552,7 @@ StyleSheetEditor.prototype = {
*/
async toggleDisabled() {
const styleSheetsFront = await this._getStyleSheetsFront();
const traits = await styleSheetsFront.getTraits();
if (traits.supportResourceRequests) {
styleSheetsFront.toggleDisabled(this.resourceId).catch(console.error);
} else {
this.styleSheet.toggleDisabled().catch(console.error);
}
styleSheetsFront.toggleDisabled(this.resourceId).catch(console.error);
},
/**
@ -608,17 +598,12 @@ StyleSheetEditor.prototype = {
try {
const styleSheetsFront = await this._getStyleSheetsFront();
const traits = await styleSheetsFront.getTraits();
await styleSheetsFront.update(
this.resourceId,
this._state.text,
this.transitionsEnabled
);
if (traits.supportResourceRequests) {
await styleSheetsFront.update(
this.resourceId,
this._state.text,
this.transitionsEnabled
);
} else {
await this.styleSheet.update(this._state.text, this.transitionsEnabled);
}
// Clear any existing mappings from automatic CSS prettification
// because they were likely invalided by manually editing the stylesheet.
this._mappings = null;
@ -823,18 +808,12 @@ StyleSheetEditor.prototype = {
this._isUpdating = true;
const styleSheetsFront = await this._getStyleSheetsFront();
const traits = await styleSheetsFront.getTraits();
if (traits.supportResourceRequests) {
await styleSheetsFront.update(
this.resourceId,
text,
this.transitionsEnabled
);
} else {
const relatedSheet = this.styleSheet.relatedStyleSheet;
await relatedSheet.update(text, this.transitionsEnabled);
}
await styleSheetsFront.update(
this.resourceId,
text,
this.transitionsEnabled
);
}, this.markLinkedFileBroken);
},

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

@ -58,8 +58,6 @@ var StyleSheetsActor = protocol.ActorClassWithSpec(styleSheetsSpec, {
traits: {
// @backward-compat { version 81 } addStyleSheet now supports file name parameter.
isFileNameSupported: true,
// @backward-compat { version 81 } resource requesting supports.
supportResourceRequests: true,
},
};
},