Web Inspector: Cleanup parts of DebuggerManager
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Oct 2016 07:22:03 +0000 (07:22 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Oct 2016 07:22:03 +0000 (07:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=163400

Reviewed by Timothy Hatcher.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.restoreBreakpointsSoon):

(WebInspector.DebuggerManager.prototype.get paused):
(WebInspector.DebuggerManager.prototype.get pauseReason):
(WebInspector.DebuggerManager.prototype.get pauseData):
(WebInspector.DebuggerManager.prototype.get callFrames):
(WebInspector.DebuggerManager.prototype.get activeCallFrame):
(WebInspector.DebuggerManager.prototype.set activeCallFrame):
Put simple accessors at the top.

(WebInspector.DebuggerManager.prototype.get allExceptionsBreakpoint):
(WebInspector.DebuggerManager.prototype.get allUncaughtExceptionsBreakpoint):
(WebInspector.DebuggerManager.prototype.get breakpoints):
(WebInspector.DebuggerManager.prototype.breakpointForIdentifier):
(WebInspector.DebuggerManager.prototype.breakpointsForSourceCode):
(WebInspector.DebuggerManager.prototype.isBreakpointRemovable):
(WebInspector.DebuggerManager.prototype.isBreakpointEditable):
(WebInspector.DebuggerManager.prototype.get breakpointsDisabledTemporarily):
Group public breakpoint state and access methods.

(WebInspector.DebuggerManager.prototype.scriptForIdentifier):
(WebInspector.DebuggerManager.prototype.scriptsForURL):
(WebInspector.DebuggerManager.prototype.get searchableScripts):
(WebInspector.DebuggerManager.prototype.get knownNonResourceScripts):
Group public script access methods.

(WebInspector.DebuggerManager.prototype.pause):
(WebInspector.DebuggerManager.prototype.resume):
(WebInspector.DebuggerManager.prototype.stepOver):
(WebInspector.DebuggerManager.prototype.stepInto):
(WebInspector.DebuggerManager.prototype.stepOut):
(WebInspector.DebuggerManager.prototype.continueToLocation):
(WebInspector.DebuggerManager.prototype.addBreakpoint):
(WebInspector.DebuggerManager.prototype.removeBreakpoint):
Group and modernize public methods that perform actions.

(WebInspector.DebuggerManager.prototype.nextBreakpointActionIdentifier):
Misc. methods.

(WebInspector.DebuggerManager.prototype.breakpointResolved):
(WebInspector.DebuggerManager.prototype.reset):
(WebInspector.DebuggerManager.prototype.playBreakpointActionSound):
(WebInspector.DebuggerManager.prototype.scriptDidParse):
(WebInspector.DebuggerManager.prototype._setBreakpoint.didSetBreakpoint):
(WebInspector.DebuggerManager.prototype._setBreakpoint):
(WebInspector.DebuggerManager.prototype._breakpointEditablePropertyDidChange):
(WebInspector.DebuggerManager.prototype._updateBreakOnExceptionsState):
(WebInspector.DebuggerManager.prototype._associateBreakpointsWithSourceCode):
Minor cleanup in protected and private methods.

* UserInterface/Models/BreakpointAction.js:
(WebInspector.BreakpointAction):
Getting the next identifier is an action so it should be a function call.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.textEditorBreakpointAdded):
Remove unused parameter.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207371 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js

index 8867e87..0044429 100644 (file)
@@ -1,3 +1,69 @@
+2016-10-15  Joseph Pecoraro  <pecoraro@apple.com>
+
+        Web Inspector: Cleanup parts of DebuggerManager
+        https://bugs.webkit.org/show_bug.cgi?id=163400
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Controllers/DebuggerManager.js:
+        (WebInspector.DebuggerManager.restoreBreakpointsSoon):
+
+        (WebInspector.DebuggerManager.prototype.get paused):
+        (WebInspector.DebuggerManager.prototype.get pauseReason):
+        (WebInspector.DebuggerManager.prototype.get pauseData):
+        (WebInspector.DebuggerManager.prototype.get callFrames):
+        (WebInspector.DebuggerManager.prototype.get activeCallFrame):
+        (WebInspector.DebuggerManager.prototype.set activeCallFrame):
+        Put simple accessors at the top.
+
+        (WebInspector.DebuggerManager.prototype.get allExceptionsBreakpoint):
+        (WebInspector.DebuggerManager.prototype.get allUncaughtExceptionsBreakpoint):
+        (WebInspector.DebuggerManager.prototype.get breakpoints):
+        (WebInspector.DebuggerManager.prototype.breakpointForIdentifier):
+        (WebInspector.DebuggerManager.prototype.breakpointsForSourceCode):
+        (WebInspector.DebuggerManager.prototype.isBreakpointRemovable):
+        (WebInspector.DebuggerManager.prototype.isBreakpointEditable):
+        (WebInspector.DebuggerManager.prototype.get breakpointsDisabledTemporarily):
+        Group public breakpoint state and access methods.
+
+        (WebInspector.DebuggerManager.prototype.scriptForIdentifier):
+        (WebInspector.DebuggerManager.prototype.scriptsForURL):
+        (WebInspector.DebuggerManager.prototype.get searchableScripts):
+        (WebInspector.DebuggerManager.prototype.get knownNonResourceScripts):
+        Group public script access methods.
+
+        (WebInspector.DebuggerManager.prototype.pause):
+        (WebInspector.DebuggerManager.prototype.resume):
+        (WebInspector.DebuggerManager.prototype.stepOver):
+        (WebInspector.DebuggerManager.prototype.stepInto):
+        (WebInspector.DebuggerManager.prototype.stepOut):
+        (WebInspector.DebuggerManager.prototype.continueToLocation):
+        (WebInspector.DebuggerManager.prototype.addBreakpoint):
+        (WebInspector.DebuggerManager.prototype.removeBreakpoint):
+        Group and modernize public methods that perform actions.
+
+        (WebInspector.DebuggerManager.prototype.nextBreakpointActionIdentifier):
+        Misc. methods.
+
+        (WebInspector.DebuggerManager.prototype.breakpointResolved):
+        (WebInspector.DebuggerManager.prototype.reset):
+        (WebInspector.DebuggerManager.prototype.playBreakpointActionSound):
+        (WebInspector.DebuggerManager.prototype.scriptDidParse):
+        (WebInspector.DebuggerManager.prototype._setBreakpoint.didSetBreakpoint):
+        (WebInspector.DebuggerManager.prototype._setBreakpoint):
+        (WebInspector.DebuggerManager.prototype._breakpointEditablePropertyDidChange):
+        (WebInspector.DebuggerManager.prototype._updateBreakOnExceptionsState):
+        (WebInspector.DebuggerManager.prototype._associateBreakpointsWithSourceCode):
+        Minor cleanup in protected and private methods.
+
+        * UserInterface/Models/BreakpointAction.js:
+        (WebInspector.BreakpointAction):
+        Getting the next identifier is an action so it should be a function call.
+
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype.textEditorBreakpointAdded):
+        Remove unused parameter.
+
 2016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Dragging to delete a Breakpoint should never trigger a ContentView change
index ad8921b..1ad8363 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013, 2014, 2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -48,7 +48,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this._allExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-exceptions", false);
         this._allUncaughtExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-uncaught-exceptions", false);
 
-        var specialBreakpointLocation = new WebInspector.SourceCodeLocation(null, Infinity, Infinity);
+        let specialBreakpointLocation = new WebInspector.SourceCodeLocation(null, Infinity, Infinity);
 
         this._allExceptionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._allExceptionsBreakpointEnabledSetting.value);
         this._allExceptionsBreakpoint.resolved = true;
@@ -85,9 +85,11 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._updateBreakOnExceptionsState();
 
+        this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
+
         function restoreBreakpointsSoon() {
             this._restoringBreakpoints = true;
-            for (var cookie of this._breakpointsSetting.value)
+            for (let cookie of this._breakpointsSetting.value)
                 this.addBreakpoint(new WebInspector.Breakpoint(cookie));
             this._restoringBreakpoints = false;
         }
@@ -99,6 +101,99 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     // Public
 
+    get paused()
+    {
+        return this._paused;
+    }
+
+    get pauseReason()
+    {
+        return this._pauseReason;
+    }
+
+    get pauseData()
+    {
+        return this._pauseData;
+    }
+
+    get callFrames()
+    {
+        return this._callFrames;
+    }
+
+    get activeCallFrame()
+    {
+        return this._activeCallFrame;
+    }
+
+    set activeCallFrame(callFrame)
+    {
+        if (callFrame === this._activeCallFrame)
+            return;
+
+        this._activeCallFrame = callFrame || null;
+
+        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+    }
+
+    get allExceptionsBreakpoint()
+    {
+        return this._allExceptionsBreakpoint;
+    }
+
+    get allUncaughtExceptionsBreakpoint()
+    {
+        return this._allUncaughtExceptionsBreakpoint;
+    }
+
+    get breakpoints()
+    {
+        return this._breakpoints;
+    }
+
+    breakpointForIdentifier(id)
+    {
+        return this._breakpointIdMap.get(id) || null;
+    }
+
+    breakpointsForSourceCode(sourceCode)
+    {
+        console.assert(sourceCode instanceof WebInspector.Resource || sourceCode instanceof WebInspector.Script);
+
+        if (sourceCode instanceof WebInspector.SourceMapResource) {
+            let originalSourceCodeBreakpoints = this.breakpointsForSourceCode(sourceCode.sourceMap.originalSourceCode);
+            return originalSourceCodeBreakpoints.filter(function(breakpoint) {
+                return breakpoint.sourceCodeLocation.displaySourceCode === sourceCode;
+            });
+        }
+
+        let contentIdentifierBreakpoints = this._breakpointContentIdentifierMap.get(sourceCode.contentIdentifier);
+        if (contentIdentifierBreakpoints) {
+            this._associateBreakpointsWithSourceCode(contentIdentifierBreakpoints, sourceCode);
+            return contentIdentifierBreakpoints;
+        }
+
+        if (sourceCode instanceof WebInspector.Script) {
+            let scriptIdentifierBreakpoints = this._breakpointScriptIdentifierMap.get(sourceCode.id);
+            if (scriptIdentifierBreakpoints) {
+                this._associateBreakpointsWithSourceCode(scriptIdentifierBreakpoints, sourceCode);
+                return scriptIdentifierBreakpoints;
+            }
+        }
+
+        return [];
+    }
+
+    isBreakpointRemovable(breakpoint)
+    {
+        return breakpoint !== this._allExceptionsBreakpoint && breakpoint !== this._allUncaughtExceptionsBreakpoint;
+    }
+
+    isBreakpointEditable(breakpoint)
+    {
+        return this.isBreakpointRemovable(breakpoint);
+    }
+
     get breakpointsEnabled()
     {
         return this._breakpointsEnabledSetting.value;
@@ -122,39 +217,39 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this._updateBreakOnExceptionsState();
     }
 
-    get paused()
-    {
-        return this._paused;
-    }
-
-    get pauseReason()
+    get breakpointsDisabledTemporarily()
     {
-        return this._pauseReason;
+        return this._temporarilyDisabledBreakpointsRestoreSetting.value !== null;
     }
 
-    get pauseData()
+    scriptForIdentifier(id)
     {
-        return this._pauseData;
+        return this._scriptIdMap.get(id) || null;
     }
 
-    get callFrames()
+    scriptsForURL(url)
     {
-        return this._callFrames;
+        // FIXME: This may not be safe. A Resource's URL may differ from a Script's URL.
+        return this._scriptContentIdentifierMap.get(url) || [];
     }
 
-    get activeCallFrame()
+    get searchableScripts()
     {
-        return this._activeCallFrame;
+        return this.knownNonResourceScripts.filter((script) => !!script.contentIdentifier);
     }
 
-    set activeCallFrame(callFrame)
+    get knownNonResourceScripts()
     {
-        if (callFrame === this._activeCallFrame)
-            return;
-
-        this._activeCallFrame = callFrame || null;
+        let knownScripts = [];
+        for (let script of this._scriptIdMap.values()) {
+            if (script.resource)
+                continue;
+            if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
+                continue;
+            knownScripts.push(script);
+        }
 
-        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
+        return knownScripts;
     }
 
     pause()
@@ -164,13 +259,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.WaitingToPause);
 
-        var listener = new WebInspector.EventListener(this, true);
+        let listener = new WebInspector.EventListener(this, true);
 
-        var managerResult = new Promise(function(resolve, reject) {
+        let managerResult = new Promise(function(resolve, reject) {
             listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Paused, resolve);
         });
 
-        var protocolResult = DebuggerAgent.pause()
+        let protocolResult = DebuggerAgent.pause()
             .catch(function(error) {
                 listener.disconnect();
                 console.error("DebuggerManager.pause failed: ", error);
@@ -185,13 +280,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this._paused)
             return Promise.resolve();
 
-        var listener = new WebInspector.EventListener(this, true);
+        let listener = new WebInspector.EventListener(this, true);
 
-        var managerResult = new Promise(function(resolve, reject) {
+        let managerResult = new Promise(function(resolve, reject) {
             listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Resumed, resolve);
         });
 
-        var protocolResult = DebuggerAgent.resume()
+        let protocolResult = DebuggerAgent.resume()
             .catch(function(error) {
                 listener.disconnect();
                 console.error("DebuggerManager.resume failed: ", error);
@@ -206,13 +301,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this._paused)
             return Promise.reject(new Error("Cannot step over because debugger is not paused."));
 
-        var listener = new WebInspector.EventListener(this, true);
+        let listener = new WebInspector.EventListener(this, true);
 
-        var managerResult = new Promise(function(resolve, reject) {
+        let managerResult = new Promise(function(resolve, reject) {
             listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
-        var protocolResult = DebuggerAgent.stepOver()
+        let protocolResult = DebuggerAgent.stepOver()
             .catch(function(error) {
                 listener.disconnect();
                 console.error("DebuggerManager.stepOver failed: ", error);
@@ -227,13 +322,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this._paused)
             return Promise.reject(new Error("Cannot step into because debugger is not paused."));
 
-        var listener = new WebInspector.EventListener(this, true);
+        let listener = new WebInspector.EventListener(this, true);
 
-        var managerResult = new Promise(function(resolve, reject) {
+        let managerResult = new Promise(function(resolve, reject) {
             listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
-        var protocolResult = DebuggerAgent.stepInto()
+        let protocolResult = DebuggerAgent.stepInto()
             .catch(function(error) {
                 listener.disconnect();
                 console.error("DebuggerManager.stepInto failed: ", error);
@@ -248,13 +343,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (!this._paused)
             return Promise.reject(new Error("Cannot step out because debugger is not paused."));
 
-        var listener = new WebInspector.EventListener(this, true);
+        let listener = new WebInspector.EventListener(this, true);
 
-        var managerResult = new Promise(function(resolve, reject) {
+        let managerResult = new Promise(function(resolve, reject) {
             listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
         });
 
-        var protocolResult = DebuggerAgent.stepOut()
+        let protocolResult = DebuggerAgent.stepOut()
             .catch(function(error) {
                 listener.disconnect();
                 console.error("DebuggerManager.stepOut failed: ", error);
@@ -264,92 +359,14 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         return Promise.all([managerResult, protocolResult]);
     }
 
-    get allExceptionsBreakpoint()
-    {
-        return this._allExceptionsBreakpoint;
-    }
-
-    get allUncaughtExceptionsBreakpoint()
-    {
-        return this._allUncaughtExceptionsBreakpoint;
-    }
-
-    get breakpoints()
-    {
-        return this._breakpoints;
-    }
-
-    breakpointsForSourceCode(sourceCode)
-    {
-        console.assert(sourceCode instanceof WebInspector.Resource || sourceCode instanceof WebInspector.Script);
-
-        if (sourceCode instanceof WebInspector.SourceMapResource) {
-            var originalSourceCodeBreakpoints = this.breakpointsForSourceCode(sourceCode.sourceMap.originalSourceCode);
-            return originalSourceCodeBreakpoints.filter(function(breakpoint) {
-                return breakpoint.sourceCodeLocation.displaySourceCode === sourceCode;
-            });
-        }
-
-        let contentIdentifierBreakpoints = this._breakpointContentIdentifierMap.get(sourceCode.contentIdentifier);
-        if (contentIdentifierBreakpoints) {
-            this._associateBreakpointsWithSourceCode(contentIdentifierBreakpoints, sourceCode);
-            return contentIdentifierBreakpoints;
-        }
-
-        if (sourceCode instanceof WebInspector.Script) {
-            let scriptIdentifierBreakpoints = this._breakpointScriptIdentifierMap.get(sourceCode.id);
-            if (scriptIdentifierBreakpoints) {
-                this._associateBreakpointsWithSourceCode(scriptIdentifierBreakpoints, sourceCode);
-                return scriptIdentifierBreakpoints;
-            }
-        }
-
-        return [];
-    }
-
-    breakpointForIdentifier(id)
-    {
-        return this._breakpointIdMap.get(id) || null;
-    }
-
-    scriptForIdentifier(id)
-    {
-        return this._scriptIdMap.get(id) || null;
-    }
-
-    scriptsForURL(url)
-    {
-        // FIXME: This may not be safe. A Resource's URL may differ from a Script's URL.
-        return this._scriptContentIdentifierMap.get(url) || [];
-    }
-
-    continueToLocation(scriptIdentifier, lineNumber, columnNumber)
-    {
-        DebuggerAgent.continueToLocation({scriptId: scriptIdentifier, lineNumber, columnNumber});
-    }
-
-    get searchableScripts()
-    {
-        return this.knownNonResourceScripts.filter((script) => !!script.contentIdentifier);
-    }
-
-    get knownNonResourceScripts()
+    continueToLocation(scriptId, lineNumber, columnNumber)
     {
-        let knownScripts = [];
-        for (let script of this._scriptIdMap.values()) {
-            if (script.resource)
-                continue;
-            if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
-                continue;
-            knownScripts.push(script);
-        }
-
-        return knownScripts;
+        return DebuggerAgent.continueToLocation({scriptId, lineNumber, columnNumber});
     }
 
-    addBreakpoint(breakpoint, skipEventDispatch, shouldSpeculativelyResolve)
+    addBreakpoint(breakpoint, shouldSpeculativelyResolve)
     {
-        console.assert(breakpoint instanceof WebInspector.Breakpoint, "Bad argument to DebuggerManger.addBreakpoint: ", breakpoint);
+        console.assert(breakpoint instanceof WebInspector.Breakpoint);
         if (!breakpoint)
             return;
 
@@ -373,22 +390,21 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         this._breakpoints.push(breakpoint);
 
-        function speculativelyResolveBreakpoint(breakpoint) {
-            breakpoint.resolved = true;
+        if (!breakpoint.disabled) {
+            this._setBreakpoint(breakpoint, () => {
+                if (shouldSpeculativelyResolve)
+                    breakpoint.resolved = true;
+            });
         }
 
-        if (!breakpoint.disabled)
-            this._setBreakpoint(breakpoint, shouldSpeculativelyResolve ? speculativelyResolveBreakpoint.bind(null, breakpoint) : null);
-
         this._saveBreakpoints();
 
-        if (!skipEventDispatch)
-            this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded, {breakpoint});
+        this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded, {breakpoint});
     }
 
     removeBreakpoint(breakpoint)
     {
-        console.assert(breakpoint);
+        console.assert(breakpoint instanceof WebInspector.Breakpoint);
         if (!breakpoint)
             return;
 
@@ -428,6 +444,13 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
     }
 
+    nextBreakpointActionIdentifier()
+    {
+        return this._nextBreakpointActionIdentifier++;
+    }
+
+    // Protected (Called from WebInspector.DebuggerObserver)
+
     breakpointResolved(breakpointIdentifier, location)
     {
         // Called from WebInspector.DebuggerObserver.
@@ -440,7 +463,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         console.assert(breakpoint.identifier === breakpointIdentifier);
 
         if (!breakpoint.sourceCodeLocation.sourceCode) {
-            var sourceCodeLocation = this._sourceCodeLocationFromPayload(location);
+            let sourceCodeLocation = this._sourceCodeLocationFromPayload(location);
             breakpoint.sourceCodeLocation.sourceCode = sourceCodeLocation.sourceCode;
         }
 
@@ -451,7 +474,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
     {
         // Called from WebInspector.DebuggerObserver.
 
-        var wasPaused = this._paused;
+        let wasPaused = this._paused;
 
         WebInspector.Script.resetUniqueDisplayNameNumbers();
 
@@ -467,8 +490,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         // Mark all the breakpoints as unresolved. They will be reported as resolved when
         // breakpointResolved is called as the page loads.
-        for (var i = 0; i < this._breakpoints.length; ++i) {
-            var breakpoint = this._breakpoints[i];
+        for (let breakpoint of this._breakpoints) {
             breakpoint.resolved = false;
             if (breakpoint.sourceCodeLocation.sourceCode)
                 breakpoint.sourceCodeLocation.sourceCode = null;
@@ -544,11 +566,15 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     playBreakpointActionSound(breakpointActionIdentifier)
     {
+        // Called from WebInspector.DebuggerObserver.
+
         InspectorFrontendHost.beep();
     }
 
     scriptDidParse(scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL)
     {
+        // Called from WebInspector.DebuggerObserver.
+
         // Don't add the script again if it is already known.
         if (this._scriptIdMap.has(scriptIdentifier)) {
             const script = this._scriptIdMap.get(scriptIdentifier);
@@ -589,21 +615,6 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptAdded, {script});
     }
 
-    isBreakpointRemovable(breakpoint)
-    {
-        return breakpoint !== this._allExceptionsBreakpoint && breakpoint !== this._allUncaughtExceptionsBreakpoint;
-    }
-
-    isBreakpointEditable(breakpoint)
-    {
-        return this.isBreakpointRemovable(breakpoint);
-    }
-
-    get nextBreakpointActionIdentifier()
-    {
-        return this._nextBreakpointActionIdentifier++;
-    }
-
     // Private
 
     _sourceCodeLocationFromPayload(payload)
@@ -729,7 +740,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
             if (!(locations instanceof Array))
                 locations = [locations];
 
-            for (var location of locations)
+            for (let location of locations)
                 this.breakpointResolved(breakpointIdentifier, location);
 
             if (typeof callback === "function")
@@ -801,7 +812,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
         if (this._ignoreBreakpointDisplayLocationDidChangeEvent)
             return;
 
-        var breakpoint = event.target;
+        let breakpoint = event.target;
         if (!breakpoint.identifier || breakpoint.disabled)
             return;
 
@@ -861,16 +872,11 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
         function breakpointRemoved()
         {
-            // Add the breakpoint with its new condition and get a new id.
+            // Add the breakpoint with its new properties and get a new id.
             this._setBreakpoint(breakpoint);
         }
     }
 
-    get breakpointsDisabledTemporarily()
-    {
-        return this._temporarilyDisabledBreakpointsRestoreSetting.value !== null;
-    }
-
     _startDisablingBreakpointsTemporarily()
     {
         console.assert(!this.breakpointsDisabledTemporarily, "Already temporarily disabling breakpoints.");
@@ -936,7 +942,7 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
 
     _updateBreakOnExceptionsState()
     {
-        var state = "none";
+        let state = "none";
 
         if (this._breakpointsEnabledSetting.value) {
             if (!this._allExceptionsBreakpoint.disabled)
@@ -975,9 +981,8 @@ WebInspector.DebuggerManager = class DebuggerManager extends WebInspector.Object
     {
         this._ignoreBreakpointDisplayLocationDidChangeEvent = true;
 
-        for (var i = 0; i < breakpoints.length; ++i) {
-            var breakpoint = breakpoints[i];
-            if (breakpoint.sourceCodeLocation.sourceCode === null)
+        for (let breakpoint of breakpoints) {
+            if (!breakpoint.sourceCodeLocation.sourceCode)
                 breakpoint.sourceCodeLocation.sourceCode = sourceCode;
             // SourceCodes can be unequal if the SourceCodeLocation is associated with a Script and we are looking at the Resource.
             console.assert(breakpoint.sourceCodeLocation.sourceCode === sourceCode || breakpoint.sourceCodeLocation.sourceCode.contentIdentifier === sourceCode.contentIdentifier);
index e197434..71249a4 100644 (file)
@@ -44,7 +44,7 @@ WebInspector.BreakpointAction = class BreakpointAction extends WebInspector.Obje
             console.error("Unexpected type passed to WebInspector.BreakpointAction");
 
         console.assert(typeof this._type === "string");
-        this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier;
+        this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier();
     }
 
     // Public
index 9098d06..836ce15 100644 (file)
@@ -1104,9 +1104,8 @@ WebInspector.SourceCodeTextEditor = class SourceCodeTextEditor extends WebInspec
         this._addBreakpointWithEditorLineInfo(breakpoint, lineInfo);
 
         this._ignoreBreakpointAddedBreakpoint = breakpoint;
-        var shouldSkipEventDispatch = false;
-        var shouldSpeculativelyResolveBreakpoint = true;
-        WebInspector.debuggerManager.addBreakpoint(breakpoint, shouldSkipEventDispatch, shouldSpeculativelyResolveBreakpoint);
+        const shouldSpeculativelyResolveBreakpoint = true;
+        WebInspector.debuggerManager.addBreakpoint(breakpoint, shouldSpeculativelyResolveBreakpoint);
         this._ignoreBreakpointAddedBreakpoint = null;
 
         // Return the more accurate location and breakpoint info.