This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 239549 - Unable to toggle line breakpoint in JS file
Summary: Unable to toggle line breakpoint in JS file
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.0
Hardware: PC Linux
: P2 normal with 3 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords: RANDOM
: 240706 243420 243952 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-12-17 09:02 UTC by Vladimir Riha
Modified: 2014-09-22 15:09 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (68.62 KB, text/plain)
2013-12-17 09:34 UTC, Vladimir Riha
Details
webkit log (4.74 MB, text/plain)
2013-12-17 09:36 UTC, Vladimir Riha
Details
IDE log #2 (703.39 KB, text/x-log)
2014-01-09 16:34 UTC, Vladimir Riha
Details
Failue to toggle png (8.14 KB, image/png)
2014-04-26 20:38 UTC, AnnM
Details
screenshot (15.29 KB, image/png)
2014-05-21 23:02 UTC, David Konecny
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2013-12-17 09:02:28 UTC
Sometimes (so far I've seen it twice in 2 days) I cannot create a line breakpoint in JS file inside PHP/HTML5 project. When I toggle line breakpoint, the line goes for a very short moment red as expected, after few milliseconds it goes back to the original state and breakpoint does not exist (no indication of it in IDE, not being used when debugging). There is nothing special in IDE log. DOM breakpoints work fine though.

When this happens, IDE restart helps. I'm trying to find some steps to reproduce, but so far without any luck. 

Both times it happened, I had JavaSE and PHP activated and was running on JDK8

Product Version: NetBeans IDE Dev (Build 201312170002)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b61
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b119
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 Vladimir Riha 2013-12-17 09:34:44 UTC
Created attachment 143234 [details]
IDE log

IDE log after unsuccessful line breakpoint creation
Comment 2 Vladimir Riha 2013-12-17 09:36:08 UTC
Created attachment 143235 [details]
webkit log

webkit log
Comment 3 Vladimir Riha 2013-12-17 09:40:25 UTC
It seems it is not about creating only, but also about removing. I just saw that the existing breakpoint cannot be toggled off.

However creating/removing breakpoints from Breakpoints window works. One thing I noticed (not sure if related) if I invoke New Breakpoint dialog from Breakpoints while focus is in JS file, then file field in the dialog is not prefilled with path to the current file
Comment 4 Martin Entlicher 2013-12-17 18:14:24 UTC
Should be fixed by changeset:   269542:80ef2da79430
http://hg.netbeans.org/core-main/rev/80ef2da79430
Comment 5 Vladimir Riha 2013-12-17 18:39:00 UTC
Thank you, I've been trying to reproduce it today for some quite some time but haven't find a way.
Comment 6 Quality Engineering 2013-12-19 03:14:19 UTC
Integrated into 'main-silver', will be available in build *201312190002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/80ef2da79430
User: mentlicher@netbeans.org
Log: #239549: Breakpoint annotation and submission repair.
Comment 7 Vladimir Riha 2014-01-09 16:33:49 UTC
I'm sorry I've just seen it with PHP project. I couldn't toggle line breakpoint in JS file but I could in embedded JavaScript in HTML file. The project was not running.


Product Version: NetBeans IDE Dev (Build 201401080002)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b65
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b122
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 8 Vladimir Riha 2014-01-09 16:34:27 UTC
Created attachment 143758 [details]
IDE log #2
Comment 9 Vladimir Riha 2014-01-09 16:35:21 UTC
If it helps, I can provide thread dump and profiler snapshot
Comment 10 Vladimir Riha 2014-01-20 13:50:52 UTC
*** Bug 240706 has been marked as a duplicate of this bug. ***
Comment 11 Vladimir Riha 2014-01-20 15:45:40 UTC
Although I don't think that in my previous cases I've made any file manipulation, but following steps do reproduce the same behavior (but cause could be different):
 - create a HTML5 sample responsive rabbits
 - run it in Chrome with NB integration 
 - open js/loadWelcome.js and toggle line breakpoint on line 9 (went OK)
 - in IDE, rename loadWelcome.js to loadWelcome2.js
 - open index.html and update line 12 to

<script type="text/javascript" src="js/loadWelcome2.js"></script>
  
 - save the file (triggers reload in browser)
 - debugger stops on line 9, now try to toggle line breakpoint on line 19

=> does not work, acts as if I did 2 quick clicks (one to toggle on, 2nd to toggle off line breakpoint). The only way to add line breakpoint is to use New Breakpoint dialog.



Product Version: NetBeans IDE Dev (Build 201401200001)
Java: 1.8.0-ea; Java HotSpot(TM) Client VM 25.0-b65
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b122
System: Linux version 3.2.0-48-generic-pae running on i386; UTF-8; en_US (nb)
Comment 12 swpalmer 2014-03-15 03:18:10 UTC
I have also seen this on Windows with a HTML 5 project and Chrome integration.  I was using the NB 8.0 FCS build 201403052200.

It happens very frequently for me.  First removing a breakpoint via clicking in the gutter becomes impossible (though it appears that it can be shifted to adjacent lines or something).  Then once I remove it via the Breakpoints window I find clicking in the gutter will not make a new breakpoint.
Comment 13 avandecreme 2014-04-10 22:17:23 UTC
I tried to debug this. I am still not sure how to reproduce the bug every time but I identified the problem.

It happens when org.netbeans.modules.web.javascript.debugger.breakpoints.BreakpointActionProvider (which should only handle javascript embeded in HTML files) try to activate the breakpoint.

It then conflicts with org.netbeans.modules.javascript2.debug.breakpoints.ToggleBreakpointActionProvider (which rightfully handle JS files) which also try to add the breakpoint.
Since the breakpoint is already present then, it is considered a removal.


I haven't yet found why BreakpointActionProvider.doAction is called on JS files too.
Comment 14 Vladimir Riha 2014-04-11 05:59:09 UTC
Thank you avandecreme for evaluating.

Martin, could you please look at it for patch? Thank you
Comment 15 Martin Entlicher 2014-04-11 07:58:36 UTC
Thanks for your analysis. Looking into it...
Comment 16 avandecreme 2014-04-11 15:33:55 UTC
I think I have a fix but I am not sure whether it might break something else or not.

In org.netbeans.modules.web.javascript.debugger.MiscEditorUtil.getCurrentLine,

the following test:
if (!MiscEditorUtil.isJavascriptSource(fo) && !MiscEditorUtil.isHTMLSource(fo))

should now be:
if (!MiscEditorUtil.isHTMLSource(fo))

This is because the Javascript files are now handled by ToggleBreakpointActionProvider which is using its own JSUtils.getCurrentLine method.
Comment 17 avandecreme 2014-04-11 15:38:28 UTC
Also, for those needing a workaround: do not open any html file within netbeans.
Hopefully, those don't change much often :)
Comment 18 Martin Entlicher 2014-04-11 21:53:41 UTC
Thanks, it's fixed by changeset:   273687:626c89e252e0
http://hg.netbeans.org/core-main/rev/626c89e252e0
Comment 19 Martin Entlicher 2014-04-11 21:55:38 UTC
*** Bug 243420 has been marked as a duplicate of this bug. ***
Comment 20 Martin Entlicher 2014-04-11 21:57:16 UTC
Increasing the priority to P2 - it's a duplicate of a P2 issue and it's an annoying regression.
Comment 21 Quality Engineering 2014-04-13 01:24:43 UTC
Integrated into 'main-silver', will be available in build *201404130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/626c89e252e0
User: mentlicher@netbeans.org
Log: #239549: Assure that BreakpointActionProvider is enabled on HTML files only.
Comment 22 Vladimir Riha 2014-04-16 11:05:37 UTC
Thank you, case from comment #11 is no longer reproducible but I cannot 100% verify if the problem is really gone as I don't know how to reproduce it (the problem was happening without any file manipulation).


Product Version: NetBeans IDE Dev (Build 201404160001)
Java: 1.8.0; Java HotSpot(TM) Client VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 23 Martin Entlicher 2014-04-22 08:20:45 UTC
Transplanted into release80 as changeset:   282891:44c611b58ded
http://hg.netbeans.org/releases/rev/44c611b58ded
http://hg.netbeans.org/releases/rev/e18d1bfc9514
Comment 24 Jiri Kovalsky 2014-04-23 11:40:45 UTC
*** Bug 243952 has been marked as a duplicate of this bug. ***
Comment 25 Quality Engineering 2014-04-24 02:12:05 UTC
Integrated into 'releases/release80', will be available in build *201404240045* or newer. Wait for official and publicly available build.

Changeset: http://hg.netbeans.org/releases/rev/44c611b58ded
User: mentlicher@netbeans.org
Log: #239549: Assure that BreakpointActionProvider is enabled on HTML files only.
(transplanted from 626c89e252e0c17ed65bd6a3f91d1c458bd85baa)
Comment 26 Jiri Kovalsky 2014-04-25 11:40:34 UTC
Works fine for me in:

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.8.0; Java HotSpot(TM) 64-Bit Server VM 25.0-b70
Runtime: Java(TM) SE Runtime Environment 1.8.0-b132
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb)
User directory: /home/cesilko/.netbeans/8.0
Cache directory: /home/cesilko/.cache/netbeans/8.0
Comment 27 Vladimir Riha 2014-04-25 11:44:17 UTC
Works for me as well, comment #11 no longer reproducible

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 28 AnnM 2014-04-26 20:38:05 UTC
Created attachment 146960 [details]
Failue to toggle png

This is called directly from a button click.
Comment 29 David Konecny 2014-05-21 23:02:52 UTC
Created attachment 147372 [details]
screenshot

I do not think this issue is fully resolved. Unfortunately I do not know how to reproduce it but frequently (I would say each second day) I bump into a problem (after few hours of work) as illustrated in the screenshot: the IDE editor shows breakpoints which do not exist anymore. And as you can see I've just added a new breakpoint to line 109 and editor indicates that there are two breakpoints.

To reproduce it I would explore scenario like this: set a breakpoint; do a debugging and hit it; continue debugging; restart IDE; debug it again; hit the breakpoint; try adding different breakpoint; etc.; remove all breakpoints via Breakpoints view; etc. At some point some breakpoints are not removed and I had to restard the IDE.
Comment 30 runiter 2014-09-22 14:46:38 UTC
I can also testify that this problem is not fixed with the latest Netbean version 8.0.1. The problem occurs in my javascript projects in Netbean. I cannot turn breakpoints off. When I click on a breakpoint to turn it off instead of going away its icon changes from a single red square to a double red square. I am not sure what the double red square suppose to mean.
Comment 31 markiewb 2014-09-22 15:09:58 UTC
(In reply to runiter from comment #30)
> I can also testify that this problem is not fixed with the latest Netbean
> version 8.0.1. The problem occurs in my javascript projects in Netbean. I
> cannot turn breakpoints off. When I click on a breakpoint to turn it off
> instead of going away its icon changes from a single red square to a double
> red square. I am not sure what the double red square suppose to mean.

@runiter@netbeans.org: Please create a new issue instead of reopening old issues.