Open Bug 1602817 Opened 5 years ago Updated 4 years ago

Simplify should pause logic

Categories

(DevTools :: Debugger, task, P3)

task

Tracking

(Not tracked)

People

(Reporter: jlast, Unassigned)

References

(Blocks 1 open bug)

Details

We now have a couple of rules for pausing (different locations, skipBreakpoints) spread out over GET/SET. It'd be nice to consolidate that

diff --git a/devtools/server/actors/object.js b/devtools/server/actors/object.js
index d1787083facbe..f2aae409d2256 100644
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -143,6 +143,14 @@ const proto = {
       });
     };
+    const shouldSkipPause = () => {
+      const frame = this.thread.dbg.getNewestFrame();
+      const hasMoved = this.thread.hasMoved(frame, "getWatchpoint");
+      const skipBreakpoints = this.thread.skipBreakpoints;
+
+      return skipBreakpoints || !hasMoved;
+    };
+
     if (watchpointType === "get") {
       this.obj.defineProperty(property, {
         configurable: desc.configurable,
@@ -151,10 +159,8 @@ const proto = {
           desc.value = v;
         }),
         get: this.obj.makeDebuggeeValue(() => {
-          const frame = this.thread.dbg.getNewestFrame();
-
-          if (!this.thread.hasMoved(frame, "getWatchpoint")) {
-            return false;
+          if (shouldSkipPause()) {
+            return desc.value;
           }
           pauseAndRespond("getWatchpoint");
@@ -168,9 +174,7 @@ const proto = {
         configurable: desc.configurable,
         enumerable: desc.enumerable,
         set: this.obj.makeDebuggeeValue(v => {
-          const frame = this.thread.dbg.getNewestFrame();
-
-          if (!this.thread.hasMoved(frame, "setWatchpoint")) {
+          if (shouldPause()) {
             return;
           }
Severity: normal → S3
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.