Bug 298822 - [Browser] add bypass the cache parameter in setUrl() method in web browser component
Summary: [Browser] add bypass the cache parameter in setUrl() method in web browser co...
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui
Depends on:
Blocks:
 
Reported: 2010-01-05 03:57 EST by Krzysztof Kazmierczyk CLA
Modified: 2010-01-27 16:32 EST (History)
3 users (show)

See Also:
grant_gayed: review-


Attachments
Patch to 3.6 (2.35 KB, patch)
2010-01-14 05:25 EST, Krzysztof Kazmierczyk CLA
no flags Details | Diff
patch to 3.5 (2.07 KB, patch)
2010-01-14 08:56 EST, Krzysztof Kazmierczyk CLA
no flags Details | Diff
Corrected patch to 3.5 (2.23 KB, patch)
2010-01-18 02:29 EST, Krzysztof Kazmierczyk CLA
no flags Details | Diff
Patch to 3.6 (2.35 KB, patch)
2010-01-18 02:31 EST, Krzysztof Kazmierczyk CLA
no flags Details | Diff
patch to 3.4 (2.88 KB, patch)
2010-01-18 02:39 EST, Krzysztof Kazmierczyk CLA
kazm: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Kazmierczyk CLA 2010-01-05 03:57:49 EST
Build Identifier:  I20091201-1600

Internal web browser has sometimes problem with refresh its content when open new page. Moreover this problem disappears when you click "refresh" button. I have observed such situation when IE8 has been installed and did not happen for me on IE6 (tested on 2 computers). Moreover, on external web browser the problem does not appear even if it is set to IE8.

Reproducible: Always

Steps to Reproduce:
You must have IE8 installed.
1. Create new dynamic web project and add index.html file in WebContent directory.
2. Right click on index.html file. Select "Run as -> Run on Server". You should see html file in your internal browser.
3. Modify index.html content. Select "Run as -> Run on Server" again. You get old content of file.
Comment 1 Krzysztof Kazmierczyk CLA 2010-01-05 10:08:39 EST
The problem occurs when you want to open any page opened before e.g. if you open address A, then, in the same browser address B, and again A, you get finally old version of web page A.
Comment 2 Krzysztof Kazmierczyk CLA 2010-01-05 10:22:45 EST
I tried add 
if (browser.setUrl(url)) { browser.refresh(); return true; } 
at org.eclipse.ui.internal.browser.BrowserViewer:621 (refresh after setting url), 

but from unknown reasons, such workaround does not work.

It my be problem with method org.eclipse.swt.browser.IE.navigate(String url, String postData, String headers[], boolean silent) or anonymous listener at org.eclipse.swt.browser.IE:268. Unfortunately I am not OLE specialst :(
Comment 3 Krzysztof Kazmierczyk CLA 2010-01-07 04:28:01 EST
(In reply to comment #1)
> The problem occurs when you want to open any page opened before e.g. if you
> open address A, then, in the same browser address B, and again A, you get
> finally old version of web page A.

Generally the method of caching and display of internal browser is the same as IE (except refreshing when the address is the same), but in my opinion it is not right. Internal Web browser should always fetch content from server, not from cache.
Comment 4 Krzysztof Kazmierczyk CLA 2010-01-14 05:25:25 EST
Created attachment 156076 [details]
Patch to 3.6

This patch sets flag navNoReadFromCache in Navigate method if IE8
Comment 5 Krzysztof Kazmierczyk CLA 2010-01-14 08:56:41 EST
Created attachment 156096 [details]
patch to 3.5
Comment 6 Krzysztof Kazmierczyk CLA 2010-01-18 02:29:22 EST
Created attachment 156353 [details]
Corrected patch to 3.5
Comment 7 Krzysztof Kazmierczyk CLA 2010-01-18 02:31:16 EST
Created attachment 156354 [details]
Patch to 3.6
Comment 8 Krzysztof Kazmierczyk CLA 2010-01-18 02:39:04 EST
Created attachment 156356 [details]
patch to 3.4
Comment 9 Krzysztof Kazmierczyk CLA 2010-01-18 02:55:08 EST
Grant could you review theses patches?
Comment 10 Grant Gayed CLA 2010-01-18 12:47:06 EST
I see the behaviour you describe, even when embedding IE6.  However this is the correct behaviour.  It matches what the Browser does when embedding Mozilla and Safari, and also matches stand-alone IE, Mozilla and Safari.  The Browser's default setUrl() behaviour cannot be changed to ignore the cache, even though it would help in this case.  I think there are two possibilities:

1. The Browser could add API to expose this behaviour (eg.- a boolean "bypassCache" on setUrl()) if support for this exists in all native browsers.  There's a similar but reversed request of this in bug 295458.  [It's strange that the MSDN doc at http://msdn.microsoft.com/en-us/library/aa768360(VS.85).aspx for navNoReadFromCache just says "Not implemented".]

2. Your attempt to refresh() after setting the url in comment 2 probably didn't work because the browser is asynchronous.  The following should work:

    browser.addProgressListener(new ProgressAdapter() {
        public void completed(ProgressEvent event) {
            browser.removeProgressListener(this);
            browser.refresh(); // <----
        }
    });
    browser.setUrl("http://...");

Taking ownership of report in case there are further discussions about this issue.  Otherwise it will be closed as WONTFIX.
Comment 11 Krzysztof Kazmierczyk CLA 2010-01-20 07:25:42 EST
It has been opened bug to the second possibility: https://bugs.eclipse.org/bugs/show_bug.cgi?id=300174
Comment 12 Grant Gayed CLA 2010-01-27 16:32:59 EST
Since there is a path for accomplishing this with the existing setUrl() API that takes header arguments (detailed in bug 300174), I don't think new Browser API will be added to specifically handle this case.  Closing as WONTFIX.