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

Bug 327481

Summary: JavaScriptThread should only suspend if the event thread matches its underlying thread
Product: [WebTools] JSDT Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact: Simon Kaegi <simon_kaegi>
Severity: normal    
Priority: P3 CC: browe, johnjbarton, thatnitind
Version: unspecified   
Target Milestone: 3.3 M3   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 314755    
Attachments:
Description Flags
fix none

Description Michael Rennie CLA 2010-10-11 14:53:10 EDT
Created attachment 180614 [details]
fix

code from HEAD

The fix to bug 314755 now has JavaScriptThreads listening to SuspendEvents, which is a good thing. The bad part is that they listen to all SuspendEvents and do no check if the event thread is the same as the underlying thread.

Steps:

1. check out the Crossfire dev client
2. connect to firefox
3. open N tabs
4. suspend Firebug in the browser

Expected:

The matching thread in the Eclipse client would also suspend

Happens:

all threads suspend and the matching thread in the Eclipse client gets its stack frames.

As the fix for 314755 went into 3.2.3 this fix should go in as well. The fix is a simple equals check.
Comment 1 Simon Kaegi CLA 2010-10-11 21:23:41 EDT
I haven't looked at the code yet and will tomorrow but my two initial thoughts were:
1) Should this be handled at a higher level. e.g. why is the thread even receiving this event if it doesn't target the thread. 
2) Do we need to do anything special for a global suspend event.
Comment 2 Michael Rennie CLA 2010-10-12 10:29:54 EDT
(In reply to comment #1)
> I haven't looked at the code yet and will tomorrow but my two initial thoughts
> were:
> 1) Should this be handled at a higher level. e.g. why is the thread even
> receiving this event if it doesn't target the thread. 

We could quite easily handle this case in the event queue, which would require each implementor of the event queue to have such a fix. This fix though is trivial and catches the case that a contributor does not do this check in their event queue.

> 2) Do we need to do anything special for a global suspend event.

Not sure what you mean by the "global suspend" are you referring to the 'suspend for all script loads'?
Comment 3 Michael Rennie CLA 2010-10-14 14:43:12 EDT
I applied the patch to HEAD.

If we want it in any other stream we can clone this bug for those versions.