<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207371] trunk/Source/WebInspectorUI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207371">207371</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-15 00:22:03 -0700 (Sat, 15 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsBreakpointActionjs">trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (207370 => 207371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-10-15 04:18:19 UTC (rev 207370)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-10-15 07:22:03 UTC (rev 207371)
</span><span class="lines">@@ -1,3 +1,69 @@
</span><ins>+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.
+
</ins><span class="cx"> 2016-10-14 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Dragging to delete a Breakpoint should never trigger a ContentView change
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (207370 => 207371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js        2016-10-15 04:18:19 UTC (rev 207370)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js        2016-10-15 07:22:03 UTC (rev 207371)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014, 2016 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2016 Apple Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * Redistribution and use in source and binary forms, with or without
</span><span class="cx"> * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> this._allExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-exceptions", false);
</span><span class="cx"> this._allUncaughtExceptionsBreakpointEnabledSetting = new WebInspector.Setting("break-on-all-uncaught-exceptions", false);
</span><span class="cx">
</span><del>- var specialBreakpointLocation = new WebInspector.SourceCodeLocation(null, Infinity, Infinity);
</del><ins>+ let specialBreakpointLocation = new WebInspector.SourceCodeLocation(null, Infinity, Infinity);
</ins><span class="cx">
</span><span class="cx"> this._allExceptionsBreakpoint = new WebInspector.Breakpoint(specialBreakpointLocation, !this._allExceptionsBreakpointEnabledSetting.value);
</span><span class="cx"> this._allExceptionsBreakpoint.resolved = true;
</span><span class="lines">@@ -85,9 +85,11 @@
</span><span class="cx">
</span><span class="cx"> this._updateBreakOnExceptionsState();
</span><span class="cx">
</span><ins>+ this._ignoreBreakpointDisplayLocationDidChangeEvent = false;
+
</ins><span class="cx"> function restoreBreakpointsSoon() {
</span><span class="cx"> this._restoringBreakpoints = true;
</span><del>- for (var cookie of this._breakpointsSetting.value)
</del><ins>+ for (let cookie of this._breakpointsSetting.value)
</ins><span class="cx"> this.addBreakpoint(new WebInspector.Breakpoint(cookie));
</span><span class="cx"> this._restoringBreakpoints = false;
</span><span class="cx"> }
</span><span class="lines">@@ -99,6 +101,99 @@
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><ins>+ 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);
+ }
+
</ins><span class="cx"> get breakpointsEnabled()
</span><span class="cx"> {
</span><span class="cx"> return this._breakpointsEnabledSetting.value;
</span><span class="lines">@@ -122,39 +217,39 @@
</span><span class="cx"> this._updateBreakOnExceptionsState();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- get paused()
</del><ins>+ get breakpointsDisabledTemporarily()
</ins><span class="cx"> {
</span><del>- return this._paused;
</del><ins>+ return this._temporarilyDisabledBreakpointsRestoreSetting.value !== null;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- get pauseReason()
</del><ins>+ scriptForIdentifier(id)
</ins><span class="cx"> {
</span><del>- return this._pauseReason;
</del><ins>+ return this._scriptIdMap.get(id) || null;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- get pauseData()
</del><ins>+ scriptsForURL(url)
</ins><span class="cx"> {
</span><del>- return this._pauseData;
</del><ins>+ // FIXME: This may not be safe. A Resource's URL may differ from a Script's URL.
+ return this._scriptContentIdentifierMap.get(url) || [];
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- get callFrames()
</del><ins>+ get searchableScripts()
</ins><span class="cx"> {
</span><del>- return this._callFrames;
</del><ins>+ return this.knownNonResourceScripts.filter((script) => !!script.contentIdentifier);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- get activeCallFrame()
</del><ins>+ get knownNonResourceScripts()
</ins><span class="cx"> {
</span><del>- return this._activeCallFrame;
- }
</del><ins>+ let knownScripts = [];
+ for (let script of this._scriptIdMap.values()) {
+ if (script.resource)
+ continue;
+ if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(script.sourceURL))
+ continue;
+ knownScripts.push(script);
+ }
</ins><span class="cx">
</span><del>- set activeCallFrame(callFrame)
- {
- if (callFrame === this._activeCallFrame)
- return;
-
- this._activeCallFrame = callFrame || null;
-
- this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);
</del><ins>+ return knownScripts;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> pause()
</span><span class="lines">@@ -164,13 +259,13 @@
</span><span class="cx">
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.WaitingToPause);
</span><span class="cx">
</span><del>- var listener = new WebInspector.EventListener(this, true);
</del><ins>+ let listener = new WebInspector.EventListener(this, true);
</ins><span class="cx">
</span><del>- var managerResult = new Promise(function(resolve, reject) {
</del><ins>+ let managerResult = new Promise(function(resolve, reject) {
</ins><span class="cx"> listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Paused, resolve);
</span><span class="cx"> });
</span><span class="cx">
</span><del>- var protocolResult = DebuggerAgent.pause()
</del><ins>+ let protocolResult = DebuggerAgent.pause()
</ins><span class="cx"> .catch(function(error) {
</span><span class="cx"> listener.disconnect();
</span><span class="cx"> console.error("DebuggerManager.pause failed: ", error);
</span><span class="lines">@@ -185,13 +280,13 @@
</span><span class="cx"> if (!this._paused)
</span><span class="cx"> return Promise.resolve();
</span><span class="cx">
</span><del>- var listener = new WebInspector.EventListener(this, true);
</del><ins>+ let listener = new WebInspector.EventListener(this, true);
</ins><span class="cx">
</span><del>- var managerResult = new Promise(function(resolve, reject) {
</del><ins>+ let managerResult = new Promise(function(resolve, reject) {
</ins><span class="cx"> listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.Resumed, resolve);
</span><span class="cx"> });
</span><span class="cx">
</span><del>- var protocolResult = DebuggerAgent.resume()
</del><ins>+ let protocolResult = DebuggerAgent.resume()
</ins><span class="cx"> .catch(function(error) {
</span><span class="cx"> listener.disconnect();
</span><span class="cx"> console.error("DebuggerManager.resume failed: ", error);
</span><span class="lines">@@ -206,13 +301,13 @@
</span><span class="cx"> if (!this._paused)
</span><span class="cx"> return Promise.reject(new Error("Cannot step over because debugger is not paused."));
</span><span class="cx">
</span><del>- var listener = new WebInspector.EventListener(this, true);
</del><ins>+ let listener = new WebInspector.EventListener(this, true);
</ins><span class="cx">
</span><del>- var managerResult = new Promise(function(resolve, reject) {
</del><ins>+ let managerResult = new Promise(function(resolve, reject) {
</ins><span class="cx"> listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
</span><span class="cx"> });
</span><span class="cx">
</span><del>- var protocolResult = DebuggerAgent.stepOver()
</del><ins>+ let protocolResult = DebuggerAgent.stepOver()
</ins><span class="cx"> .catch(function(error) {
</span><span class="cx"> listener.disconnect();
</span><span class="cx"> console.error("DebuggerManager.stepOver failed: ", error);
</span><span class="lines">@@ -227,13 +322,13 @@
</span><span class="cx"> if (!this._paused)
</span><span class="cx"> return Promise.reject(new Error("Cannot step into because debugger is not paused."));
</span><span class="cx">
</span><del>- var listener = new WebInspector.EventListener(this, true);
</del><ins>+ let listener = new WebInspector.EventListener(this, true);
</ins><span class="cx">
</span><del>- var managerResult = new Promise(function(resolve, reject) {
</del><ins>+ let managerResult = new Promise(function(resolve, reject) {
</ins><span class="cx"> listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
</span><span class="cx"> });
</span><span class="cx">
</span><del>- var protocolResult = DebuggerAgent.stepInto()
</del><ins>+ let protocolResult = DebuggerAgent.stepInto()
</ins><span class="cx"> .catch(function(error) {
</span><span class="cx"> listener.disconnect();
</span><span class="cx"> console.error("DebuggerManager.stepInto failed: ", error);
</span><span class="lines">@@ -248,13 +343,13 @@
</span><span class="cx"> if (!this._paused)
</span><span class="cx"> return Promise.reject(new Error("Cannot step out because debugger is not paused."));
</span><span class="cx">
</span><del>- var listener = new WebInspector.EventListener(this, true);
</del><ins>+ let listener = new WebInspector.EventListener(this, true);
</ins><span class="cx">
</span><del>- var managerResult = new Promise(function(resolve, reject) {
</del><ins>+ let managerResult = new Promise(function(resolve, reject) {
</ins><span class="cx"> listener.connect(WebInspector.debuggerManager, WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, resolve);
</span><span class="cx"> });
</span><span class="cx">
</span><del>- var protocolResult = DebuggerAgent.stepOut()
</del><ins>+ let protocolResult = DebuggerAgent.stepOut()
</ins><span class="cx"> .catch(function(error) {
</span><span class="cx"> listener.disconnect();
</span><span class="cx"> console.error("DebuggerManager.stepOut failed: ", error);
</span><span class="lines">@@ -264,92 +359,14 @@
</span><span class="cx"> return Promise.all([managerResult, protocolResult]);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- get allExceptionsBreakpoint()
</del><ins>+ continueToLocation(scriptId, lineNumber, columnNumber)
</ins><span class="cx"> {
</span><del>- return this._allExceptionsBreakpoint;
</del><ins>+ return DebuggerAgent.continueToLocation({scriptId, lineNumber, columnNumber});
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- get allUncaughtExceptionsBreakpoint()
</del><ins>+ addBreakpoint(breakpoint, shouldSpeculativelyResolve)
</ins><span class="cx"> {
</span><del>- 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()
- {
- 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;
- }
-
- addBreakpoint(breakpoint, skipEventDispatch, shouldSpeculativelyResolve)
- {
- console.assert(breakpoint instanceof WebInspector.Breakpoint, "Bad argument to DebuggerManger.addBreakpoint: ", breakpoint);
</del><ins>+ console.assert(breakpoint instanceof WebInspector.Breakpoint);
</ins><span class="cx"> if (!breakpoint)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -373,22 +390,21 @@
</span><span class="cx">
</span><span class="cx"> this._breakpoints.push(breakpoint);
</span><span class="cx">
</span><del>- function speculativelyResolveBreakpoint(breakpoint) {
- breakpoint.resolved = true;
</del><ins>+ if (!breakpoint.disabled) {
+ this._setBreakpoint(breakpoint, () => {
+ if (shouldSpeculativelyResolve)
+ breakpoint.resolved = true;
+ });
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (!breakpoint.disabled)
- this._setBreakpoint(breakpoint, shouldSpeculativelyResolve ? speculativelyResolveBreakpoint.bind(null, breakpoint) : null);
-
</del><span class="cx"> this._saveBreakpoints();
</span><span class="cx">
</span><del>- if (!skipEventDispatch)
- this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded, {breakpoint});
</del><ins>+ this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded, {breakpoint});
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> removeBreakpoint(breakpoint)
</span><span class="cx"> {
</span><del>- console.assert(breakpoint);
</del><ins>+ console.assert(breakpoint instanceof WebInspector.Breakpoint);
</ins><span class="cx"> if (!breakpoint)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -428,6 +444,13 @@
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointRemoved, {breakpoint});
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ nextBreakpointActionIdentifier()
+ {
+ return this._nextBreakpointActionIdentifier++;
+ }
+
+ // Protected (Called from WebInspector.DebuggerObserver)
+
</ins><span class="cx"> breakpointResolved(breakpointIdentifier, location)
</span><span class="cx"> {
</span><span class="cx"> // Called from WebInspector.DebuggerObserver.
</span><span class="lines">@@ -440,7 +463,7 @@
</span><span class="cx"> console.assert(breakpoint.identifier === breakpointIdentifier);
</span><span class="cx">
</span><span class="cx"> if (!breakpoint.sourceCodeLocation.sourceCode) {
</span><del>- var sourceCodeLocation = this._sourceCodeLocationFromPayload(location);
</del><ins>+ let sourceCodeLocation = this._sourceCodeLocationFromPayload(location);
</ins><span class="cx"> breakpoint.sourceCodeLocation.sourceCode = sourceCodeLocation.sourceCode;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -451,7 +474,7 @@
</span><span class="cx"> {
</span><span class="cx"> // Called from WebInspector.DebuggerObserver.
</span><span class="cx">
</span><del>- var wasPaused = this._paused;
</del><ins>+ let wasPaused = this._paused;
</ins><span class="cx">
</span><span class="cx"> WebInspector.Script.resetUniqueDisplayNameNumbers();
</span><span class="cx">
</span><span class="lines">@@ -467,8 +490,7 @@
</span><span class="cx">
</span><span class="cx"> // Mark all the breakpoints as unresolved. They will be reported as resolved when
</span><span class="cx"> // breakpointResolved is called as the page loads.
</span><del>- for (var i = 0; i < this._breakpoints.length; ++i) {
- var breakpoint = this._breakpoints[i];
</del><ins>+ for (let breakpoint of this._breakpoints) {
</ins><span class="cx"> breakpoint.resolved = false;
</span><span class="cx"> if (breakpoint.sourceCodeLocation.sourceCode)
</span><span class="cx"> breakpoint.sourceCodeLocation.sourceCode = null;
</span><span class="lines">@@ -544,11 +566,15 @@
</span><span class="cx">
</span><span class="cx"> playBreakpointActionSound(breakpointActionIdentifier)
</span><span class="cx"> {
</span><ins>+ // Called from WebInspector.DebuggerObserver.
+
</ins><span class="cx"> InspectorFrontendHost.beep();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> scriptDidParse(scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL)
</span><span class="cx"> {
</span><ins>+ // Called from WebInspector.DebuggerObserver.
+
</ins><span class="cx"> // Don't add the script again if it is already known.
</span><span class="cx"> if (this._scriptIdMap.has(scriptIdentifier)) {
</span><span class="cx"> const script = this._scriptIdMap.get(scriptIdentifier);
</span><span class="lines">@@ -589,21 +615,6 @@
</span><span class="cx"> this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptAdded, {script});
</span><span class="cx"> }
</span><span class="cx">
</span><del>- isBreakpointRemovable(breakpoint)
- {
- return breakpoint !== this._allExceptionsBreakpoint && breakpoint !== this._allUncaughtExceptionsBreakpoint;
- }
-
- isBreakpointEditable(breakpoint)
- {
- return this.isBreakpointRemovable(breakpoint);
- }
-
- get nextBreakpointActionIdentifier()
- {
- return this._nextBreakpointActionIdentifier++;
- }
-
</del><span class="cx"> // Private
</span><span class="cx">
</span><span class="cx"> _sourceCodeLocationFromPayload(payload)
</span><span class="lines">@@ -729,7 +740,7 @@
</span><span class="cx"> if (!(locations instanceof Array))
</span><span class="cx"> locations = [locations];
</span><span class="cx">
</span><del>- for (var location of locations)
</del><ins>+ for (let location of locations)
</ins><span class="cx"> this.breakpointResolved(breakpointIdentifier, location);
</span><span class="cx">
</span><span class="cx"> if (typeof callback === "function")
</span><span class="lines">@@ -801,7 +812,7 @@
</span><span class="cx"> if (this._ignoreBreakpointDisplayLocationDidChangeEvent)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- var breakpoint = event.target;
</del><ins>+ let breakpoint = event.target;
</ins><span class="cx"> if (!breakpoint.identifier || breakpoint.disabled)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -861,16 +872,11 @@
</span><span class="cx">
</span><span class="cx"> function breakpointRemoved()
</span><span class="cx"> {
</span><del>- // Add the breakpoint with its new condition and get a new id.
</del><ins>+ // Add the breakpoint with its new properties and get a new id.
</ins><span class="cx"> this._setBreakpoint(breakpoint);
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- get breakpointsDisabledTemporarily()
- {
- return this._temporarilyDisabledBreakpointsRestoreSetting.value !== null;
- }
-
</del><span class="cx"> _startDisablingBreakpointsTemporarily()
</span><span class="cx"> {
</span><span class="cx"> console.assert(!this.breakpointsDisabledTemporarily, "Already temporarily disabling breakpoints.");
</span><span class="lines">@@ -936,7 +942,7 @@
</span><span class="cx">
</span><span class="cx"> _updateBreakOnExceptionsState()
</span><span class="cx"> {
</span><del>- var state = "none";
</del><ins>+ let state = "none";
</ins><span class="cx">
</span><span class="cx"> if (this._breakpointsEnabledSetting.value) {
</span><span class="cx"> if (!this._allExceptionsBreakpoint.disabled)
</span><span class="lines">@@ -975,9 +981,8 @@
</span><span class="cx"> {
</span><span class="cx"> this._ignoreBreakpointDisplayLocationDidChangeEvent = true;
</span><span class="cx">
</span><del>- for (var i = 0; i < breakpoints.length; ++i) {
- var breakpoint = breakpoints[i];
- if (breakpoint.sourceCodeLocation.sourceCode === null)
</del><ins>+ for (let breakpoint of breakpoints) {
+ if (!breakpoint.sourceCodeLocation.sourceCode)
</ins><span class="cx"> breakpoint.sourceCodeLocation.sourceCode = sourceCode;
</span><span class="cx"> // SourceCodes can be unequal if the SourceCodeLocation is associated with a Script and we are looking at the Resource.
</span><span class="cx"> console.assert(breakpoint.sourceCodeLocation.sourceCode === sourceCode || breakpoint.sourceCodeLocation.sourceCode.contentIdentifier === sourceCode.contentIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsBreakpointActionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js (207370 => 207371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js        2016-10-15 04:18:19 UTC (rev 207370)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/BreakpointAction.js        2016-10-15 07:22:03 UTC (rev 207371)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> console.error("Unexpected type passed to WebInspector.BreakpointAction");
</span><span class="cx">
</span><span class="cx"> console.assert(typeof this._type === "string");
</span><del>- this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier;
</del><ins>+ this._id = WebInspector.debuggerManager.nextBreakpointActionIdentifier();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Public
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (207370 => 207371)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2016-10-15 04:18:19 UTC (rev 207370)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2016-10-15 07:22:03 UTC (rev 207371)
</span><span class="lines">@@ -1104,9 +1104,8 @@
</span><span class="cx"> this._addBreakpointWithEditorLineInfo(breakpoint, lineInfo);
</span><span class="cx">
</span><span class="cx"> this._ignoreBreakpointAddedBreakpoint = breakpoint;
</span><del>- var shouldSkipEventDispatch = false;
- var shouldSpeculativelyResolveBreakpoint = true;
- WebInspector.debuggerManager.addBreakpoint(breakpoint, shouldSkipEventDispatch, shouldSpeculativelyResolveBreakpoint);
</del><ins>+ const shouldSpeculativelyResolveBreakpoint = true;
+ WebInspector.debuggerManager.addBreakpoint(breakpoint, shouldSpeculativelyResolveBreakpoint);
</ins><span class="cx"> this._ignoreBreakpointAddedBreakpoint = null;
</span><span class="cx">
</span><span class="cx"> // Return the more accurate location and breakpoint info.
</span></span></pre>
</div>
</div>
</body>
</html>