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

Bug 346198

Summary: Browser loads URL twice after single setURL
Product: [RT] RAP Reporter: Wolfgang Pedot <wolfgang.pedot>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P1 CC: ivan
Version: 1.4Flags: rsternberg: review+
Target Milestone: 1.4 RC3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for org.eclipse.rap.example project
none
Proposed patch for 1.4 branch tbuschto: review+

Description Wolfgang Pedot CLA 2011-05-18 05:17:47 EDT
Build Identifier: 1.4.0.20110504-1831

We use a Browser to let the user display/download Reports, while performing some tests with the latest 1.4M7 Milestone I noticed that the Browser seems to load each File twice which may lead to two sepearte "Save-as" dialogs.

Cross-Tests confirmed that M6 does not show this behaviour and I also confirmed this outside of our application by inserting a Browser-Widget into the Workbench-Example and pointing it to an empty page with an "onLoad" javscript-alert.

My guess is that this is a side-effect of fixing bug 334350 and it may not happen in current CVS head due to bug 345082 but since I expect further changes in the browser towards RC1 this should be taken into account.

Reproducible: Always

Steps to Reproduce:
1. create a browser-widget
2. call setURL to point the browser to a simple page with an "alert('Hello')" as onLoad in the body
3. see 2 separate "Hello"-dialogs
Comment 1 Ivan Furnadjiev CLA 2011-05-18 05:27:33 EDT
Hi Wolfgang, I can't reproduce it with current CVS HEAD/v14_Maintenance branch. Could you test it with RC1?
Comment 2 Wolfgang Pedot CLA 2011-05-18 05:48:07 EDT
As written in the inital post I expected that because as I see it the solution to bug 345082 was to essentially fall back to the M6 browser which does not have this issue. But Chris also posted in bug 345082 that this fix might bring back bug 334350 and if it does I fear that the combined solution might bring back my bug from M7.

Since you seem to have the latest 1.4 Maintenance available can you test bug 334350? If that one did not reappear I would expect that there is now also a stable solution for this bug.

I will try to test against current CVS later this day.
Comment 3 Ivan Furnadjiev CLA 2011-05-18 05:55:37 EDT
Thanks. If it is still reproducible for you, please attach a snippet to the bug (maybe the order of setting the url matters).
Comment 4 Wolfgang Pedot CLA 2011-05-18 07:53:59 EDT
I have now tested this using org.eclipse.rap.rwt and q07 from the v14_Maintenance branch and the problem does not occur with this version.
I also tried setting the same URL twice and that does work correctly as well so appearantly bug 334350 was not resurrected by the fix for bug 345082.
Looks like my problem is solved in v14_Maintenance already.
Comment 5 Ivan Furnadjiev CLA 2011-05-18 08:37:48 EDT
(In reply to comment #4)
Closed as invalid.
Comment 6 Ivan Furnadjiev CLA 2011-05-24 08:10:09 EDT
Wolfgang, if you still experiencing the same problem please reopen this bug and attach a complete self-running project/snippet to reproduce the issue. Thanks.
Comment 7 Wolfgang Pedot CLA 2011-05-24 08:53:05 EDT
Created attachment 196433 [details]
Patch for org.eclipse.rap.example project

Patch against example-project
Comment 8 Wolfgang Pedot CLA 2011-05-24 09:03:28 EDT
After creating a new target for our application based on 1.4RC1 I noticed that the problem still persists. I have attached a patch against the org.eclipse.rap.examples project to show you my test-case.
With this source the html-page is loaded twice when the application is first opened (2x "Hello world" alert). If you then reload the application in your browser you will get the alert just once but then again after the first resize-event.

Also interesting is that the problem does not occur when I create a project without a workbench (just browser in a shell).

Please have a look.
Comment 9 Ivan Furnadjiev CLA 2011-05-24 10:44:59 EDT
Hi Wolfgang, with your explanation I can see where is the problem and I'm working on a fix.
Comment 10 Ivan Furnadjiev CLA 2011-05-24 11:18:31 EDT
The problem was in BrowserLCA#hasUrlChanged method. In case of not initialized browser the internal Browser urlChanged flag was not reset. Thus, on "next" request, the url was rendered again. Fixed in CVS HEAD.
Comment 11 Ivan Furnadjiev CLA 2011-05-25 05:37:42 EDT
Created attachment 196522 [details]
Proposed patch for 1.4 branch
Comment 12 Tim Buschtoens CLA 2011-05-25 05:43:26 EDT
Comment on attachment 196522 [details]
Proposed patch for 1.4 branch

Simple solution that guarentees that getAndResetUrlChanged is executed.
Comment 13 Ralf Sternberg CLA 2011-05-28 13:47:38 EDT
Applied second patch to 1.4 Maintenance branch in agreement with Ivan and Tim. Will be included in 1.4 RC3.