Bug 1808870 - [devtools] Remove unused media-rules-changed event and getMediaRules r=devtools-reviewers,devtools-backward-compat-reviewers,nchevobbe

Depends on D166139

This is one of the easiest actors to unplug, and it has very little connections to the rest, so doing it early in the stack

Differential Revision: https://phabricator.services.mozilla.com/D166141
This commit is contained in:
Julian Descottes 2023-01-17 08:06:13 +00:00
Родитель 5f0353facc
Коммит 528a29e9eb
2 изменённых файлов: 0 добавлений и 55 удалений

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

@ -8,9 +8,6 @@ const protocol = require("resource://devtools/shared/protocol.js");
const {
LongStringActor,
} = require("resource://devtools/server/actors/string.js");
const {
MediaRuleActor,
} = require("resource://devtools/server/actors/media-rule.js");
const { fetch } = require("resource://devtools/shared/DevToolsUtils.js");
const {
styleSheetSpec,
@ -456,41 +453,6 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
});
},
/**
* Protocol method to get the media rules for the stylesheet.
*/
getMediaRules() {
return this._getMediaRules();
},
/**
* Get all the @media rules in this stylesheet.
*
* @return {promise}
* A promise that resolves with an array of MediaRuleActors.
*/
_getMediaRules() {
const mediaRules = [];
const traverseRules = ruleList => {
for (const rule of ruleList) {
if (rule.type === CSSRule.MEDIA_RULE) {
const actor = new MediaRuleActor(rule, this);
this.manage(actor);
mediaRules.push(actor);
}
if (rule.cssRules) {
traverseRules(rule.cssRules);
}
}
};
return this.getCSSRules().then(rules => {
traverseRules(rules);
return mediaRules;
});
},
/**
* Update the style sheet in place with new text.
*
@ -515,10 +477,6 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, {
} else {
this.emit("style-applied", kind, this, cause);
}
this._getMediaRules().then(rules => {
this.emit("media-rules-changed", rules);
});
},
/**

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

@ -10,9 +10,6 @@ const {
types,
} = require("resource://devtools/shared/protocol.js");
// Load the "mediarule" type used in this file.
require("resource://devtools/shared/specs/media-rule.js");
types.addActorType("stylesheet");
const styleSheetSpec = generateActorSpec({
@ -30,10 +27,6 @@ const styleSheetSpec = generateActorSpec({
styleSheet: Arg(1, "stylesheet"),
cause: Arg(2, "nullable:string"),
},
"media-rules-changed": {
type: "mediaRulesChanged",
rules: Arg(0, "array:mediarule"),
},
},
methods: {
@ -46,12 +39,6 @@ const styleSheetSpec = generateActorSpec({
text: RetVal("longstring"),
},
},
getMediaRules: {
request: {},
response: {
mediaRules: RetVal("nullable:array:mediarule"),
},
},
},
});