Bug 1288150 - Adds fast breakpoint presents check for removeBreakpoints. r?jlongster
MozReview-Commit-ID: KKDUw6st4Bs
--- a/devtools/client/sourceeditor/debugger.js
+++ b/devtools/client/sourceeditor/debugger.js
@@ -185,17 +185,25 @@ function addBreakpoint(ctx, line, cond)
function removeBreakpoints(ctx) {
let { ed, cm } = ctx;
let meta = dbginfo.get(ed);
if (meta.breakpoints != null) {
meta.breakpoints = {};
}
- cm.doc.iter((line) => { removeBreakpoint(ctx, line); });
+ cm.doc.iter((line) => {
+ // The hasBreakpoint is a slow operation: checks the line type, whether cm
+ // is initialized and creates several new objects. Inlining the line's
+ // wrapClass property check directly.
+ if (line.wrapClass == null || !line.wrapClass.includes("breakpoint")) {
+ return;
+ }
+ removeBreakpoint(ctx, line);
+ });
}
/**
* Removes a visual breakpoint from a specified line and
* makes Editor emit a breakpointRemoved event.
*/
function removeBreakpoint(ctx, line) {
if (!hasBreakpoint(ctx, line)) {