Commit 921d5298 authored by kozyatinskiy's avatar kozyatinskiy Committed by Commit bot

[DevTools] chaotic green dots displacement fix

With the experiment, we see the markers for a brief second before they are
immediately removed without any user intervention.  This CL fixes the race.

BUG=chromium:695236
R=luoe@chromium.org,lushnikov@chromium.org

Review-Url: https://codereview.chromium.org/2742653003
Cr-Commit-Position: refs/heads/master@{#456174}
parent adcdf2d7
......@@ -595,9 +595,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame);
if (!callFrame)
return;
if (this._clearContinueToLocationsTimer) {
clearTimeout(this._clearContinueToLocationsTimer);
delete this._clearContinueToLocationsTimer;
}
var localScope = callFrame.localScope();
if (!localScope)
if (!localScope) {
this.textEditor.operation(clearExistingLocations.bind(this));
return;
}
var start = localScope.startLocation();
var end = localScope.endLocation();
var debuggerModel = callFrame.debuggerModel;
......@@ -605,20 +611,12 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
debuggerModel.getPossibleBreakpoints(start, end, true)
.then(locations => this.textEditor.operation(renderLocations.bind(this, locations)));
if (this._clearContinueToLocationsTimer) {
clearTimeout(this._clearContinueToLocationsTimer);
delete this._clearContinueToLocationsTimer;
}
/**
* @param {!Array<!SDK.DebuggerModel.BreakLocation>} locations
* @this {Sources.JavaScriptSourceFrame}
*/
function renderLocations(locations) {
var bookmarks = this.textEditor.bookmarks(
this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol);
bookmarks.map(bookmark => bookmark.clear());
clearExistingLocations.call(this);
for (var location of locations) {
var icon;
var isCurrent = location.lineNumber === executionLocation.lineNumber &&
......@@ -647,6 +645,15 @@ Sources.JavaScriptSourceFrame = class extends SourceFrame.UISourceCodeFrame {
}
}
/**
* @this {Sources.JavaScriptSourceFrame}
*/
function clearExistingLocations() {
var bookmarks = this.textEditor.bookmarks(
this.textEditor.fullRange(), Sources.JavaScriptSourceFrame.continueToLocationDecorationSymbol);
bookmarks.map(bookmark => bookmark.clear());
}
/**
* @param {!Event} event
* @this {Sources.JavaScriptSourceFrame}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment