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

Bug 370976

Summary: Browser#execute never returns if widget is never displayed
Product: [RT] RAP Reporter: Graham Mising name <eclipse>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: ivan
Version: unspecified   
Target Milestone: 1.5 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch to break out of loop
none
Corrected patch
none
Another solution none

Description Graham Mising name CLA 2012-02-08 11:41:16 EST
Build Identifier: CVS HEAD

Browser#execute can be run before a widget is displayed and will continue the display's readAndDispatch until it receives a result.  If the widget is disposed, no result will ever be received and this function never returns.

Reproducible: Always

Steps to Reproduce:
1. Create a Browser widget.
2. Call execute such as browser.execute("window.scrollTo(0, document.body.scrollHeight)");
3. Dispose the widget before it is displayed
4. Note that the execute never returns.
Comment 1 Graham Mising name CLA 2012-02-08 11:46:24 EST
Created attachment 210741 [details]
Patch to break out of loop
Comment 2 Graham Mising name CLA 2012-02-08 11:47:21 EST
I posted a patch which seems to work in breaking out of the loop.  Another possibility to to call SWT.error(SWT.ERROR_WIDGET_DISPOSED) instead of returning false.
Comment 3 Graham Mising name CLA 2012-02-08 12:13:18 EST
Created attachment 210744 [details]
Corrected patch

In creating the previous patch, the isDisposed check was put in the wrong place.
Comment 4 Ivan Furnadjiev CLA 2012-02-09 04:11:02 EST
Created attachment 210782 [details]
Another solution

In this patch a disposed listener is added to the browser that cleans its internal state ( set executeResult to false ). Graham, could you give this patch a try?
Comment 5 Graham Mising name CLA 2012-02-09 10:14:06 EST
Ivan's patch also resolves the issue.
Comment 6 Ivan Furnadjiev CLA 2012-02-09 10:43:21 EST
Applied second patch to CVS HEAD. JUnit test added.