Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 324144

Summary: A MarkerUpdater is required for JSDT debug
Product: [WebTools] JSDT Reporter: jdance
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact: Simon Kaegi <simon_kaegi>
Severity: normal    
Priority: P3 CC: Michael_Rennie, thatnitind
Version: 3.2   
Target Milestone: 3.3 M4   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 327019    
Attachments:
Description Flags
fix none

Description jdance CLA 2010-08-31 17:56:41 EDT
This is related to bug #313013.  That is a much higher priority bug.

Version: Helios Release
Build id: 20100617-1415
WTP: Version: 3.2.0.v201005290030-377A78s73533D5L355B

The main issue is that JSDT tries to restrict where breakpoints can be set.  This currently causes bug #313013, where breakpoints cannot be set at valid lines, but also causes the following issues:

1. Start with the following JavaScript.
---------------------
var state = 'hello';

function toggle()
{
	var helloElem = document.getElementById("hello");
	var hello_againElem = document.getElementById("hello_again");
	
	if(state == 'hello')
	{
		helloElem.style.display = 'none';
		hello_againElem.style.display = 'block';
		state='hello_again';
	}
	else
	{
		helloElem.style.display = 'block';
		hello_againElem.style.display = 'none';
		state='hello';
	}
}

2. Set a breakpoint anywhere in function
3. Change toggle to a function literal as shown below:
----------------------
var state = 'hello';

toggle = function()
{
	var helloElem = document.getElementById("hello");
	var hello_againElem = document.getElementById("hello_again");
	
	if(state == 'hello')
	{
		helloElem.style.display = 'none';
		hello_againElem.style.display = 'block';
		state='hello_again';
	}
	else
	{
		helloElem.style.display = 'block';
		hello_againElem.style.display = 'none';
		state='hello';
	}
};

4. The breakpoint can no longer be removed.

This scenario also happens when lines are shifted through editing the file, and the breakpoint ends up on an invalid line.
1. Switch code back to first version of function toggle().  
2. Set a breakpoint in function toggle() at line 8 (the if statement)
3. Go to the start of line 8, and add a newline
4. The breakpoint, now on blank line, cannot be removed.
Comment 1 Michael Rennie CLA 2010-09-02 15:08:09 EDT
(In reply to comment #0)

> 
> The main issue is that JSDT tries to restrict where breakpoints can be set. 

No, you just found a bug in our location verifier...

> This scenario also happens when lines are shifted through editing the file, and
> the breakpoint ends up on an invalid line.

This is another bug: for the fact that we do not a have a marker updater.

Changing the bug to reflect the need for a marker updater.
Comment 2 Michael Rennie CLA 2010-11-23 01:34:01 EST
Created attachment 183631 [details]
fix

The patch provides a marker updater for all markers that subclass the wst.jsdt.debug.marker type.

Also has a couple of performance fixes to leverage the shared AST from JSDT core instead of creating a new one to find breakpoint locations.
Comment 3 Michael Rennie CLA 2010-11-23 01:35:08 EST
applied to HEAD