From 02deacb80dd45a0b4b11642b0e42938f803c1662 Mon Sep 17 00:00:00 2001 From: Razvan Caliman Date: Wed, 3 Oct 2018 13:52:16 +0000 Subject: [PATCH] Bug 1496055 - Part 1: Remove outdated checks for StyleRuleActor.modifySelectorUnmatched; r=gl Since Firefox 41 it has been possible to add a rule with a selector which does not match an element. The checks of the existence of this functionality are outdated and can be safely removed. No supported old versions of Firefox make use of the previous functionality anymore. MozReview-Commit-ID: D5ZP09Ckeqd Differential Revision: https://phabricator.services.mozilla.com/D7597 --HG-- extra : moz-landing-system : lando --- .../client/inspector/rules/views/rule-editor.js | 11 ----------- devtools/server/actors/styles.js | 3 --- devtools/shared/fronts/styles.js | 15 +++------------ 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/devtools/client/inspector/rules/views/rule-editor.js b/devtools/client/inspector/rules/views/rule-editor.js index e5dac6012416..581f69b6a0ae 100644 --- a/devtools/client/inspector/rules/views/rule-editor.js +++ b/devtools/client/inspector/rules/views/rule-editor.js @@ -653,23 +653,12 @@ RuleEditor.prototype = { const ruleView = this.ruleView; const elementStyle = ruleView._elementStyle; const element = elementStyle.element; - const supportsUnmatchedRules = - this.rule.domRule.supportsModifySelectorUnmatched; this.isEditing = true; try { const response = await this.rule.domRule.modifySelector(element, value); - if (!supportsUnmatchedRules) { - this.isEditing = false; - - if (response) { - this.ruleView.refreshPanel(); - } - return; - } - // We recompute the list of applied styles, because editing a // selector might cause this rule's position to change. const applied = await elementStyle.pageStyle.getApplied(element, { diff --git a/devtools/server/actors/styles.js b/devtools/server/actors/styles.js index 0d1c0c2b8a4f..18dd55190684 100644 --- a/devtools/server/actors/styles.js +++ b/devtools/server/actors/styles.js @@ -1073,9 +1073,6 @@ var StyleRuleActor = protocol.ActorClassWithSpec(styleRuleSpec, { line: this.line || undefined, column: this.column, traits: { - // Whether the style rule actor implements the modifySelector2 method - // that allows for unmatched rule to be added - modifySelectorUnmatched: true, // Whether the style rule actor implements the setRuleText // method. canSetRuleText: this.canSetRuleText, diff --git a/devtools/shared/fronts/styles.js b/devtools/shared/fronts/styles.js index 18d22eb75e84..b24f4751811e 100644 --- a/devtools/shared/fronts/styles.js +++ b/devtools/shared/fronts/styles.js @@ -218,10 +218,6 @@ const StyleRuleFront = FrontClassWithSpec(styleRuleSpec, { return sheet ? sheet.nodeHref : ""; }, - get supportsModifySelectorUnmatched() { - return this._form.traits && this._form.traits.modifySelectorUnmatched; - }, - get canSetRuleText() { return this._form.traits && this._form.traits.canSetRuleText; }, @@ -270,15 +266,10 @@ const StyleRuleFront = FrontClassWithSpec(styleRuleSpec, { modifySelector: custom(async function(node, value) { let response; - if (this.supportsModifySelectorUnmatched) { - // If the debugee supports adding unmatched rules (post FF41) - if (this.canSetRuleText) { - response = await this.modifySelector2(node, value, true); - } else { - response = await this.modifySelector2(node, value); - } + if (this.canSetRuleText) { + response = await this.modifySelector2(node, value, true); } else { - response = await this._modifySelector(value); + response = await this.modifySelector2(node, value); } if (response.ruleProps) {