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

Bug 349671

Summary: ProgressListener.completed() no more called
Product: [RT] RAP Reporter: Dominik G. <digga1404>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tbuschto
Version: 1.4   
Target Milestone: 1.5 M1   
Hardware: All   
OS: All   
Whiteboard: sr141
Attachments:
Description Flags
Proposed patch for 1.4 SR1 ivan: review?

Description Dominik G. CLA 2011-06-17 06:43:39 EDT
Build: RAP 1.4M7 - RAP 1.4RC4, v14_Maintenance
 
If I add a ProgressListener to a Browser widget the completed() event is no more called after I call setUrl().

Here is a snippet to reproduce:

public class ProgressListenerCompletedBug implements IEntryPoint {

    public int createUI() {
        Display display = new Display();
        Shell shell = new Shell(display, SWT.TITLE);
        createContent(shell);
        shell.layout();
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        return 0;
    }

    private void createContent(Shell shell) {
        shell.setLayout(new GridLayout(1, false));

        Browser browser= new Browser(shell, SWT.NONE);
		browser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
		
		browser.addProgressListener(new ProgressListener() {
			
			public void completed(ProgressEvent event) {
				System.out.println("ProgressListener.completed(): " + event); //$NON-NLS-1$
			}
			
			public void changed(ProgressEvent event) {
				System.out.println("ProgressListener.changed(): " + event); //$NON-NLS-1$
			}
			
		});
		
		browser.setUrl("http://www.google.de"); //$NON-NLS-1$
    }

}

Results:

RAP 1.4M6
ProgressListener.changed(): ProgressEvent{Browser {} data=null current=0 total=0}
ProgressListener.changed(): ProgressEvent{Browser {} data=null current=0 total=0}
ProgressListener.completed(): ProgressEvent{Browser {} data=null current=0 total=0}

RAP 1.4M7 - RAP 1.4RC4
ProgressListener.changed(): ProgressEvent{Browser {} data=null current=0 total=0}

Expected Result:
ProgressListener.completed() will be called again.
Comment 1 Ivan Furnadjiev CLA 2011-06-17 07:41:45 EDT
Reproducible with Controls Demo -> Browser Tab with CVS HEAD.
Comment 2 Ivan Furnadjiev CLA 2011-06-17 08:41:03 EDT
Created attachment 198175 [details]
Proposed patch for 1.4 SR1
Comment 3 Ivan Furnadjiev CLA 2011-06-17 08:42:25 EDT
Patch is applied to CVS HEAD. JS test added.
Comment 4 Ivan Furnadjiev CLA 2011-06-17 08:44:39 EDT
Just for the record - the issue was in Browser.js#_onload. The progress event was not fired if the url points to an "external" page.
Comment 5 Ivan Furnadjiev CLA 2011-07-26 04:01:34 EDT
Applied patch to v1.4_Maintenance branch.
Comment 6 Tim Buschtoens CLA 2011-08-25 08:45:57 EDT
Commited patch to v14_Tree_Table_Merge branch