Follow-up review comment to r237652.
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Controllers / DebuggerManager.js
index 827263a..a5c3faf 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
+WI.DebuggerManager = class DebuggerManager extends WI.Object
 {
     constructor()
     {
         super();
 
-        DebuggerAgent.enable();
+        WI.notifications.addEventListener(WI.Notification.DebugUIEnabledDidChange, this._debugUIEnabledDidChange, this);
 
-        WebInspector.notifications.addEventListener(WebInspector.Notification.DebugUIEnabledDidChange, this._debugUIEnabledDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.DisabledStateDidChange, this._breakpointDisabledStateDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ConditionDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.IgnoreCountDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.AutoContinueDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.Breakpoint.addEventListener(WI.Breakpoint.Event.ActionsDidChange, this._handleBreakpointActionsDidChange, this);
 
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange, this._breakpointDisplayLocationDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointDisabledStateDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ConditionDidChange, this._breakpointEditablePropertyDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.IgnoreCountDidChange, this._breakpointEditablePropertyDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointEditablePropertyDidChange, this);
-        WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange, this._breakpointEditablePropertyDidChange, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
+        WI.timelineManager.addEventListener(WI.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
 
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart, this._timelineCapturingWillStart, this);
-        WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped, this._timelineCapturingStopped, this);
+        WI.targetManager.addEventListener(WI.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
 
-        WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved, this._targetRemoved, this);
+        WI.settings.pauseForInternalScripts.addEventListener(WI.Setting.Event.Changed, this._pauseForInternalScriptsDidChange, this);
 
-        WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
 
-        this._breakpointsSetting = new WebInspector.Setting("breakpoints", []);
-        this._breakpointsEnabledSetting = new WebInspector.Setting("breakpoints-enabled", true);
-        this._allExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-exceptions", false);
-        this._allUncaughtExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-uncaught-exceptions", false);
-        this._assertionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-assertions", false);
-        this._asyncStackTraceDepthSetting = new WebInspector.Setting("async-stack-trace-depth", 200);
+        this._breakpointsSetting = new WI.Setting("breakpoints", []);
+        this._breakpointsEnabledSetting = new WI.Setting("breakpoints-enabled", true);
+        this._allExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-all-exceptions", false);
+        this._uncaughtExceptionsBreakpointEnabledSetting = new WI.Setting("break-on-uncaught-exceptions", false);
+        this._assertionFailuresBreakpointEnabledSetting = new WI.Setting("break-on-assertion-failures", false);
+        this._asyncStackTraceDepthSetting = new WI.Setting("async-stack-trace-depth", 200);
 
-        let specialBreakpointLocation = new WebInspector.SourceCodeLocation(null, Infinity, Infinity);
+        let specialBreakpointLocation = new WI.SourceCodeLocation(null, Infinity, Infinity);
 
-        this._allExceptionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._allExceptionsBreakpointEnabledSetting.value);
+        this._allExceptionsBreakpoint = new WI.Breakpoint(specialBreakpointLocation, !this._allExceptionsBreakpointEnabledSetting.value);
         this._allExceptionsBreakpoint.resolved = true;
 
-        this._allUncaughtExceptionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._allUncaughtExceptionsBreakpointEnabledSetting.value);
+        this._uncaughtExceptionsBreakpoint = new WI.Breakpoint(specialBreakpointLocation, !this._uncaughtExceptionsBreakpointEnabledSetting.value);
 
-        this._assertionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._assertionsBreakpointEnabledSetting.value);
-        this._assertionsBreakpoint.resolved = true;
+        this._assertionFailuresBreakpoint = new WI.Breakpoint(specialBreakpointLocation, !this._assertionFailuresBreakpointEnabledSetting.value);
+        this._assertionFailuresBreakpoint.resolved = true;
 
         this._breakpoints = [];
         this._breakpointContentIdentifierMap = new Map;
@@ -78,39 +78,70 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._internalWebKitScripts = [];
         this._targetDebuggerDataMap = new Map;
-        this._targetDebuggerDataMap.set(WebInspector.mainTarget, new WebInspector.DebuggerData(WebInspector.mainTarget));
+
+        // Used to detect deleted probe actions.
+        this._knownProbeIdentifiersForBreakpoint = new Map;
+
+        // Main lookup tables for probes and probe sets.
+        this._probesByIdentifier = new Map;
+        this._probeSetsByBreakpoint = new Map;
 
         // Restore the correct breakpoints enabled setting if Web Inspector had
         // previously been left in a state where breakpoints were temporarily disabled.
-        this._temporarilyDisabledBreakpointsRestoreSetting = new WebInspector.Setting("temporarily-disabled-breakpoints-restore", null);
+        this._temporarilyDisabledBreakpointsRestoreSetting = new WI.Setting("temporarily-disabled-breakpoints-restore", null);
         if (this._temporarilyDisabledBreakpointsRestoreSetting.value !== null) {
             this._breakpointsEnabledSetting.value = this._temporarilyDisabledBreakpointsRestoreSetting.value;
             this._temporarilyDisabledBreakpointsRestoreSetting.value = null;
         }
 
-        DebuggerAgent.setBreakpointsActive(this._breakpointsEnabledSetting.value);
-        DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
+        this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
+
+        // Ensure that all managers learn about restored breakpoints,
+        // regardless of their initialization order.
+        setTimeout(() => {
+            this._restoringBreakpoints = true;
+            for (let cookie of this._breakpointsSetting.value)
+                this.addBreakpoint(new WI.Breakpoint(cookie));
+            this._restoringBreakpoints = false;
+        });
+    }
+
+    // Target
+
+    initializeTarget(target)
+    {
+        let targetData = this.dataForTarget(target);
+
+        // Initialize global state.
+        target.DebuggerAgent.enable();
+        target.DebuggerAgent.setBreakpointsActive(this._breakpointsEnabledSetting.value);
+        target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
 
         // COMPATIBILITY (iOS 10): DebuggerAgent.setPauseOnAssertions did not exist yet.
         if (DebuggerAgent.setPauseOnAssertions)
-            DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);
+            target.DebuggerAgent.setPauseOnAssertions(this._assertionFailuresBreakpointEnabledSetting.value);
 
         // COMPATIBILITY (iOS 10): Debugger.setAsyncStackTraceDepth did not exist yet.
         if (DebuggerAgent.setAsyncStackTraceDepth)
-            DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);
+            target.DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);
 
-        this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
+        // COMPATIBILITY (iOS 12): DebuggerAgent.setPauseForInternalScripts did not exist yet.
+        if (DebuggerAgent.setPauseForInternalScripts)
+            target.DebuggerAgent.setPauseForInternalScripts(WI.settings.pauseForInternalScripts.value);
 
-        function restoreBreakpointsSoon() {
-            this._restoringBreakpoints = true;
-            for (let cookie of this._breakpointsSetting.value)
-                this.addBreakpoint(new WebInspector.Breakpoint(cookie));
-            this._restoringBreakpoints = false;
-        }
+        if (this.paused)
+            targetData.pauseIfNeeded();
 
-        // Ensure that all managers learn about restored breakpoints,
-        // regardless of their initialization order.
-        setTimeout(restoreBreakpointsSoon.bind(this), 0);
+        // Initialize breakpoints.
+        this._restoringBreakpoints = true;
+        for (let breakpoint of this._breakpoints) {
+            if (breakpoint.disabled)
+                continue;
+            if (!breakpoint.contentIdentifier)
+                continue;
+            this._setBreakpoint(breakpoint, target);
+        }
+        this._restoringBreakpoints = false;
     }
 
     // Public
@@ -137,7 +168,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._activeCallFrame = callFrame || null;
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ActiveCallFrameDidChange);
     }
 
     dataForTarget(target)
@@ -146,30 +177,15 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (targetData)
             return targetData;
 
-        targetData = new WebInspector.DebuggerData(target);
+        targetData = new WI.DebuggerData(target);
         this._targetDebuggerDataMap.set(target, targetData);
         return targetData;
     }
 
-    get allExceptionsBreakpoint()
-    {
-        return this._allExceptionsBreakpoint;
-    }
-
-    get allUncaughtExceptionsBreakpoint()
-    {
-        return this._allUncaughtExceptionsBreakpoint;
-    }
-
-    get assertionsBreakpoint()
-    {
-        return this._assertionsBreakpoint;
-    }
-
-    get breakpoints()
-    {
-        return this._breakpoints;
-    }
+    get allExceptionsBreakpoint() { return this._allExceptionsBreakpoint; }
+    get uncaughtExceptionsBreakpoint() { return this._uncaughtExceptionsBreakpoint; }
+    get assertionFailuresBreakpoint() { return this._assertionFailuresBreakpoint; }
+    get breakpoints() { return this._breakpoints; }
 
     breakpointForIdentifier(id)
     {
@@ -178,9 +194,9 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     breakpointsForSourceCode(sourceCode)
     {
-        console.assert(sourceCode instanceof WebInspector.Resource || sourceCode instanceof WebInspector.Script);
+        console.assert(sourceCode instanceof WI.Resource || sourceCode instanceof WI.Script);
 
-        if (sourceCode instanceof WebInspector.SourceMapResource) {
+        if (sourceCode instanceof WI.SourceMapResource) {
             let originalSourceCodeBreakpoints = this.breakpointsForSourceCode(sourceCode.sourceMap.originalSourceCode);
             return originalSourceCodeBreakpoints.filter(function(breakpoint) {
                 return breakpoint.sourceCodeLocation.displaySourceCode === sourceCode;
@@ -193,7 +209,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             return contentIdentifierBreakpoints;
         }
 
-        if (sourceCode instanceof WebInspector.Script) {
+        if (sourceCode instanceof WI.Script) {
             let scriptIdentifierBreakpoints = this._breakpointScriptIdentifierMap.get(sourceCode.id);
             if (scriptIdentifierBreakpoints) {
                 this._associateBreakpointsWithSourceCode(scriptIdentifierBreakpoints, sourceCode);
@@ -204,16 +220,33 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         return [];
     }
 
+    breakpointForSourceCodeLocation(sourceCodeLocation)
+    {
+        console.assert(sourceCodeLocation instanceof WI.SourceCodeLocation);
+
+        for (let breakpoint of this.breakpointsForSourceCode(sourceCodeLocation.sourceCode)) {
+            if (breakpoint.sourceCodeLocation.isEqual(sourceCodeLocation))
+                return breakpoint;
+        }
+
+        return null;
+    }
+
     isBreakpointRemovable(breakpoint)
     {
         return breakpoint !== this._allExceptionsBreakpoint
-            && breakpoint !== this._allUncaughtExceptionsBreakpoint
-            && breakpoint !== this._assertionsBreakpoint;
+            && breakpoint !== this._uncaughtExceptionsBreakpoint;
+    }
+
+    isBreakpointSpecial(breakpoint)
+    {
+        return !this.isBreakpointRemovable(breakpoint)
+            || breakpoint === this._assertionFailuresBreakpoint;
     }
 
     isBreakpointEditable(breakpoint)
     {
-        return this.isBreakpointRemovable(breakpoint);
+        return !this.isBreakpointSpecial(breakpoint);
     }
 
     get breakpointsEnabled()
@@ -234,12 +267,12 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._updateBreakOnExceptionsState();
 
-        for (let target of WebInspector.targets) {
+        for (let target of WI.targets) {
             target.DebuggerAgent.setBreakpointsActive(enabled);
             target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
         }
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointsEnabledDidChange);
     }
 
     get breakpointsDisabledTemporarily()
@@ -249,14 +282,14 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     scriptForIdentifier(id, target)
     {
-        console.assert(target instanceof WebInspector.Target);
+        console.assert(target instanceof WI.Target);
         return this.dataForTarget(target).scriptForIdentifier(id);
     }
 
     scriptsForURL(url, target)
     {
         // FIXME: This may not be safe. A Resource's URL may differ from a Script's URL.
-        console.assert(target instanceof WebInspector.Target);
+        console.assert(target instanceof WI.Target);
         return this.dataForTarget(target).scriptsForURL(url);
     }
 
@@ -273,7 +306,9 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             for (let script of targetData.scripts) {
                 if (script.resource)
                     continue;
-                if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
+                if (isWebInspectorConsoleEvaluationScript(script.sourceURL))
+                    continue;
+                if (!WI.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
                     continue;
                 knownScripts.push(script);
             }
@@ -294,21 +329,31 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._asyncStackTraceDepthSetting.value = x;
 
-        for (let target of WebInspector.targets)
+        for (let target of WI.targets)
             target.DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);
     }
 
+    get probeSets()
+    {
+        return [...this._probeSetsByBreakpoint.values()];
+    }
+
+    probeForIdentifier(identifier)
+    {
+        return this._probesByIdentifier.get(identifier);
+    }
+
     pause()
     {
         if (this.paused)
             return Promise.resolve();
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.WaitingToPause);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.WaitingToPause);
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Paused, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.Paused, resolve);
         });
 
         let promises = [];
@@ -323,10 +368,10 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this.paused)
             return Promise.resolve();
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Resumed, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.Resumed, resolve);
         });
 
         let promises = [];
@@ -341,10 +386,10 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this.paused)
             return Promise.reject(new Error("Cannot step over because debugger is not paused."));
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
         let protocolResult = this._activeCallFrame.target.DebuggerAgent.stepOver()
@@ -362,10 +407,10 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this.paused)
             return Promise.reject(new Error("Cannot step into because debugger is not paused."));
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
         let protocolResult = this._activeCallFrame.target.DebuggerAgent.stepInto()
@@ -383,10 +428,10 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this.paused)
             return Promise.reject(new Error("Cannot step out because debugger is not paused."));
 
-        let listener = new WebInspector.EventListener(this, true);
+        let listener = new WI.EventListener(this, true);
 
         let managerResult = new Promise(function(resolve, reject) {
-            listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
+            listener.connect(WI.debuggerManager, WI.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
         let protocolResult = this._activeCallFrame.target.DebuggerAgent.stepOut()
@@ -411,10 +456,15 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     addBreakpoint(breakpoint, shouldSpeculativelyResolve)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
         if (!breakpoint)
             return;
 
+        if (this.isBreakpointSpecial(breakpoint)) {
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointAdded, {breakpoint});
+            return;
+        }
+
         if (breakpoint.contentIdentifier) {
             let contentIdentifierBreakpoints = this._breakpointContentIdentifierMap.get(breakpoint.contentIdentifier);
             if (!contentIdentifierBreakpoints) {
@@ -445,12 +495,14 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._saveBreakpoints();
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded, {breakpoint});
+        this._addProbesForBreakpoint(breakpoint);
+
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointAdded, {breakpoint});
     }
 
     removeBreakpoint(breakpoint)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint);
+        console.assert(breakpoint instanceof WI.Breakpoint);
         if (!breakpoint)
             return;
 
@@ -458,6 +510,12 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this.isBreakpointRemovable(breakpoint))
             return;
 
+        if (this.isBreakpointSpecial(breakpoint)) {
+            breakpoint.disabled = true;
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
+            return;
+        }
+
         this._breakpoints.remove(breakpoint);
 
         if (breakpoint.identifier)
@@ -487,7 +545,9 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._saveBreakpoints();
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
+        this._removeProbesForBreakpoint(breakpoint);
+
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
     }
 
     nextBreakpointActionIdentifier()
@@ -495,38 +555,11 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         return this._nextBreakpointActionIdentifier++;
     }
 
-    initializeTarget(target)
-    {
-        let DebuggerAgent = target.DebuggerAgent;
-        let targetData = this.dataForTarget(target);
-
-        // Initialize global state.
-        DebuggerAgent.enable();
-        DebuggerAgent.setBreakpointsActive(this._breakpointsEnabledSetting.value);
-        DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);
-        DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
-        DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);
-
-        if (this.paused)
-            targetData.pauseIfNeeded();
-
-        // Initialize breakpoints.
-        this._restoringBreakpoints = true;
-        for (let breakpoint of this._breakpoints) {
-            if (breakpoint.disabled)
-                continue;
-            if (!breakpoint.contentIdentifier)
-                continue;
-            this._setBreakpoint(breakpoint, target);
-        }
-        this._restoringBreakpoints = false;
-    }
-
-    // Protected (Called from WebInspector.DebuggerObserver)
+    // Protected (Called from WI.DebuggerObserver)
 
     breakpointResolved(target, breakpointIdentifier, location)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         let breakpoint = this._breakpointIdMap.get(breakpointIdentifier);
         console.assert(breakpoint);
@@ -545,11 +578,11 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     reset()
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         let wasPaused = this.paused;
 
-        WebInspector.Script.resetUniqueDisplayNameNumbers();
+        WI.Script.resetUniqueDisplayNameNumbers();
 
         this._internalWebKitScripts = [];
         this._targetDebuggerDataMap.clear();
@@ -566,15 +599,15 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptsCleared);
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ScriptsCleared);
 
         if (wasPaused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Resumed);
     }
 
     debuggerDidPause(target, callFramesPayload, reason, data, asyncStackTracePayload)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         if (this._delayedResumeTimeout) {
             clearTimeout(this._delayedResumeTimeout);
@@ -598,11 +631,11 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
                 continue;
 
             // Exclude the case where the call frame is in the inspector code.
-            if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceCodeLocation.sourceCode.sourceURL))
+            if (!WI.isDebugUIEnabled() && isWebKitInternalScript(sourceCodeLocation.sourceCode.sourceURL))
                 continue;
 
             let scopeChain = this._scopeChainFromPayload(target, callFramePayload.scopeChain);
-            let callFrame = WebInspector.CallFrame.fromDebuggerPayload(target, callFramePayload, scopeChain, sourceCodeLocation);
+            let callFrame = WI.CallFrame.fromDebuggerPayload(target, callFramePayload, scopeChain, sourceCodeLocation);
             callFrames.push(callFrame);
         }
 
@@ -621,7 +654,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             return;
         }
 
-        let asyncStackTrace = WebInspector.StackTrace.fromPayload(target, asyncStackTracePayload);
+        let asyncStackTrace = WI.StackTrace.fromPayload(target, asyncStackTracePayload);
         targetData.updateForPause(callFrames, pauseReason, pauseData, asyncStackTrace);
 
         // Pause other targets because at least one target has paused.
@@ -638,17 +671,17 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         }
 
         if (!wasPaused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Paused);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Paused);
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange, {target});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.CallFramesDidChange, {target});
 
         if (activeCallFrameDidChange)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.ActiveCallFrameDidChange);
     }
 
     debuggerDidResume(target)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         // COMPATIBILITY (iOS 10): Debugger.resumed event was ambiguous. When stepping
         // we would receive a Debugger.resumed and we would not know if it really meant
@@ -666,14 +699,14 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     playBreakpointActionSound(breakpointActionIdentifier)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         InspectorFrontendHost.beep();
     }
 
     scriptDidParse(target, scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL)
     {
-        // Called from WebInspector.DebuggerObserver.
+        // Called from WI.DebuggerObserver.
 
         // Don't add the script again if it is already known.
         let targetData = this.dataForTarget(target);
@@ -687,20 +720,27 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             return;
         }
 
-        if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceURL))
+        if (!WI.isDebugUIEnabled() && isWebKitInternalScript(sourceURL))
             return;
 
-        let range = new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
-        let sourceType = isModule ? WebInspector.Script.SourceType.Module : WebInspector.Script.SourceType.Program;
-        let script = new WebInspector.Script(target, scriptIdentifier, range, url, sourceType, isContentScript, sourceURL, sourceMapURL);
+        let range = new WI.TextRange(startLine, startColumn, endLine, endColumn);
+        let sourceType = isModule ? WI.Script.SourceType.Module : WI.Script.SourceType.Program;
+        let script = new WI.Script(target, scriptIdentifier, range, url, sourceType, isContentScript, sourceURL, sourceMapURL);
 
         targetData.addScript(script);
 
-        if (target !== WebInspector.mainTarget && !target.mainResource) {
-            // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
-            // We make the main resource of a WorkerTarget the Script instead of the Resource
-            // because the frontend may not be informed of the Resource. We should guarantee
-            // the frontend is informed of the Resource.
+        // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
+        // We make the main resource of a WorkerTarget the Script instead of the Resource
+        // because the frontend may not be informed of the Resource. We should guarantee
+        // the frontend is informed of the Resource.
+        if (WI.sharedApp.debuggableType === WI.DebuggableType.ServiceWorker) {
+            // A ServiceWorker starts with a LocalScript for the main resource but we can replace it during initialization.
+            if (target.mainResource instanceof WI.LocalScript) {
+                if (script.url === target.name)
+                    target.mainResource = script;
+            }
+        } else if (!target.mainResource && target !== WI.mainTarget) {
+            // A Worker starts without a main resource and we insert one.
             if (script.url === target.name) {
                 target.mainResource = script;
                 if (script.resource)
@@ -710,7 +750,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         if (isWebKitInternalScript(script.sourceURL)) {
             this._internalWebKitScripts.push(script);
-            if (!WebInspector.isDebugUIEnabled())
+            if (!WI.isDebugUIEnabled())
                 return;
         }
 
@@ -718,12 +758,21 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (isWebInspectorConsoleEvaluationScript(script.sourceURL))
             return;
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptAdded, {script});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.ScriptAdded, {script});
 
-        if (target !== WebInspector.mainTarget && !script.isMainResource() && !script.resource)
+        if ((target !== WI.mainTarget || WI.sharedApp.debuggableType === WI.DebuggableType.ServiceWorker) && !script.isMainResource() && !script.resource)
             target.addScript(script);
     }
 
+    didSampleProbe(target, sample)
+    {
+        console.assert(this._probesByIdentifier.has(sample.probeId), "Unknown probe identifier specified for sample: ", sample);
+        let probe = this._probesByIdentifier.get(sample.probeId);
+        let elapsedTime = WI.timelineManager.computeElapsedTime(sample.timestamp);
+        let object = WI.RemoteObject.fromPayload(sample.payload, target);
+        probe.addSample(new WI.ProbeSample(sample.sampleId, sample.batchId, elapsedTime, object));
+    }
+
     // Private
 
     _sourceCodeLocationFromPayload(target, payload)
@@ -749,73 +798,83 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         var type = null;
         switch (payload.type) {
         case DebuggerAgent.ScopeType.Global:
-            type = WebInspector.ScopeChainNode.Type.Global;
+            type = WI.ScopeChainNode.Type.Global;
             break;
         case DebuggerAgent.ScopeType.With:
-            type = WebInspector.ScopeChainNode.Type.With;
+            type = WI.ScopeChainNode.Type.With;
             break;
         case DebuggerAgent.ScopeType.Closure:
-            type = WebInspector.ScopeChainNode.Type.Closure;
+            type = WI.ScopeChainNode.Type.Closure;
             break;
         case DebuggerAgent.ScopeType.Catch:
-            type = WebInspector.ScopeChainNode.Type.Catch;
+            type = WI.ScopeChainNode.Type.Catch;
             break;
         case DebuggerAgent.ScopeType.FunctionName:
-            type = WebInspector.ScopeChainNode.Type.FunctionName;
+            type = WI.ScopeChainNode.Type.FunctionName;
             break;
         case DebuggerAgent.ScopeType.NestedLexical:
-            type = WebInspector.ScopeChainNode.Type.Block;
+            type = WI.ScopeChainNode.Type.Block;
             break;
         case DebuggerAgent.ScopeType.GlobalLexicalEnvironment:
-            type = WebInspector.ScopeChainNode.Type.GlobalLexicalEnvironment;
+            type = WI.ScopeChainNode.Type.GlobalLexicalEnvironment;
             break;
 
         // COMPATIBILITY (iOS 9): Debugger.ScopeType.Local used to be provided by the backend.
         // Newer backends no longer send this enum value, it should be computed by the frontend.
         // Map this to "Closure" type. The frontend can recalculate this when needed.
         case DebuggerAgent.ScopeType.Local:
-            type = WebInspector.ScopeChainNode.Type.Closure;
+            type = WI.ScopeChainNode.Type.Closure;
             break;
 
         default:
             console.error("Unknown type: " + payload.type);
         }
 
-        let object = WebInspector.RemoteObject.fromPayload(payload.object, target);
-        return new WebInspector.ScopeChainNode(type, [object], payload.name, payload.location, payload.empty);
+        let object = WI.RemoteObject.fromPayload(payload.object, target);
+        return new WI.ScopeChainNode(type, [object], payload.name, payload.location, payload.empty);
     }
 
     _pauseReasonFromPayload(payload)
     {
         // FIXME: Handle other backend pause reasons.
         switch (payload) {
+        case DebuggerAgent.PausedReason.AnimationFrame:
+            return WI.DebuggerManager.PauseReason.AnimationFrame;
         case DebuggerAgent.PausedReason.Assert:
-            return WebInspector.DebuggerManager.PauseReason.Assertion;
+            return WI.DebuggerManager.PauseReason.Assertion;
         case DebuggerAgent.PausedReason.Breakpoint:
-            return WebInspector.DebuggerManager.PauseReason.Breakpoint;
+            return WI.DebuggerManager.PauseReason.Breakpoint;
         case DebuggerAgent.PausedReason.CSPViolation:
-            return WebInspector.DebuggerManager.PauseReason.CSPViolation;
+            return WI.DebuggerManager.PauseReason.CSPViolation;
+        case DebuggerAgent.PausedReason.DOM:
+            return WI.DebuggerManager.PauseReason.DOM;
         case DebuggerAgent.PausedReason.DebuggerStatement:
-            return WebInspector.DebuggerManager.PauseReason.DebuggerStatement;
+            return WI.DebuggerManager.PauseReason.DebuggerStatement;
+        case DebuggerAgent.PausedReason.EventListener:
+            return WI.DebuggerManager.PauseReason.EventListener;
         case DebuggerAgent.PausedReason.Exception:
-            return WebInspector.DebuggerManager.PauseReason.Exception;
+            return WI.DebuggerManager.PauseReason.Exception;
         case DebuggerAgent.PausedReason.PauseOnNextStatement:
-            return WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement;
+            return WI.DebuggerManager.PauseReason.PauseOnNextStatement;
+        case DebuggerAgent.PausedReason.Timer:
+            return WI.DebuggerManager.PauseReason.Timer;
+        case DebuggerAgent.PausedReason.XHR:
+            return WI.DebuggerManager.PauseReason.XHR;
         default:
-            return WebInspector.DebuggerManager.PauseReason.Other;
+            return WI.DebuggerManager.PauseReason.Other;
         }
     }
 
     _debuggerBreakpointActionType(type)
     {
         switch (type) {
-        case WebInspector.BreakpointAction.Type.Log:
+        case WI.BreakpointAction.Type.Log:
             return DebuggerAgent.BreakpointActionType.Log;
-        case WebInspector.BreakpointAction.Type.Evaluate:
+        case WI.BreakpointAction.Type.Evaluate:
             return DebuggerAgent.BreakpointActionType.Evaluate;
-        case WebInspector.BreakpointAction.Type.Sound:
+        case WI.BreakpointAction.Type.Sound:
             return DebuggerAgent.BreakpointActionType.Sound;
-        case WebInspector.BreakpointAction.Type.Probe:
+        case WI.BreakpointAction.Type.Probe:
             return DebuggerAgent.BreakpointActionType.Probe;
         default:
             console.assert(false);
@@ -831,13 +890,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         let invalidActions = [];
 
         for (let action of options.actions) {
-            if (action.type !== WebInspector.BreakpointAction.Type.Log)
+            if (action.type !== WI.BreakpointAction.Type.Log)
                 continue;
 
             if (!templatePlaceholderRegex.test(action.data))
                 continue;
 
-            let lexer = new WebInspector.BreakpointLogMessageLexer;
+            let lexer = new WI.BreakpointLogMessageLexer;
             let tokens = lexer.tokenize(action.data);
             if (!tokens) {
                 invalidActions.push(action);
@@ -845,20 +904,19 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             }
 
             let templateLiteral = tokens.reduce((text, token) => {
-                if (token.type === WebInspector.BreakpointLogMessageLexer.TokenType.PlainText)
+                if (token.type === WI.BreakpointLogMessageLexer.TokenType.PlainText)
                     return text + token.data.escapeCharacters("`\\");
-                if (token.type === WebInspector.BreakpointLogMessageLexer.TokenType.Expression)
+                if (token.type === WI.BreakpointLogMessageLexer.TokenType.Expression)
                     return text + "${" + token.data + "}";
                 return text;
             }, "");
 
             action.data = "console.log(`" + templateLiteral + "`)";
-            action.type = WebInspector.BreakpointAction.Type.Evaluate;
+            action.type = WI.BreakpointAction.Type.Evaluate;
         }
 
-        const onlyFirst = true;
         for (let invalidAction of invalidActions)
-            options.actions.remove(invalidAction, onlyFirst);
+            options.actions.remove(invalidAction);
 
         return options;
     }
@@ -904,27 +962,20 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         // Convert BreakpointAction types to DebuggerAgent protocol types.
         // NOTE: Breakpoint.options returns new objects each time, so it is safe to modify.
-        // COMPATIBILITY (iOS 7): Debugger.BreakpointActionType did not exist yet.
-        let options;
-        if (DebuggerAgent.BreakpointActionType) {
-            options = this._debuggerBreakpointOptions(breakpoint);
-            if (options.actions.length) {
-                for (let action of options.actions)
-                    action.type = this._debuggerBreakpointActionType(action.type);
-            }
+        let options = this._debuggerBreakpointOptions(breakpoint);
+        if (options.actions.length) {
+            for (let action of options.actions)
+                action.type = this._debuggerBreakpointActionType(action.type);
         }
 
-        // COMPATIBILITY (iOS 7): iOS 7 and earlier, DebuggerAgent.setBreakpoint* took a "condition" string argument.
-        // This has been replaced with an "options" BreakpointOptions object.
         if (breakpoint.contentIdentifier) {
-            let targets = specificTarget ? [specificTarget] : WebInspector.targets;
+            let targets = specificTarget ? [specificTarget] : WI.targets;
             for (let target of targets) {
                 target.DebuggerAgent.setBreakpointByUrl.invoke({
                     lineNumber: breakpoint.sourceCodeLocation.lineNumber,
                     url: breakpoint.contentIdentifier,
                     urlRegex: undefined,
                     columnNumber: breakpoint.sourceCodeLocation.columnNumber,
-                    condition: breakpoint.condition,
                     options
                 }, didSetBreakpoint.bind(this, target), target.DebuggerAgent);
             }
@@ -932,7 +983,6 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             let target = breakpoint.target;
             target.DebuggerAgent.setBreakpoint.invoke({
                 location: {scriptId: breakpoint.scriptIdentifier, lineNumber: breakpoint.sourceCodeLocation.lineNumber, columnNumber: breakpoint.sourceCodeLocation.columnNumber},
-                condition: breakpoint.condition,
                 options
             }, didSetBreakpoint.bind(this, target), target.DebuggerAgent);
         }
@@ -960,7 +1010,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         }
 
         if (breakpoint.contentIdentifier) {
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.removeBreakpoint(breakpoint.identifier, didRemoveBreakpoint.bind(this));
         } else if (breakpoint.scriptIdentifier) {
             let target = breakpoint.target;
@@ -985,7 +1035,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             // Add the breakpoint at its new lineNumber and get a new id.
             this._setBreakpoint(breakpoint);
 
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointMoved, {breakpoint});
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.BreakpointMoved, {breakpoint});
         }
     }
 
@@ -999,27 +1049,27 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
                 this.breakpointsEnabled = true;
             this._allExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
             this._updateBreakOnExceptionsState();
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
             return;
         }
 
-        if (breakpoint === this._allUncaughtExceptionsBreakpoint) {
+        if (breakpoint === this._uncaughtExceptionsBreakpoint) {
             if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
                 this.breakpointsEnabled = true;
-            this._allUncaughtExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
+            this._uncaughtExceptionsBreakpointEnabledSetting.value = !breakpoint.disabled;
             this._updateBreakOnExceptionsState();
-            for (let target of WebInspector.targets)
+            for (let target of WI.targets)
                 target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);
             return;
         }
 
-        if (breakpoint === this._assertionsBreakpoint) {
+        if (breakpoint === this._assertionFailuresBreakpoint) {
             if (!breakpoint.disabled && !this.breakpointsDisabledTemporarily)
                 this.breakpointsEnabled = true;
-            this._assertionsBreakpointEnabledSetting.value = !breakpoint.disabled;
-            for (let target of WebInspector.targets)
-                target.DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);
+            this._assertionFailuresBreakpointEnabledSetting.value = !breakpoint.disabled;
+            for (let target of WI.targets)
+                target.DebuggerAgent.setPauseOnAssertions(this._assertionFailuresBreakpointEnabledSetting.value);
             return;
         }
 
@@ -1051,6 +1101,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         }
     }
 
+    _handleBreakpointActionsDidChange(event)
+    {
+        this._breakpointEditablePropertyDidChange(event);
+
+        this._updateProbesForBreakpoint(event.target);
+    }
+
     _startDisablingBreakpointsTemporarily()
     {
         console.assert(!this.breakpointsDisabledTemporarily, "Already temporarily disabling breakpoints.");
@@ -1094,7 +1151,16 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this._targetDebuggerDataMap.delete(event.data.target);
 
         if (!this.paused && wasPaused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Resumed);
+    }
+
+    _pauseForInternalScriptsDidChange(event)
+    {
+        // COMPATIBILITY (iOS 12): DebuggerAgent.setPauseForInternalScripts did not exist yet.
+        console.assert(DebuggerAgent.setPauseForInternalScripts);
+
+        for (let target of WI.targets)
+            target.DebuggerAgent.setPauseForInternalScripts(WI.settings.pauseForInternalScripts.value);
     }
 
     _mainResourceDidChange(event)
@@ -1102,7 +1168,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!event.target.isMainFrame())
             return;
 
-        this._didResumeInternal(WebInspector.mainTarget);
+        this._didResumeInternal(WI.mainTarget);
     }
 
     _didResumeInternal(target)
@@ -1124,12 +1190,12 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this.dataForTarget(target).updateForResume();
 
         if (!this.paused)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.Resumed);
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange, {target});
+        this.dispatchEventToListeners(WI.DebuggerManager.Event.CallFramesDidChange, {target});
 
         if (activeCallFrameDidChange)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.ActiveCallFrameDidChange);
     }
 
     _updateBreakOnExceptionsState()
@@ -1139,7 +1205,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (this._breakpointsEnabledSetting.value) {
             if (!this._allExceptionsBreakpoint.disabled)
                 state = "all";
-            else if (!this._allUncaughtExceptionsBreakpoint.disabled)
+            else if (!this._uncaughtExceptionsBreakpoint.disabled)
                 state = "uncaught";
         }
 
@@ -1149,12 +1215,12 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         case "all":
             // Mark the uncaught breakpoint as unresolved since "all" includes "uncaught".
             // That way it is clear in the user interface that the breakpoint is ignored.
-            this._allUncaughtExceptionsBreakpoint.resolved = false;
+            this._uncaughtExceptionsBreakpoint.resolved = false;
             break;
         case "uncaught":
         case "none":
             // Mark the uncaught breakpoint as resolved again.
-            this._allUncaughtExceptionsBreakpoint.resolved = true;
+            this._uncaughtExceptionsBreakpoint.resolved = true;
             break;
         }
     }
@@ -1183,15 +1249,97 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
     }
 
+    _addProbesForBreakpoint(breakpoint)
+    {
+        if (this._knownProbeIdentifiersForBreakpoint.has(breakpoint))
+            return;
+
+        this._knownProbeIdentifiersForBreakpoint.set(breakpoint, new Set);
+
+        this._updateProbesForBreakpoint(breakpoint);
+    }
+
+    _removeProbesForBreakpoint(breakpoint)
+    {
+        console.assert(this._knownProbeIdentifiersForBreakpoint.has(breakpoint));
+
+        this._updateProbesForBreakpoint(breakpoint);
+        this._knownProbeIdentifiersForBreakpoint.delete(breakpoint);
+    }
+
+    _updateProbesForBreakpoint(breakpoint)
+    {
+        let knownProbeIdentifiers = this._knownProbeIdentifiersForBreakpoint.get(breakpoint);
+        if (!knownProbeIdentifiers) {
+            // Sometimes actions change before the added breakpoint is fully dispatched.
+            this._addProbesForBreakpoint(breakpoint);
+            return;
+        }
+
+        let seenProbeIdentifiers = new Set;
+
+        for (let probeAction of breakpoint.probeActions) {
+            let probeIdentifier = probeAction.id;
+            console.assert(probeIdentifier, "Probe added without breakpoint action identifier: ", breakpoint);
+
+            seenProbeIdentifiers.add(probeIdentifier);
+            if (!knownProbeIdentifiers.has(probeIdentifier)) {
+                // New probe; find or create relevant probe set.
+                knownProbeIdentifiers.add(probeIdentifier);
+                let probeSet = this._probeSetForBreakpoint(breakpoint);
+                let newProbe = new WI.Probe(probeIdentifier, breakpoint, probeAction.data);
+                this._probesByIdentifier.set(probeIdentifier, newProbe);
+                probeSet.addProbe(newProbe);
+                break;
+            }
+
+            let probe = this._probesByIdentifier.get(probeIdentifier);
+            console.assert(probe, "Probe known but couldn't be found by identifier: ", probeIdentifier);
+            // Update probe expression; if it differed, change events will fire.
+            probe.expression = probeAction.data;
+        }
+
+        // Look for missing probes based on what we saw last.
+        for (let probeIdentifier of knownProbeIdentifiers) {
+            if (seenProbeIdentifiers.has(probeIdentifier))
+                break;
+
+            // The probe has gone missing, remove it.
+            let probeSet = this._probeSetForBreakpoint(breakpoint);
+            let probe = this._probesByIdentifier.get(probeIdentifier);
+            this._probesByIdentifier.delete(probeIdentifier);
+            knownProbeIdentifiers.delete(probeIdentifier);
+            probeSet.removeProbe(probe);
+
+            // Remove the probe set if it has become empty.
+            if (!probeSet.probes.length) {
+                this._probeSetsByBreakpoint.delete(probeSet.breakpoint);
+                probeSet.willRemove();
+                this.dispatchEventToListeners(WI.DebuggerManager.Event.ProbeSetRemoved, {probeSet});
+            }
+        }
+    }
+
+    _probeSetForBreakpoint(breakpoint)
+    {
+        let probeSet = this._probeSetsByBreakpoint.get(breakpoint);
+        if (!probeSet) {
+            probeSet = new WI.ProbeSet(breakpoint);
+            this._probeSetsByBreakpoint.set(breakpoint, probeSet);
+            this.dispatchEventToListeners(WI.DebuggerManager.Event.ProbeSetAdded, {probeSet});
+        }
+        return probeSet;
+    }
+
     _debugUIEnabledDidChange()
     {
-        let eventType = WebInspector.isDebugUIEnabled() ? WebInspector.DebuggerManager.Event.ScriptAdded : WebInspector.DebuggerManager.Event.ScriptRemoved;
+        let eventType = WI.isDebugUIEnabled() ? WI.DebuggerManager.Event.ScriptAdded : WI.DebuggerManager.Event.ScriptRemoved;
         for (let script of this._internalWebKitScripts)
             this.dispatchEventToListeners(eventType, {script});
     }
 };
 
-WebInspector.DebuggerManager.Event = {
+WI.DebuggerManager.Event = {
     BreakpointAdded: "debugger-manager-breakpoint-added",
     BreakpointRemoved: "debugger-manager-breakpoint-removed",
     BreakpointMoved: "debugger-manager-breakpoint-moved",
@@ -1203,15 +1351,22 @@ WebInspector.DebuggerManager.Event = {
     ScriptAdded: "debugger-manager-script-added",
     ScriptRemoved: "debugger-manager-script-removed",
     ScriptsCleared: "debugger-manager-scripts-cleared",
-    BreakpointsEnabledDidChange: "debugger-manager-breakpoints-enabled-did-change"
+    BreakpointsEnabledDidChange: "debugger-manager-breakpoints-enabled-did-change",
+    ProbeSetAdded: "debugger-manager-probe-set-added",
+    ProbeSetRemoved: "debugger-manager-probe-set-removed",
 };
 
-WebInspector.DebuggerManager.PauseReason = {
+WI.DebuggerManager.PauseReason = {
+    AnimationFrame: "animation-frame",
     Assertion: "assertion",
     Breakpoint: "breakpoint",
     CSPViolation: "CSP-violation",
     DebuggerStatement: "debugger-statement",
+    DOM: "DOM",
+    EventListener: "event-listener",
     Exception: "exception",
     PauseOnNextStatement: "pause-on-next-statement",
+    Timer: "timer",
+    XHR: "xhr",
     Other: "other",
 };