Closed
Bug 267442
Opened 20 years ago
Closed 20 years ago
Popup window handle is not returned when the page is redirected
Categories
(Rhino Graveyard :: Core, defect)
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: sandor.irlanda, Assigned: igor)
Details
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) Opera 7.53 [en] Build Identifier: JWebUnit 1.2, HttpUnit 1.6 When using popup windows from JavaScript I do net get back the window handle correctly if the opened page is redirected immediately. The error does not reside in JWebUnit nor in HttpUnit as you could see from the following test case: 1. I created a servlet that manages 3 states. The default comes up with a button that has an onClick event defined to open a new window. The second is called by the onClick event and gets redirected to the third. 2. The test clicks on the button, and tries to access the opened page. And checks if it managed to. 3. When the popup window's URL is redirected the window will not be available. But if it is not redirected it is available. RedirectServlet.java: package de.wwwag.tpg.redirect; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * Created by IntelliJ IDEA. * User: tyufi * Date: Oct 6, 2004 * Time: 9:04:33 AM * To change this template use File | Settings | File Templates. */ public class RedirectServlet extends HttpServlet { private static final String REDIR_PARAM = "param"; protected void doGet( HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse ) throws ServletException, IOException { String redir = httpServletRequest.getParameter( REDIR_PARAM ); if ( redir != null && redir.length() > 0 ) { if ( redir.equalsIgnoreCase( "noredir")) { httpServletResponse.setContentType( "text/html" ); PrintWriter writer = httpServletResponse.getWriter(); writer.write( "<html>\n"); writer.write( "<head>\n"); writer.write( "<title>lovas</title>\n"); writer.write( "</head>\n"); writer.write( "<body>\n"); writer.write( "Traram!\n" ); writer.write( "</body>\n"); writer.write( "</html>\n"); writer.close(); } else { httpServletResponse.sendRedirect( "redir?param=noredir" ); } } else { httpServletResponse.setContentType( "text/html" ); PrintWriter writer = httpServletResponse.getWriter(); writer.write( "<html>\n"); writer.write( "<head>\n"); writer.write( "<title>lovas</title>\n"); writer.write( "</head>\n"); writer.write( "<body>\n"); writer.write( "<form>\n"); writer.write( "<button id='lovas' onClick='x = window.open( \"redir? param=redir\", \"bambi\", \"width=200,height=200,resizable=1,scrollbars=1, status=0,left=100,top=100\" );alert(x.name);'\n" ); writer.write( "</form>\n"); writer.write( "</body>\n"); writer.write( "</html>\n"); writer.close(); } } } web.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3// EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>RedirectTest</display-name> <description>Unit test of popup/redirect exception</description> <servlet> <servlet-name>redirect</servlet-name> <servlet-class>de.wwwag.tpg.redirect.RedirectServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>redirect</servlet-name> <url-pattern>/redir</url-pattern> </servlet-mapping> </web-app> RedirectServletTest.java: package de.wwwag.tpg.redirect.test; import net.sourceforge.jwebunit.WebTestCase; /** * Created by IntelliJ IDEA. * User: tyufi * Date: 2004.11.03. * Time: 9:52:57 * To change this template use File | Settings | File Templates. */ public class RedirectServletTest extends WebTestCase { private static final String BASE_URL = "http://localhost:8080/tpg_download/"; public RedirectServletTest( String s ) { super( s ); } public void setUp() { getTestContext().setBaseUrl( BASE_URL ); } public void testRedir() { beginAt( "redir" ); assertTrue( getDialog().getWebClient().getClientProperties().isAutoRedirect() ); getDialog().getWebClient().getClientProperties().setAutoRefresh( true ); clickButton( "lovas" ); assertEquals( "bambi", getDialog().getWebClient().popNextAlert() ); assertEquals( 2, getDialog().getWebClient().getOpenWindows().length ); gotoWindow( "bambi" ); assertTextPresent( "Traram!" ); } } Reproducible: Always Steps to Reproduce: 1. JavaScript eventhandler opens new window 2. The given URL gets redirected Actual Results: The window handle is invalid Expected Results: Return the window handle
Assignee | ||
Comment 1•20 years ago
|
||
This is not a Rhino bug which is just a JS engine implementing ECMScript standard in Java. Please select properly product/component properly when filing bugs..
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•