Bug 140276 - Web Inspector: Phantom breakpoint appears on empty line after reload of minified file with a breakpoint
Summary: Web Inspector: Phantom breakpoint appears on empty line after reload of minif...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-01-08 18:00 PST by Joseph Pecoraro
Modified: 2015-01-09 12:31 PST (History)
9 users (show)

See Also:


Attachments
[REDUCTION] Test Case (2.00 KB, application/zip)
2015-01-08 18:00 PST, Joseph Pecoraro
no flags Details
[PATCH] Proposed Fix (1.75 KB, patch)
2015-01-08 19:06 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-01-08 18:00:41 PST
Created attachment 244311 [details]
[REDUCTION] Test Case

* SUMMARY
Phantom breakpoint appears on empty line after reload of minified file with a breakpoint.

* STEPS TO REPRODUCE
1. Inspect attached test case
2. Select resource "foo.min.js"
3. Pretty print the resource
4. Set a breakpoint on line 6 (console.log("test"))
5. Reload the page
  => in "foo.min.js" there are now 2 breakpoints, 1 is a phantom

* NOTES
- There appears to be some significance that the minified file has a newline at the end. Removing the newline didn't cause the phantom to appear.
- After steps, removing and resetting a breakpoint has further issues. There may be yet another bug here.
Comment 1 Radar WebKit Bug Importer 2015-01-08 18:01:40 PST
<rdar://problem/19421470>
Comment 2 Joseph Pecoraro 2015-01-08 19:05:03 PST
I believe this to be a CodeMirror issue. Filed:
https://github.com/codemirror/CodeMirror/issues/3023

However, I have a workaround for us.
Comment 3 Joseph Pecoraro 2015-01-08 19:06:12 PST
Created attachment 244314 [details]
[PATCH] Proposed Fix
Comment 4 Timothy Hatcher 2015-01-08 19:45:49 PST
Comment on attachment 244314 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=244314&action=review

> Source/WebInspectorUI/UserInterface/Views/TextEditor.js:115
> +                this._codeMirror.removeLineClass(0, "wrap");

_codeMirror.removeLineClass is a weird API. I had to look up what this meant. I thought the class was "wrap", but that is the element. No class removes all classes.
Comment 5 Timothy Hatcher 2015-01-08 19:48:11 PST
Comment on attachment 244314 [details]
[PATCH] Proposed Fix

Who is setting the style before content loads? That seems like a bug too. I assume they set the breakpoints again after content loads.
Comment 6 WebKit Commit Bot 2015-01-08 20:25:31 PST
Comment on attachment 244314 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 244314

Committed r178153: <http://trac.webkit.org/changeset/178153>
Comment 7 WebKit Commit Bot 2015-01-08 20:25:35 PST
All reviewed patches have been landed.  Closing bug.
Comment 8 Joseph Pecoraro 2015-01-09 12:31:28 PST
(In reply to comment #5)
> Comment on attachment 244314 [details]
> [PATCH] Proposed Fix
> 
> Who is setting the style before content loads? That seems like a bug too. I
> assume they set the breakpoints again after content loads.

SourceCodeTextEditor in "_contentWillPopulate" pushes its breakpoints down to TextEditor. TextEditor, being none the wiser, attempts to set line styles for those breakpoints despite the editor being empty. That path could bail early. There are also line styles for the current execution line, I did not see how that would get set in relation to loading of content. I assume it would also have this issue.

FWIW, CodeMirror fixed the issue upstream.