WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
135396
Web Inspector: breakpoints are always speculatively resolved when restored from local storage
https://bugs.webkit.org/show_bug.cgi?id=135396
Summary
Web Inspector: breakpoints are always speculatively resolved when restored fr...
Brian Burg
Reported
2014-07-29 15:30:45 PDT
A long-time quirk/optimization in the frontend is that we immediately set a breakpoint as resolved if the breakpoint was successfully set in the backend. The purpose of this is to make clicking in the gutter immediately produce a resolved breakpoint, rather than waiting for several round trips (perceived as lag). However, the logic is wrong such that any breakpoint that is set via DebuggerManager.addBreakpoint will be speculatively resolved, even if its corresponding source code has never been loaded. This can cause problems for later code that assumes a resolved breakpoint also has a valid sourceCodeLocation.sourceCode.
Attachments
Patch
(5.85 KB, patch)
2014-07-29 15:56 PDT
,
Brian Burg
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-07-29 15:33:12 PDT
<
rdar://problem/17848753
>
Brian Burg
Comment 2
2014-07-29 15:56:49 PDT
Created
attachment 235707
[details]
Patch
WebKit Commit Bot
Comment 3
2014-07-29 20:49:11 PDT
Comment on
attachment 235707
[details]
Patch Clearing flags on attachment: 235707 Committed
r171784
: <
http://trac.webkit.org/changeset/171784
>
WebKit Commit Bot
Comment 4
2014-07-29 20:49:14 PDT
All reviewed patches have been landed. Closing bug.
Joseph Pecoraro
Comment 5
2014-07-29 21:24:55 PDT
Comment on
attachment 235707
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=235707&action=review
> Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:257 > + function speculativelyResolveBreakpoint(breakpoint) { > + breakpoint.resolved = true; > + } > + > if (!breakpoint.disabled) > - this._setBreakpoint(breakpoint); > + this._setBreakpoint(breakpoint, shouldSpeculativelyResolve ? speculativelyResolveBreakpoint.bind(null, breakpoint) : null);
I think we can improve this. The _setBreakpoint callback should be passed the breakpoint, so that we aren't creating all this bound functions. function speculativelyResolveBreakpoint(breakpoint) { breakpoint.resolved = true; } this._setBreakpoint(breakpoint, shouldSpeculativelyResolve ? speculativelyResolveBrekapoint : null);
> Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:548 > + for (var location of locations) > + this.breakpointResolved(breakpointIdentifier, location); > > if (typeof callback === "function") > callback();
And here, callback would pass the breakpoint: callback(breakpoint);
Brian Burg
Comment 6
2014-07-30 09:50:07 PDT
(In reply to
comment #5
)
> (From update of
attachment 235707
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=235707&action=review
> > > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:257 > > + function speculativelyResolveBreakpoint(breakpoint) { > > + breakpoint.resolved = true; > > + } > > + > > if (!breakpoint.disabled) > > - this._setBreakpoint(breakpoint); > > + this._setBreakpoint(breakpoint, shouldSpeculativelyResolve ? speculativelyResolveBreakpoint.bind(null, breakpoint) : null); > > I think we can improve this. > > The _setBreakpoint callback should be passed the breakpoint, so that we aren't creating all this bound functions. > > function speculativelyResolveBreakpoint(breakpoint) { > breakpoint.resolved = true; > } > > this._setBreakpoint(breakpoint, shouldSpeculativelyResolve ? speculativelyResolveBrekapoint : null); > > > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:548 > > + for (var location of locations) > > + this.breakpointResolved(breakpointIdentifier, location); > > > > if (typeof callback === "function") > > callback(); > > And here, callback would pass the breakpoint: > > callback(breakpoint);
I was going to go full-blown promises here since this code doesn't handle errors well, but I'm trying to restrain myself from allocation and command optimizations until we have some useful profiling data.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug