Chrome(版本23.0.1271.101)。我在OS X上,如果这很重要的话。
为什么Chrome能够禁用和/或停用断点?是否有一些我不知道的用电?
我 注意到我可以禁用一些断点,然后停用所有断点。重新激活它们后,将禁用相同的禁用它们。除此之外,有两个选择的目的是什么?
答案 0 :(得分:9)
停用断点会关闭断点功能。禁用所有断点是将每个断点标记为已禁用的快捷方式。
比较启用所有断点和激活断点时,差异会变得更清晰。
可以通过每个断点旁边的复选框启用或禁用单个断点。
禁用所有断点取消选中所有断点,实际上会关闭断点功能。 Deactivate Breakpoints显式关闭断点功能。所以这两个选项具有相同的效果。
激活断点启用断点功能,保留各个断点的启用/禁用状态。 Enable All Breakpoints启用每个断点,但如果已取消激活,则不会自行打开断点功能。
答案 1 :(得分:1)
这是最近铬源的断点原型。如您所见,启用或禁用断点。我没有看到任何可以反映断点的属性是否被禁用"或"停用"。也许它与条件有关。否则我会说这是一个前端不一致。
WebInspector.BreakpointManager.Breakpoint.prototype = {
/**
* @return {WebInspector.UILocation}
*/
primaryUILocation: function()
{
return this._primaryUILocation;
},
/**
* @param {WebInspector.DebuggerModel.Location} location
*/
_addResolvedLocation: function(location)
{
this._liveLocations.push(this._breakpointManager._debuggerModel.createLiveLocation(location, this._locationUpdated.bind(this, location)));
},
/**
* @param {WebInspector.DebuggerModel.Location} location
* @param {WebInspector.UILocation} uiLocation
*/
_locationUpdated: function(location, uiLocation)
{
var stringifiedLocation = location.scriptId + ":" + location.lineNumber + ":" + location.columnNumber;
var oldUILocation = /** @type {WebInspector.UILocation} */ (this._uiLocations[stringifiedLocation]);
if (oldUILocation)
this._breakpointManager._uiLocationRemoved(this, oldUILocation);
if (this._uiLocations[""]) {
delete this._uiLocations[""];
this._breakpointManager._uiLocationRemoved(this, this._primaryUILocation);
}
this._uiLocations[stringifiedLocation] = uiLocation;
this._breakpointManager._uiLocationAdded(this, uiLocation);
},
/**
* @return {boolean}
*/
enabled: function()
{
return this._enabled;
},
/**
* @param {boolean} enabled
*/
setEnabled: function(enabled)
{
this._updateBreakpoint(this._condition, enabled);
},
/**
* @return {string}
*/
condition: function()
{
return this._condition;
},
/**
* @param {string} condition
*/
setCondition: function(condition)
{
this._updateBreakpoint(condition, this._enabled);
},
/**
* @param {string} condition
* @param {boolean} enabled
*/
_updateBreakpoint: function(condition, enabled)
{
if (this._enabled === enabled && this._condition === condition)
return;
if (this._enabled)
this._removeFromDebugger();
this._enabled = enabled;
this._condition = condition;
this._breakpointManager._storage._updateBreakpoint(this);
var scriptFile = this._primaryUILocation.uiSourceCode.scriptFile();
if (this._enabled && !(scriptFile && scriptFile.hasDivergedFromVM())) {
this._setInDebugger();
return;
}
this._fakeBreakpointAtPrimaryLocation();
},
/**
* @param {boolean=} keepInStorage
*/
remove: function(keepInStorage)
{
var removeFromStorage = !keepInStorage;
this._resetLocations();
this._removeFromDebugger();
this._breakpointManager._removeBreakpoint(this, removeFromStorage);
},
_setInDebugger: function()
{
var rawLocation = this._primaryUILocation.uiLocationToRawLocation();
var debuggerModelLocation = /** @type {WebInspector.DebuggerModel.Location} */ (rawLocation);
if (debuggerModelLocation)
this._breakpointManager._debuggerModel.setBreakpointByScriptLocation(debuggerModelLocation, this._condition, didSetBreakpoint.bind(this));
else
this._breakpointManager._debuggerModel.setBreakpointByURL(this._primaryUILocation.uiSourceCode.url, this._primaryUILocation.lineNumber, 0, this._condition, didSetBreakpoint.bind(this));
/**
* @this {WebInspector.BreakpointManager.Breakpoint}
* @param {?DebuggerAgent.BreakpointId} breakpointId
* @param {Array.<WebInspector.DebuggerModel.Location>} locations
*/
function didSetBreakpoint(breakpointId, locations)
{
if (!breakpointId) {
this._resetLocations();
this._breakpointManager._removeBreakpoint(this, false);
return;
}
this._debuggerId = breakpointId;
this._breakpointManager._breakpointForDebuggerId[breakpointId] = this;
if (!locations.length) {
this._fakeBreakpointAtPrimaryLocation();
return;
}
this._resetLocations();
for (var i = 0; i < locations.length; ++i) {
var script = this._breakpointManager._debuggerModel.scriptForId(locations[i].scriptId);
var uiLocation = script.rawLocationToUILocation(locations[i].lineNumber, locations[i].columnNumber);
if (this._breakpointManager.findBreakpoint(uiLocation.uiSourceCode, uiLocation.lineNumber)) {
// location clash
this.remove();
return;
}
}
for (var i = 0; i < locations.length; ++i)
this._addResolvedLocation(locations[i]);
}
},
_removeFromDebugger: function()
{
if (this._debuggerId) {
this._breakpointManager._debuggerModel.removeBreakpoint(this._debuggerId);
delete this._breakpointManager._breakpointForDebuggerId[this._debuggerId];
delete this._debuggerId;
}
},
_resetLocations: function()
{
for (var stringifiedLocation in this._uiLocations)
this._breakpointManager._uiLocationRemoved(this, this._uiLocations[stringifiedLocation]);
for (var i = 0; i < this._liveLocations.length; ++i)
this._liveLocations[i].dispose();
this._liveLocations = [];
this._uiLocations = {};
},
/**
* @return {string}
*/
_breakpointStorageId: function()
{
return this._sourceFileId + ":" + this._primaryUILocation.lineNumber;
},
_fakeBreakpointAtPrimaryLocation: function()
{
this._resetLocations();
this._uiLocations[""] = this._primaryUILocation;
this._breakpointManager._uiLocationAdded(this, this._primaryUILocation);
}
}