Commit b34f3393 authored by Nicolas Chevobbe's avatar Nicolas Chevobbe
Browse files

Bug 1842197 - [devtools] Limit reads of...

Bug 1842197 - [devtools] Limit reads of devtools.inspector.ruleview.inline-compatibility-warning.enabled. r=devtools-reviewers,ochameau, a=pascalc

We already have a pref observer for the pref,
so we can store the pref value on the RuleView
instance and check this property instead of
using Services.prefs.

Differential Revision: https://phabricator.services.mozilla.com/D183001
parent 8add6a89
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -243,6 +243,8 @@ function CssRuleView(inspector, document, store) {
    this._handleDefaultColorUnitPrefChange
  );
  this._prefObserver.on(PREF_DRAGGABLE, this._handleDraggablePrefChange);
  // Initialize value of this.draggablePropertiesEnabled
  this._handleDraggablePrefChange();

  this.pseudoClassCheckboxes = this._createPseudoClassCheckboxes();
  this.showUserAgentStyles = Services.prefs.getBoolPref(PREF_UA_STYLES);
@@ -725,6 +727,10 @@ CssRuleView.prototype = {
  },

  _handleDraggablePrefChange() {
    this.draggablePropertiesEnabled = Services.prefs.getBoolPref(
      PREF_DRAGGABLE,
      false
    );
    // This event is consumed by text-property-editor instances in order to
    // update their draggable behavior. Preferences observer are costly, so
    // we are forwarding the preference update via the EventEmitter.
+1 −6
Original line number Diff line number Diff line
@@ -1387,12 +1387,7 @@ TextPropertyEditor.prototype = {
   */
  _isDraggableProperty(textProperty) {
    // Check if the feature is explicitly disabled.
    if (
      !Services.prefs.getBoolPref(
        "devtools.inspector.draggable_properties",
        false
      )
    ) {
    if (!this.ruleView.draggablePropertiesEnabled) {
      return false;
    }
    // temporary way of fixing the bug when editing inline styles