Bug 464873 - SWT Browser location listener not catching internal redirections
Summary: SWT Browser location listener not catching internal redirections
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.5   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2015-04-17 06:44 EDT by abhinav anand CLA
Modified: 2020-02-12 08:02 EST (History)
3 users (show)

See Also:


Attachments
TestSnippet --- WORKS_FOR_ME on IE10_Win7 (1.98 KB, application/octet-stream)
2015-05-06 09:21 EDT, Niraj Modi CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description abhinav anand CLA 2015-04-17 06:44:40 EDT
I have a url which internally redirects me to another localhost server,
which is nothing but a dummy server that is not running.I just have to intercept the redirect  url,  but the location listener does not catch this redirection.It just says that the page cannot be loaded.
Comment 1 Arun Thondapu CLA 2015-04-17 08:05:04 EDT
Can you please upload a small snippet of code which demonstrates the problem?
Comment 2 abhinav anand CLA 2015-04-17 09:09:36 EDT
Here it is:
Browser browser = new Browser(browserShell, SWT.Resize);
browserShell.setSize(580, 550);
browser.setSize(browserShell.getSize());
GridDataFactory.fillDefaults().grab(true, true).applyTo(browserShell);
GridDataFactory.fillDefaults().grab(true, true).applyTo(browser);
browser.setUrl("url");
browser.addLocationListener(new LocationListener() {
@Override
public void changing(LocationEvent event) {
// TODO Auto-generated method stub
System.out.println(event.location);
					
}

@Override
public void changed(LocationEvent event) {
// TODO Auto-generated method stub
System.out.println(event.location);
if (event.location.startsWith("http://localhost")) {
}}});

The url here is a server which redirects to another url.This redirect url comes as a part of the response header.
Comment 3 abhinav anand CLA 2015-04-24 12:43:13 EDT
Hey,
Any progress on the issue?
Comment 4 abhinav anand CLA 2015-04-30 05:25:20 EDT
Hi Guys,
This is really creating problems for me,hence raising the prio.
Comment 5 Niraj Modi CLA 2015-05-06 09:21:03 EDT
Created attachment 253225 [details]
TestSnippet --- WORKS_FOR_ME on IE10_Win7

This scenario works for me on Windows7 on IE10, tried opening www.google.com which in India internally redirects to www.google.co.in

Test results with my Snippet, on console:
changed...about:blank
changing...http://www.google.com/
changing...http://www.google.co.in/?gfe_rd=cr&ei=fxNKVdPdDNCCuASgsoCwAQ
changing...https://www.google.co.in/?gfe_rd=cr&ei=fxNKVdPdDNCCuASgsoCwAQ&gws_rd=ssl
changed...https://www.google.co.in/?gfe_rd=cr&ei=fxNKVdPdDNCCuASgsoCwAQ&gws_rd=ssl
changed...https://www.google.co.in/?gfe_rd=cr&ei=fxNKVdPdDNCCuASgsoCwAQ&gws_rd=ssl
changed...https://www.google.co.in/?gfe_rd=cr&ei=fxNKVdPdDNCCuASgsoCwAQ&gws_rd=ssl

If the attached test snippet fails for your, please revert with your Browser version and any specific information to reproduce this issue at our end ? Thanks.
Comment 6 abhinav anand CLA 2015-05-16 01:44:38 EDT
Hi,
I recently found out that the if the internal redirection is to a url which is of a server that is not up and running , of course the page cannot be loaded but the event for this url is not fired. For any server that is running the event is generated.
For example: if google redirects to a localhost server which is not running , the event wont be generated ,however if redirection is to google.co.in, it will work.

But i think the correct behaviour should be to generate events for both since there was an attempt to load a new url irrespective of whether the server is running.
JAVAFX works this way. It generates events for both. 
Hence i think this should be fixed.


Regards,
Abhinav.
Comment 7 Mathias Arens CLA 2020-02-12 08:02:30 EST
I totally agree. I have the same issue.

(In reply to abhinav anand from comment #6)
> Hi,
> I recently found out that the if the internal redirection is to a url which
> is of a server that is not up and running , of course the page cannot be
> loaded but the event for this url is not fired. For any server that is
> running the event is generated.
> For example: if google redirects to a localhost server which is not running
> , the event wont be generated ,however if redirection is to google.co.in, it
> will work.
> 
> But i think the correct behaviour should be to generate events for both
> since there was an attempt to load a new url irrespective of whether the
> server is running.
> JAVAFX works this way. It generates events for both. 
> Hence i think this should be fixed.
> 
> 
> Regards,
> Abhinav.