SF.net SVN: htmlunit: [3137] trunk/htmlunit/src

View: New views
1 Messages — Rating Filter:   Alert me  

SF.net SVN: htmlunit: [3137] trunk/htmlunit/src

by asashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Revision: 3137
          http://htmlunit.svn.sourceforge.net/htmlunit/?rev=3137&view=rev
Author:   asashour
Date:     2008-07-01 03:16:33 -0700 (Tue, 01 Jul 2008)

Log Message:
-----------
Fix exception when opening about:blank with Firefox (#2006861).

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java

Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2008-07-01 09:10:22 UTC (rev 3136)
+++ trunk/htmlunit/src/changes/changes.xml 2008-07-01 10:16:33 UTC (rev 3137)
@@ -7,6 +7,9 @@
 
     <body>
         <release version="2.2-SNAPSHOT" description="Bugfixes (handling of ill formed HTML code, document.write, ...), speed improvements, and move to HtmlUnit-core-js (Rhino fork)">
+            <action type="fix" dev="asashour" id="2006861">
+                Fix exception when opening about:blank with Firefox.
+            </action>
             <action type="add" dev="sdanig">
                 Add classes AttachmentHandler, CollectingAttachmentHandler and Attachment to handle attachments
                 outside of the normal page flow (disabled by default for backwards compatibility).

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2008-07-01 09:10:22 UTC (rev 3136)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2008-07-01 10:16:33 UTC (rev 3137)
@@ -920,7 +920,7 @@
         if (url != null) {
             try {
                 final WebRequestSettings settings = new WebRequestSettings(url);
-                if (!getBrowserVersion().isIE()) {
+                if (!getBrowserVersion().isIE() && openerPage != null) {
                     settings.addAdditionalHeader("Referer", openerPage.getWebResponse().getUrl().toExternalForm());
                 }
                 getPage(window, settings);

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java 2008-07-01 09:10:22 UTC (rev 3136)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java 2008-07-01 10:16:33 UTC (rev 3137)
@@ -1883,4 +1883,20 @@
 
         assertEquals("First", ((HtmlPage) webClient.getCurrentWindow().getEnclosedPage()).getTitleText());
     }
+
+    /**
+     * @throws Exception if an error occurs
+     */
+    @Test
+    public void testOpenWindowWithAboutBlank() throws Exception {
+        testOpenWindowWithAboutBlank(BrowserVersion.INTERNET_EXPLORER_6_0);
+        testOpenWindowWithAboutBlank(BrowserVersion.INTERNET_EXPLORER_7_0);
+        testOpenWindowWithAboutBlank(BrowserVersion.FIREFOX_2);
+    }
+
+    private void testOpenWindowWithAboutBlank(final BrowserVersion browserVersion) throws Exception {
+        final WebClient client1 = new WebClient(browserVersion);
+        final WebWindow window1 = client1.openWindow(WebClient.URL_ABOUT_BLANK, "TestingWindow");
+        Assert.assertNotNull(window1);
+    }
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
LightInTheBox - Buy quality products at wholesale price