Bug 837052 - Editing or deleting getters and setters appears to be allowed even if no eval method is provided, r=past
authorVictor Porof <vporof@mozilla.com>
Thu, 07 Feb 2013 16:18:08 +0200
changeset 121203 c5150471ee4b0c57a6bd104e967dcb33557fadb1
parent 121202 a5e27326941f271f79ed3ae3ee2edf923ca697c4
child 121204 417db52470903c84147230d5e5fff90f6bfcc4de
push id24277
push userpastithas@mozilla.com
push dateFri, 08 Feb 2013 09:45:19 +0000
treeherdermozilla-central@6a2bebec5914 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs837052
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 837052 - Editing or deleting getters and setters appears to be allowed even if no eval method is provided, r=past
browser/devtools/shared/VariablesView.jsm
browser/themes/winstripe/devtools/debugger.css
--- a/browser/devtools/shared/VariablesView.jsm
+++ b/browser/devtools/shared/VariablesView.jsm
@@ -2135,18 +2135,30 @@ create({ constructor: Variable, proto: S
 
     if (isPrimitive || isUndefined) {
       this.hideArrow();
     }
     if (!isUndefined && (descriptor.get || descriptor.set)) {
       separatorLabel.hidden = true;
       valueLabel.hidden = true;
 
-      this.delete = VariablesView.getterOrSetterDeleteCallback;
-      this.evaluationMacro = VariablesView.overrideValueEvalMacro;
+      // Changing getter/setter names is never allowed.
+      this.switch = null;
+
+      // Getter/setter properties require special handling when it comes to
+      // evaluation and deletion.
+      if (this.ownerView.eval) {
+        this.delete = VariablesView.getterOrSetterDeleteCallback;
+        this.evaluationMacro = VariablesView.overrideValueEvalMacro;
+      }
+      // Deleting getters and setters individually is not allowed if no
+      // evaluation method is provided.
+      else {
+        this.delete = null;
+      }
 
       let getter = this.addProperty("get", { value: descriptor.get });
       let setter = this.addProperty("set", { value: descriptor.set });
       getter.evaluationMacro = VariablesView.getterOrSetterEvalMacro;
       setter.evaluationMacro = VariablesView.getterOrSetterEvalMacro;
 
       getter.hideArrow();
       setter.hideArrow();
--- a/browser/themes/winstripe/devtools/debugger.css
+++ b/browser/themes/winstripe/devtools/debugger.css
@@ -423,17 +423,16 @@
 
 .property:not(:focus) > .title > .name {
   color: #881090;
 }
 
 .property > .title > .value {
   -moz-padding-start: 6px;
   -moz-padding-end: 4px;
-  cursor: text;
 }
 
 .property[editable] > .title > .value {
   cursor: text;
 }
 
 .property:not([non-header]) > .details {
   -moz-margin-start: 10px;