You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
(30) |
Sep
(15) |
Oct
(26) |
Nov
(12) |
Dec
(17) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(7) |
Feb
(27) |
Mar
(73) |
Apr
(17) |
May
(17) |
Jun
(78) |
Jul
(67) |
Aug
(60) |
Sep
(89) |
Oct
(140) |
Nov
(173) |
Dec
(46) |
2004 |
Jan
(39) |
Feb
(7) |
Mar
(21) |
Apr
(31) |
May
(13) |
Jun
(86) |
Jul
(14) |
Aug
(14) |
Sep
(53) |
Oct
(184) |
Nov
(186) |
Dec
(319) |
2005 |
Jan
(336) |
Feb
(274) |
Mar
(226) |
Apr
(102) |
May
(196) |
Jun
(130) |
Jul
(119) |
Aug
(143) |
Sep
(76) |
Oct
(85) |
Nov
(70) |
Dec
(159) |
2006 |
Jan
(125) |
Feb
(100) |
Mar
(80) |
Apr
(39) |
May
(55) |
Jun
(58) |
Jul
(50) |
Aug
(76) |
Sep
(55) |
Oct
(101) |
Nov
(163) |
Dec
(85) |
2007 |
Jan
(56) |
Feb
(53) |
Mar
(180) |
Apr
(221) |
May
(290) |
Jun
(199) |
Jul
(322) |
Aug
(515) |
Sep
(121) |
Oct
(297) |
Nov
(177) |
Dec
(103) |
2008 |
Jan
(516) |
Feb
(315) |
Mar
(586) |
Apr
(615) |
May
(197) |
Jun
(381) |
Jul
(390) |
Aug
(195) |
Sep
(603) |
Oct
(499) |
Nov
(622) |
Dec
(350) |
2009 |
Jan
(313) |
Feb
(338) |
Mar
(507) |
Apr
(317) |
May
(197) |
Jun
(375) |
Jul
(235) |
Aug
(424) |
Sep
(410) |
Oct
(338) |
Nov
(286) |
Dec
(306) |
2010 |
Jan
(367) |
Feb
(339) |
Mar
(371) |
Apr
(172) |
May
(233) |
Jun
(264) |
Jul
(421) |
Aug
(110) |
Sep
(218) |
Oct
(189) |
Nov
(185) |
Dec
(168) |
2011 |
Jan
(145) |
Feb
(213) |
Mar
(205) |
Apr
(64) |
May
(159) |
Jun
(67) |
Jul
(104) |
Aug
(126) |
Sep
(144) |
Oct
(106) |
Nov
(154) |
Dec
(225) |
2012 |
Jan
(111) |
Feb
(87) |
Mar
(131) |
Apr
(102) |
May
(180) |
Jun
(160) |
Jul
(412) |
Aug
(315) |
Sep
(311) |
Oct
(369) |
Nov
(464) |
Dec
(284) |
2013 |
Jan
(343) |
Feb
(165) |
Mar
(174) |
Apr
(120) |
May
(153) |
Jun
(134) |
Jul
(202) |
Aug
(105) |
Sep
(228) |
Oct
(332) |
Nov
(192) |
Dec
(219) |
2014 |
Jan
(348) |
Feb
(194) |
Mar
(189) |
Apr
(188) |
May
(297) |
Jun
(206) |
Jul
(79) |
Aug
(279) |
Sep
(111) |
Oct
(159) |
Nov
(61) |
Dec
(78) |
2015 |
Jan
(152) |
Feb
(145) |
Mar
(239) |
Apr
(223) |
May
(248) |
Jun
(296) |
Jul
(172) |
Aug
(189) |
Sep
(338) |
Oct
(217) |
Nov
(131) |
Dec
(184) |
2016 |
Jan
(118) |
Feb
(221) |
Mar
(414) |
Apr
(412) |
May
(303) |
Jun
(133) |
Jul
(129) |
Aug
(121) |
Sep
(136) |
Oct
(67) |
Nov
(89) |
Dec
(245) |
2017 |
Jan
(349) |
Feb
(90) |
Mar
(328) |
Apr
(430) |
May
(284) |
Jun
(199) |
Jul
(164) |
Aug
(120) |
Sep
(57) |
Oct
(105) |
Nov
(108) |
Dec
(146) |
2018 |
Jan
(85) |
Feb
(48) |
Mar
(97) |
Apr
(62) |
May
(64) |
Jun
(136) |
Jul
(123) |
Aug
(87) |
Sep
(17) |
Oct
(27) |
Nov
(9) |
Dec
(16) |
2019 |
Jan
(9) |
Feb
(17) |
Mar
(18) |
Apr
(14) |
May
(8) |
Jun
|
Jul
(6) |
Aug
(12) |
Sep
(5) |
Oct
|
Nov
(2) |
Dec
|
2020 |
Jan
(8) |
Feb
|
Mar
(6) |
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
(4) |
Oct
(1) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2023 |
Jan
|
Feb
(6) |
Mar
(9) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <no...@us...> - 2003-09-10 14:21:47
|
Log Message: ----------- Fixed bug where HtmlPage.asText() would blow up if form tags were found between tr and td tags. Clearly this is illegal html but the browsers support it so HtmlUnit needs to as well. Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html: TableElementCreatorTest.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html: HtmlTableRow.java Revision Data ------------- Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.127 retrieving revision 1.128 diff -u -d -r1.127 -r1.128 --- changes.xml 10 Sep 2003 12:19:50 -0000 1.127 +++ changes.xml 10 Sep 2003 14:21:43 -0000 1.128 @@ -6,7 +6,7 @@ </properties> <body> - <release version="1.3" date="not released yet"> + <release version="Next" date="not released yet"> <action type="update" dev="mbowler" id="713646"> Patch for bug in onload handler submitted by Andreas Hangler </action> @@ -26,6 +26,11 @@ </action> <action type="update" dev="mbowler" id="803237" due-to="Brad Clarke"> Upgraded junit.jar to 3.8.1 + </action> + <action type="update" dev="mbowler" id="802285"> + Fixed bug where HtmlPage.asText() would blow up if form tags were + found between tr and td tags. Clearly this is illegal html but + the browsers support it so HtmlUnit needs to as well. </action> </release> Index: TableElementCreatorTest.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/TableElementCreatorTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- TableElementCreatorTest.java 9 Sep 2003 20:16:13 -0000 1.1 +++ TableElementCreatorTest.java 10 Sep 2003 14:21:44 -0000 1.2 @@ -67,10 +67,6 @@ * @exception Exception If the test fails */ public void testGetTableCell() throws Exception { - if(true) { - notImplemented(); - return; - } final String htmlContent = "<html><head><title>test</title></head>" + "<body><table>" @@ -87,6 +83,6 @@ SubmitMethod.POST, Collections.EMPTY_LIST ); // Calling asText() will invoke the element creator which in turn will blow up - System.out.println(page.asXml()); + page.asText(); } } Index: HtmlTableRow.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlTableRow.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- HtmlTableRow.java 10 Jun 2003 11:56:58 -0000 1.5 +++ HtmlTableRow.java 10 Sep 2003 14:21:44 -0000 1.6 @@ -88,10 +88,23 @@ if( tableCells_ != null ) { return tableCells_; } - + + tableCells_ = Collections.unmodifiableList(getCells( getElement() )); + return tableCells_; + } + /** + * Return a List containing all the HtmlTableCell objects in this row + * @param parent The parent element + * @return See above + */ + private List getCells( final Element parent ) { + if( tableCells_ != null ) { + return tableCells_; + } + final List list = new ArrayList(); - final NodeList nodeList = getElement().getChildNodes(); + final NodeList nodeList = parent.getChildNodes(); final int nodeCount = nodeList.getLength(); final HtmlPage page = getPage(); @@ -110,11 +123,17 @@ else if( tagName.equals( "th" ) ) { list.add( new HtmlTableHeaderCell( page, element, rowIndex, columnIndex++ ) ); } + else if( tagName.equals( "form" ) ) { + // Completely illegal html but some of the big sites (ie amazon) do this + list.addAll( getCells(element) ); + } + else { + getLog().debug("Illegal html: found <"+tagName+"> under a <tr> tag"); + } } } - tableCells_ = Collections.unmodifiableList( list ); - return tableCells_; + return list; } |
From: SourceForge.net <no...@so...> - 2003-09-10 12:24:25
|
Support Requests item #769348, was opened at 2003-07-10 18:10 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448267&aid=769348&group_id=47038 Category: Install Problem (example) Group: None >Status: Closed Resolution: None Priority: 5 Submitted By: Randall Dietz (rdietz) >Assigned to: Mike Bowler (mbowler) Summary: SimpleLog does not implement Log? Initial Comment: G'day, I'm running HtmlUnit (1.2.2) and Junit (3.8.1) with Java V1.3.1, trying to run a very simple test from the examples when I get the following error: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Class org.apache.commons.logging.impl.SimpleLog does not implement Log at org.apache.commons.logging.impl.LogFactoryImpl.newIns tance(LogFactoryImpl.java:555) etc... I'm using all the jar files from the HtmlUnit lib download. Is this a known problem or am I just lucky? ;^) cheers ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-10 08:24 Message: Logged In: YES user_id=46756 It's been a month and a half without a reply so I'm closing this one. If this is still a problem then please open a new bug or ask about it on one of the mailing lists. ---------------------------------------------------------------------- Comment By: Mike Bowler (mbowler) Date: 2003-07-21 08:02 Message: Logged In: YES user_id=46756 Are you still experiencing this problem? Was it a classpath issue? ---------------------------------------------------------------------- Comment By: Simon Kahl (skahl) Date: 2003-07-13 22:18 Message: Logged In: YES user_id=793481 I have experience this when using JUnit swing GUI with 'Reload classes every Run' switched on. Turn this off (or start GUI with '-noloading' option) and the problem should go away. ---------------------------------------------------------------------- Comment By: Mike Bowler (mbowler) Date: 2003-07-11 06:42 Message: Logged In: YES user_id=46756 You're just lucky ;) I'd guess that this is a classpath problem. Make sure that you don't have an older version of commons-logging in your classpath. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448267&aid=769348&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-10 12:20:03
|
Feature Requests item #803237, was opened at 2003-09-09 11:39 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803237&group_id=47038 Category: None Group: None >Status: Closed Priority: 5 Submitted By: Brad Clarke (yourgod) >Assigned to: Mike Bowler (mbowler) Summary: Upgrade build/lib/junit.jar to junit 3.8.1 Initial Comment: please :) ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-10 08:20 Message: Logged In: YES user_id=46756 Done ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803237&group_id=47038 |
From: <no...@us...> - 2003-09-10 12:19:53
|
Log Message: ----------- Upgraded junit.jar to 3.8.1 Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml /cvsroot/htmlunit/htmlunit/build/lib: junit.jar Revision Data ------------- Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.126 retrieving revision 1.127 diff -u -d -r1.126 -r1.127 --- changes.xml 9 Sep 2003 20:47:57 -0000 1.126 +++ changes.xml 10 Sep 2003 12:19:50 -0000 1.127 @@ -16,13 +16,16 @@ <action type="update" dev="mbowler" id="797144"> Added support for window frames - patch from Jun Chen </action> - <action type="update" dev="mbowler" id="803233 " due-to="Brad Clarke"> + <action type="update" dev="mbowler" id="803233" due-to="Brad Clarke"> an update of the version number in build.xml and outputting of a src jar for the current build Patch submitted by Brad Clarke </action> - <action type="update" dev="mbowler" id="803229 " due-to="Brad Clarke"> + <action type="update" dev="mbowler" id="803229" due-to="Brad Clarke"> Added HtmlFileInput support. Patch submitted by Brad Clarke + </action> + <action type="update" dev="mbowler" id="803237" due-to="Brad Clarke"> + Upgraded junit.jar to 3.8.1 </action> </release> Index: junit.jar =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/build/lib/junit.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 Binary files /tmp/cvsK5easS and /tmp/cvsIdc2Vz differ |
From: SourceForge.net <no...@so...> - 2003-09-09 20:51:30
|
Feature Requests item #625328, was opened at 2002-10-18 13:28 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=625328&group_id=47038 Category: None Group: None >Status: Closed Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: Add HtmlFileInput support Initial Comment: Need HtmlFileInput to simulate file upload. ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-09 16:51 Message: Logged In: YES user_id=46756 Done. ---------------------------------------------------------------------- Comment By: Brad Clarke (yourgod) Date: 2003-08-11 16:46 Message: Logged In: YES user_id=257129 Just ran into a need for this one myself and I'm looking at how to implement it. Any suggestions? ---------------------------------------------------------------------- Comment By: Thomas Bartz (phos4) Date: 2003-07-15 09:10 Message: Logged In: YES user_id=746059 Is there still any chance to see this in one of the next releases? Would be very great! ---------------------------------------------------------------------- Comment By: Mike Bowler (mbowler) Date: 2002-10-29 13:29 Message: Logged In: YES user_id=46756 I'm going to defer this to 1.2 as I'm close to wrapping up 1.1 and this feature will require quite a bit of work. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=625328&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-09 20:50:57
|
Feature Requests item #803229, was opened at 2003-09-09 11:33 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803229&group_id=47038 Category: None Group: None >Status: Closed Priority: 5 Submitted By: Brad Clarke (yourgod) >Assigned to: Mike Bowler (mbowler) Summary: FIX: 625328 - Add HtmlFileInput support Initial Comment: Patch to enable support for HtmlFileInput's in HtmlUnit ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-09 16:50 Message: Logged In: YES user_id=46756 Patch applied - thanks. I don't like accepting code that doesn't have associated tests but there isn't anything in place for testing code that needs to connect to a server so I can't complain too much ;-) A proper approach for testing this kind of code needs to be figured out fairly soon. Please change your editor settings to not use tabs. I've removed all the tabs from this patch but it's a pain to do. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803229&group_id=47038 |
From: <no...@us...> - 2003-09-09 20:48:02
|
Log Message: ----------- Added support for file upload - patch provided by Brad Clarke Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit: FakeWebConnection.java /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html: HtmlForm.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit: WebConnection.java HttpWebConnection.java WebClient.java Added Files: ----------- /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit: KeyDataPair.java FormEncodingType.java Revision Data ------------- Index: FakeWebConnection.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/FakeWebConnection.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- FakeWebConnection.java 3 Sep 2003 15:55:23 -0000 1.6 +++ FakeWebConnection.java 9 Sep 2003 20:47:56 -0000 1.7 @@ -110,11 +110,29 @@ super( webClient ); } + /** + * Submit a request to the processor + * + * @param url The url of the server + * @param method The submit method. Ie SubmitMethod.GET + * @param parameters Any parameters + * @param requestParameters Any headers that need to be put into the request. + * @return See above + */ + public WebResponse getResponse( + final URL url, + final SubmitMethod method, + final List parameters, + final Map requestParameters ) { + + return this.getResponse(url, FormEncodingType.URL_ENCODED, method, parameters, requestParameters); + } /** * Submit a request and retrieve a response * * @param url The url of the server + * @param encType form encoding type to use for POST method * @param method The submit method. Ie SubmitMethod.GET * @param parameters Any parameters * @param requestHeaders Any headers that need to be put into the request. @@ -122,6 +140,7 @@ */ public WebResponse getResponse( final URL url, + final FormEncodingType encType, final SubmitMethod method, final List parameters, final Map requestHeaders ) { Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.125 retrieving revision 1.126 diff -u -d -r1.125 -r1.126 --- changes.xml 9 Sep 2003 20:22:05 -0000 1.125 +++ changes.xml 9 Sep 2003 20:47:57 -0000 1.126 @@ -21,6 +21,9 @@ a src jar for the current build Patch submitted by Brad Clarke </action> + <action type="update" dev="mbowler" id="803229 " due-to="Brad Clarke"> + Added HtmlFileInput support. Patch submitted by Brad Clarke + </action> </release> Index: HtmlForm.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/html/HtmlForm.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- HtmlForm.java 11 Aug 2003 15:24:57 -0000 1.22 +++ HtmlForm.java 9 Sep 2003 20:47:57 -0000 1.23 @@ -37,6 +37,7 @@ */ package com.gargoylesoftware.htmlunit.html; +import com.gargoylesoftware.htmlunit.FormEncodingType; import com.gargoylesoftware.htmlunit.Assert; import com.gargoylesoftware.htmlunit.ElementNotFoundException; import com.gargoylesoftware.htmlunit.KeyValuePair; @@ -163,10 +164,10 @@ catch( final MalformedURLException e ) { throw new IllegalArgumentException( "Not a valid url: " + action ); } - + final FormEncodingType encType = FormEncodingType.getInstance( this.getEnctypeAttribute() ); final SubmitMethod method = SubmitMethod.getInstance( getAttributeValue( "method" ) ); final WebWindow webWindow = htmlPage.getEnclosingWindow(); - return htmlPage.getWebClient().getPage( webWindow, url, method, parameterList ); + return htmlPage.getWebClient().getPage( webWindow, url, encType, method, parameterList ); } --- NEW FILE: KeyDataPair.java --- /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit; /** * A holder for key/data pairs. * * @version $Revision: 1.1 $ * @author Brad Clarke */ public class KeyDataPair extends KeyValuePair { private final Object dataObject_; /** * Create an instance. * * @param key The key. * @param value The value. */ public KeyDataPair( final String key, final String value) { super(key, value); dataObject_ = value; } /** * Create an instance * * @param key The key. * @param data The value */ public KeyDataPair(String key, Object data) { super(key, data.toString()); dataObject_ = data; } /** @return The data object */ public Object getData() { return dataObject_; } } --- NEW FILE: FormEncodingType.java --- /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.MultipartPostMethod; /** * A collection of constants that represent the various ways a form can be * encoded when submitted * * @version $Revision: 1.1 $ * @author Brad Clarke */ public class FormEncodingType { /** * URL_ENCODED */ public static final FormEncodingType URL_ENCODED = new FormEncodingType(PostMethod.FORM_URL_ENCODED_CONTENT_TYPE); /** * MULTIPART */ public static final FormEncodingType MULTIPART = new FormEncodingType(MultipartPostMethod.MULTIPART_FORM_CONTENT_TYPE); private final String name_; private FormEncodingType(final String name) { name_ = name; } /** * Return the name of this EncodingType * * @return See above */ public String getName() { return name_; } /** * Return the constant that matches the given name * * @param name The name to search by * @return See above */ public static FormEncodingType getInstance(final String name) { final String lowerCaseName = name.toLowerCase(); final FormEncodingType allInstances[] = new FormEncodingType[] { URL_ENCODED, MULTIPART }; int i; for (i = 0; i < allInstances.length; i++) { if (allInstances[i].getName().equals(lowerCaseName)) { return allInstances[i]; } } // Special case: empty string defaults to url encoded if (name.equals("")) { return URL_ENCODED; } throw new IllegalArgumentException("No encoding type found for [" + name + "]"); } /** * Return a string representation of this object * * @return See above */ public String toString() { return "EncodingType[name=" + getName() + "]"; } } Index: WebConnection.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/WebConnection.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- WebConnection.java 16 Jul 2003 20:11:21 -0000 1.7 +++ WebConnection.java 9 Sep 2003 20:47:57 -0000 1.8 @@ -103,6 +103,25 @@ throws IOException; + /** + * Submit a request and retrieve a response + * + * @param parameters Any parameters + * @param url The url of the server + * @param encType Encoding type of the form when done as a POST + * @param submitMethod The submit method. Ie SubmitMethod.GET + * @param requestHeaders Any headers that need to be put into the request. + * @return See above + * @exception IOException If an IO error occurs + */ + public abstract WebResponse getResponse( + final URL url, + final FormEncodingType encType, + final SubmitMethod submitMethod, + final List parameters, + final Map requestHeaders ) + throws + IOException; /** * Return the web client Index: HttpWebConnection.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/HttpWebConnection.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- HttpWebConnection.java 19 Jul 2003 17:17:30 -0000 1.13 +++ HttpWebConnection.java 9 Sep 2003 20:47:57 -0000 1.14 @@ -37,6 +37,7 @@ */ package com.gargoylesoftware.htmlunit; +import java.io.File; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -58,6 +59,7 @@ import org.apache.commons.httpclient.URI; import org.apache.commons.httpclient.URIException; import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.MultipartPostMethod; import org.apache.commons.httpclient.methods.GetMethod; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.logging.Log; @@ -98,12 +100,32 @@ super(webClient, proxyHost, proxyPort); } + /** + * Submit a request and retrieve a response + * + * @param parameters Any parameters + * @param url The url of the server + * @param submitMethod The submit method. Ie SubmitMethod.GET + * @param requestHeaders Any headers that need to be put in the request. + * @return See above + * @exception IOException If an IO error occurs + */ + public WebResponse getResponse( + final URL url, + final SubmitMethod submitMethod, + final List parameters, + final Map requestHeaders ) + throws + IOException { + return this.getResponse(url, FormEncodingType.URL_ENCODED, submitMethod, parameters, requestHeaders); + } /** * Submit a request and retrieve a response * * @param parameters Any parameters * @param url The url of the server + * @param encType Encoding type of the form when done as a POST * @param submitMethod The submit method. Ie SubmitMethod.GET * @param requestHeaders Any headers that need to be put in the request. * @return See above @@ -111,6 +133,7 @@ */ public WebResponse getResponse( final URL url, + final FormEncodingType encType, final SubmitMethod submitMethod, final List parameters, final Map requestHeaders ) @@ -122,14 +145,14 @@ try { long startTime, endTime; - HttpMethod httpMethod = makeHttpMethod( url, submitMethod, parameters, requestHeaders ); + HttpMethod httpMethod = makeHttpMethod( url, encType, submitMethod, parameters, requestHeaders ); startTime = System.currentTimeMillis(); int responseCode = httpClient.executeMethod( httpMethod ); endTime = System.currentTimeMillis(); if( responseCode == 401 ) { // Authentication required final KeyValuePair pair = getCredentials( httpMethod, url ); if( pair != null ) { - httpMethod = makeHttpMethod( url, submitMethod, parameters, requestHeaders ); + httpMethod = makeHttpMethod( url, encType, submitMethod, parameters, requestHeaders ); addCredentialsToHttpMethod( httpMethod, pair ); startTime = System.currentTimeMillis(); responseCode = httpClient.executeMethod( httpMethod ); @@ -200,6 +223,7 @@ private HttpMethod makeHttpMethod( final URL url, + final FormEncodingType encType, final SubmitMethod method, final List parameters, final Map requestHeaders ) @@ -224,7 +248,12 @@ } } else if( method == SubmitMethod.POST ) { - httpMethod = new PostMethod( path ); + if (encType == FormEncodingType.URL_ENCODED) { + httpMethod = new PostMethod( path ); + } + else { + httpMethod = new MultipartPostMethod(path); + } final String queryString = url.getQuery(); if( queryString != null ) { httpMethod.setQueryString(queryString); @@ -234,15 +263,35 @@ // Note that this has to be done in two loops otherwise it won't // be able to support two elements with the same name. iterator = parameters.iterator(); - while( iterator.hasNext() ) { - final NameValuePair pair = ( NameValuePair )iterator.next(); - ( ( PostMethod )httpMethod ).removeParameter( pair.getName(), pair.getValue() ); - } - - iterator = parameters.iterator(); - while( iterator.hasNext() ) { - final NameValuePair pair = ( NameValuePair )iterator.next(); - ( ( PostMethod )httpMethod ).addParameter( pair.getName(), pair.getValue() ); + if (encType == FormEncodingType.URL_ENCODED) { + while( iterator.hasNext() ) { + final NameValuePair pair = ( NameValuePair )iterator.next(); + ( ( PostMethod )httpMethod ).removeParameter( pair.getName(), pair.getValue() ); + } + + iterator = parameters.iterator(); + while( iterator.hasNext() ) { + final NameValuePair pair = ( NameValuePair )iterator.next(); + ( ( PostMethod )httpMethod ).addParameter( pair.getName(), pair.getValue() ); + } + } + else { + iterator = parameters.iterator(); + while (iterator.hasNext()) { + final KeyValuePair pair = (KeyValuePair) iterator.next(); + if (pair instanceof KeyDataPair) { + File f = (File) ((KeyDataPair)pair).getData(); + if (f.exists()){ + ((MultipartPostMethod) httpMethod).addParameter(pair.getName(), f); + } + else { + ((MultipartPostMethod) httpMethod).addParameter(pair.getName(), pair.getValue()); + } + } + else { + ((MultipartPostMethod) httpMethod).addParameter(pair.getName(), pair.getValue()); + } + } } } else { Index: WebClient.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/WebClient.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- WebClient.java 3 Sep 2003 19:15:57 -0000 1.46 +++ WebClient.java 9 Sep 2003 20:47:57 -0000 1.47 @@ -319,9 +319,68 @@ FailingHttpStatusCodeException { return getPage(webWindow, url, method, parameters, getThrowExceptionOnFailingStatusCode()); } - + /** + * Return a page. + * + * @param webWindow The window that the new page will be loaded into. + * @param url The url of the server + * @param encType Encoding type of the form when done as a POST + * @param method The submit method. Ie Submit.GET or SubmitMethod.POST + * @param parameters A list of {@link + * com.gargoylesoftware.htmlunit.KeyValuePair KeyValuePair}'s that + * contain the parameters to send to the server + * @return The page that was loaded. + * @exception IOException If an IO error occurs + * @exception FailingHttpStatusCodeException If the server returns a + * failing status code AND the property + * "throwExceptionOnFailingStatusCode" is set to true (see {@link + * #setThrowExceptionOnFailingStatusCode(boolean)}) + */ + public Page getPage( + final WebWindow webWindow, + final URL url, + final FormEncodingType encType, + final SubmitMethod method, + final List parameters ) + throws + IOException, + FailingHttpStatusCodeException { + return getPage(webWindow, url, encType, method, parameters, getThrowExceptionOnFailingStatusCode()); + } /** + * Return a page. + * + * @param webWindow The window that the new page will be loaded into. + * @param url The url of the server + * @param method The submit method. Ie Submit.GET or SubmitMethod.POST + * @param parameters A list of {@link + * com.gargoylesoftware.htmlunit.KeyValuePair KeyValuePair}'s that + * contain the parameters to send to the server + * @param throwExceptionOnFailingStatusCode true if this method should throw + * an exception whenever a failing status code is received. + * @return The page that was loaded. + * @exception IOException If an IO error occurs + * @exception FailingHttpStatusCodeException If the server returns a + * failing status code AND the variable + * "throwExceptionOnFailingStatusCode" is set to true + */ + public Page getPage( + final WebWindow webWindow, + final URL url, + final SubmitMethod method, + final List parameters, + final boolean throwExceptionOnFailingStatusCode ) + throws + IOException, + FailingHttpStatusCodeException { + + return this.getPage( + webWindow, url, FormEncodingType.URL_ENCODED, method, + parameters, throwExceptionOnFailingStatusCode); + } + + /** * Send a request to a server and return a Page that represents the * response from the server. This page will be used to populate this frame.<p> * @@ -352,6 +411,7 @@ * * @param webWindow The window that the new page will be loaded into. * @param url The url of the server + * @param encType Encoding type of the form when done as a POST * @param method The submit method. Ie Submit.GET or SubmitMethod.POST * @param parameters A list of {@link * com.gargoylesoftware.htmlunit.KeyValuePair KeyValuePair}'s that @@ -367,6 +427,7 @@ public Page getPage( final WebWindow webWindow, final URL url, + final FormEncodingType encType, final SubmitMethod method, final List parameters, final boolean throwExceptionOnFailingStatusCode ) @@ -383,7 +444,7 @@ webResponse = makeWebResponseForAboutUrl(webWindow,url); } else { - webResponse = loadWebResponse( url, method, parameters ); + webResponse = loadWebResponse( url, encType, method, parameters ); } final String contentType = webResponse.getContentType(); final int statusCode = webResponse.getStatusCode(); @@ -1006,7 +1067,6 @@ }; } - /** * Load a {@link WebResponse} from the server * @param url The url to load the response from. @@ -1019,12 +1079,29 @@ final URL url, final SubmitMethod method, final List parameters) throws IOException { + return this.loadWebResponse(url, FormEncodingType.URL_ENCODED, method, parameters); + } + + /** + * Load a {@link WebResponse} from the server + * @param url The url to load the response from. + * @param encType Encoding type of the form when done as a POST + * @param method The {@link SubmitMethod} to use + * @param parameters Any parameters that are being passed into the request + * @throws IOException if an IO problem occurs + * @return The WebResponse + */ + public final WebResponse loadWebResponse( + final URL url, final FormEncodingType encType, final SubmitMethod method, final List parameters) + throws + IOException { Assert.notNull("url", url); Assert.notNull("method", method); Assert.notNull("parameters", parameters); - final WebResponse webResponse = getWebConnection().getResponse( url, method, parameters, requestHeaders_ ); + final WebResponse webResponse + = getWebConnection().getResponse( url, encType, method, parameters, requestHeaders_ ); final int statusCode = webResponse.getStatusCode(); if( statusCode >= 301 && statusCode <=307 && isRedirectEnabled() ) { |
From: SourceForge.net <no...@so...> - 2003-09-09 20:22:25
|
Feature Requests item #803233, was opened at 2003-09-09 11:35 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803233&group_id=47038 Category: None Group: None >Status: Closed Priority: 5 Submitted By: Brad Clarke (yourgod) >Assigned to: Mike Bowler (mbowler) Summary: PATCH: Upgrade build.xml Initial Comment: This patch includes an update of the version number in build.xml and outputting of a src jar for the current build ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-09 16:22 Message: Logged In: YES user_id=46756 Patch applied - thanks ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803233&group_id=47038 |
From: <no...@us...> - 2003-09-09 20:22:08
|
Log Message: ----------- an update of the version number in build.xml and outputting of a src jar for the current build Patch submitted by Brad Clarke Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml /cvsroot/htmlunit/htmlunit: build.xml Revision Data ------------- Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.124 retrieving revision 1.125 diff -u -d -r1.124 -r1.125 --- changes.xml 3 Sep 2003 19:41:29 -0000 1.124 +++ changes.xml 9 Sep 2003 20:22:05 -0000 1.125 @@ -10,11 +10,16 @@ <action type="update" dev="mbowler" id="713646"> Patch for bug in onload handler submitted by Andreas Hangler </action> - <action type="update" dev="mbowler" id="797144 "> + <action type="update" dev="mbowler" id="797144"> Added support for the about: protocol - patch from Jun Chen </action> - <action type="update" dev="mbowler" id="797144 "> + <action type="update" dev="mbowler" id="797144"> Added support for window frames - patch from Jun Chen + </action> + <action type="update" dev="mbowler" id="803233 " due-to="Brad Clarke"> + an update of the version number in build.xml and outputting of + a src jar for the current build + Patch submitted by Brad Clarke </action> </release> Index: build.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/build.xml,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- build.xml 16 Jun 2003 21:01:05 -0000 1.41 +++ build.xml 9 Sep 2003 20:22:05 -0000 1.42 @@ -14,7 +14,7 @@ <!--<property name="build.compiler" value="jikes" />--> <property name="build.compiler.pedantic" value="true"/> -<property name="version" value="HtmlUnit-1.2.2" /> +<property name="version" value="HtmlUnit-1.2.3" /> <property environment="env"/> <property name="local-repository" value ="target/repository"/> @@ -165,6 +165,11 @@ excludes="**/test/*,**/*.java,build.xml,lib,**/package.html" manifest="build/${version}/META-INF/MANIFEST.MF"/> <delete file="build/${version}/META-INF/MANIFEST.MF"/> + + <jar + jarfile="build/${version}/lib/HtmlUnit-src.jar" + basedir="src/java" + includes="**/*.java"/> <javadoc sourcepath="src/java" |
From: <no...@us...> - 2003-09-09 20:16:15
|
Log Message: ----------- Added test for bug 802285 but left it disabled until the fix can be put in Added Files: ----------- /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html: TableElementCreatorTest.java Revision Data ------------- --- NEW FILE: TableElementCreatorTest.java --- /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit.html; import com.gargoylesoftware.htmlunit.FakeWebConnection; import com.gargoylesoftware.htmlunit.SubmitMethod; import com.gargoylesoftware.htmlunit.WebClient; import com.gargoylesoftware.htmlunit.WebTestCase; import java.net.URL; import java.util.Collections; /** * Tests for TableElementCreator * * @version $Revision: 1.1 $ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> */ public class TableElementCreatorTest extends WebTestCase { /** * Create an instance * * @param name The name of the test */ public TableElementCreatorTest( final String name ) { super( name ); } /** * Regression test for asText() which would blow up inside the TableElementCreator * * @exception Exception If the test fails */ public void testGetTableCell() throws Exception { if(true) { notImplemented(); return; } final String htmlContent = "<html><head><title>test</title></head>" + "<body><table>" + "<tr><form><td>a</td></form></tr>" + "</table></body></html>"; final WebClient client = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( client ); webConnection.setContent( htmlContent ); client.setWebConnection( webConnection ); final HtmlPage page = ( HtmlPage )client.getPage( new URL( "http://first" ), SubmitMethod.POST, Collections.EMPTY_LIST ); // Calling asText() will invoke the element creator which in turn will blow up System.out.println(page.asXml()); } } |
From: SourceForge.net <no...@so...> - 2003-09-09 20:13:30
|
Bugs item #802285, was opened at 2003-09-08 02:56 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=802285&group_id=47038 Category: None Group: None Status: Open >Resolution: Accepted Priority: 5 Submitted By: Andrei Kirshin (akirshin1) >Assigned to: Mike Bowler (mbowler) Summary: Exception calling HtmlPage.asText() Initial Comment: Exception calling HtmlPage.asText(): java.lang.IllegalStateException: specified cell could not be found in table See attached page source. ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-09 16:13 Message: Logged In: YES user_id=46756 This is blowing up because there is a <form> tag between a <tr> and a <td> tag. This is clearly illegal html but since the browsers support it, HtmlUnit should as well. It isn't clear whether this is something that should be handled by NekoHTML before HtmlUnit gets it or if HtmlUnit should just handle it itself. I've sent an email to the author of NekoHTML explaining this bug and we'll figure out where the fix should go. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=802285&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-09 15:39:15
|
Feature Requests item #803237, was opened at 2003-09-09 10:39 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803237&group_id=47038 Category: None Group: None Status: Open Priority: 5 Submitted By: Brad Clarke (yourgod) Assigned to: Nobody/Anonymous (nobody) Summary: Upgrade build/lib/junit.jar to junit 3.8.1 Initial Comment: please :) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803237&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-09 15:35:35
|
Feature Requests item #803233, was opened at 2003-09-09 10:35 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803233&group_id=47038 Category: None Group: None Status: Open Priority: 5 Submitted By: Brad Clarke (yourgod) Assigned to: Nobody/Anonymous (nobody) Summary: PATCH: Upgrade build.xml Initial Comment: This patch includes an update of the version number in build.xml and outputting of a src jar for the current build ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803233&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-09 15:33:02
|
Feature Requests item #803229, was opened at 2003-09-09 10:33 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803229&group_id=47038 Category: None Group: None Status: Open Priority: 5 Submitted By: Brad Clarke (yourgod) Assigned to: Nobody/Anonymous (nobody) Summary: FIX: 625328 - Add HtmlFileInput support Initial Comment: Patch to enable support for HtmlFileInput's in HtmlUnit ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448269&aid=803229&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-08 20:11:06
|
Bugs item #802480, was opened at 2003-09-08 08:50 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=802480&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Ryan Lubke (rlubke) Assigned to: Nobody/Anonymous (nobody) Summary: Calling document.forms[0].elementName.name fails Initial Comment: Using version 1.2.3 (or CVS HEAD), javascript evaluation fails when accessing forms via index. Example: a page that renders an image map with multiple 'live' areas. Here is an example of the AREA element: <area alt="NAmerica" coords=<SOME COORDS>" shape="poly" onmouseout="document.forms[0].mapImage.src='/images/world.gif'" onmouseover="document.forms[0].mapImage.src='/images/world_namer.gif'" onclick="document.forms[0].worldMap_current.value='NAmerica'; document.forms[0].submit()"> Using the source of the onClick as the argument to executeJavascriptIfPossible will yield: EcmaError: lineNumber=[1] column=[0] lineSource=[document.forms[0].elements['worldMap_current'].value='NAmerica'; document.forms[0].submit()] name=[ConversionError] sourceName=[)] message=[The undefined value has no properties.] errorObject=[ConversionError: The undefined value has no properties.] If the form is access via name instead of the index, then javascript evaluation works as expected. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=802480&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-08 06:56:15
|
Bugs item #802285, was opened at 2003-09-08 06:56 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=802285&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrei Kirshin (akirshin1) Assigned to: Nobody/Anonymous (nobody) Summary: Exception calling HtmlPage.asText() Initial Comment: Exception calling HtmlPage.asText(): java.lang.IllegalStateException: specified cell could not be found in table See attached page source. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=802285&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-05 10:33:25
|
Bugs item #800993, was opened at 2003-09-05 10:33 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=800993&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Giles Jermy (gjermy) Assigned to: Nobody/Anonymous (nobody) Summary: Navigator.javaEnabled should be method not property Initial Comment: javaEnabled is a method of the Navigator object, not a property as currently implemented. line 95 of com/gargoylesoftware/htmlunitjavascript/host/Navigator.j ava needs to change from jsGet_javaEnabled() { to jsFunction_javaEnabled() { Without this change, a piece of javascript including a line such as if (navigator.javaEnabled()) { } produces a throw with "false is not a function" in the text. I cant get logged into CVS so haven't been able to build or run the unit tests (build.xml is not present in the release) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=800993&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-04 06:38:29
|
Bugs item #799752, was opened at 2003-09-03 12:13 Message generated for change (Comment added) made by akirshin1 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=799752&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrei Kirshin (akirshin1) Assigned to: Nobody/Anonymous (nobody) Summary: Exception: The undefined value has no properties Initial Comment: I use HtmlUnit 1.2.3 I get the error message "The undefined value has no properties." parsing the JavaScript in the following HTML page: <html> <head> <script language='JavaScript'> //<!-- function buggy(){ var option1 = document.f1.elements['select'][0]; option1.value = 'XXX'; // This line causes the exception option1.selected = true; // This line also causes the exception } //--> </script> </head> <body onload='buggy();'> <form name='f1' action='xxx.html'> <SELECT name='select'> <OPTION value='A'>111</OPTION> <OPTION value='B'>222</OPTION> </SELECT> </form> </body> </html> Following is the stack trace: org.mozilla.javascript.EvaluatorException: The undefined value has no properties. at com.gargoylesoftware.htmlunit.javascript.StrictErrorRepor ter.runtimeError(StrictErrorReporter.java:114) at org.mozilla.javascript.Context.reportRuntimeError (Context.java:591) at org.mozilla.javascript.Context.reportRuntimeError (Context.java:630) at org.mozilla.javascript.Context.reportRuntimeError0 (Context.java:600) at org.mozilla.javascript.Undefined.reportError (Undefined.java:138) at org.mozilla.javascript.Undefined.getPrototype (Undefined.java:100) at org.mozilla.javascript.ScriptableObject.getBase (ScriptableObject.java:1585) at org.mozilla.javascript.ScriptableObject.putProperty (ScriptableObject.java:1473) at org.mozilla.javascript.ScriptRuntime.setProp (ScriptRuntime.java:842) at org.mozilla.javascript.gen.c1.call(Embedded script:2) at org.mozilla.javascript.optimizer.OptRuntime.callSimple (OptRuntime.java:275) at org.mozilla.javascript.gen.c4.call (body.onLoad:1) at org.mozilla.javascript.gen.c4.exec (body.onLoad) at org.mozilla.javascript.Context.evaluateReader (Context.java:820) at org.mozilla.javascript.Context.evaluateString (Context.java:784) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngin e.execute(JavaScriptEngine.java:242) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJav aScriptIfPossible(HtmlPage.java:889) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeBod yOnLoadHandlerIfNeeded(HtmlPage.java:1096) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize (HtmlPage.java:173) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:356) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:276) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:220) at ScriptTest.loadPage(ScriptTest.java:45) at ScriptTest.main(ScriptTest.java:31) ---------------------------------------------------------------------- >Comment By: Andrei Kirshin (akirshin1) Date: 2003-09-04 06:38 Message: Logged In: YES user_id=858153 I guess that indexed properties for a select is not implemented. document.f1.elements['select'][0] returns undefined. document.f1.elements['select'].item(0) also returns undefined. ---------------------------------------------------------------------- Comment By: Andrei Kirshin (akirshin1) Date: 2003-09-04 06:37 Message: Logged In: YES user_id=858153 I guess that indexed properties for a select is not implemented. document.f1.elements['select'][0] returns undefined. document.f1.elements['select'].item(0) also returns undefined. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=799752&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-04 06:38:00
|
Bugs item #799752, was opened at 2003-09-03 12:13 Message generated for change (Comment added) made by akirshin1 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=799752&group_id=47038 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrei Kirshin (akirshin1) Assigned to: Nobody/Anonymous (nobody) Summary: Exception: The undefined value has no properties Initial Comment: I use HtmlUnit 1.2.3 I get the error message "The undefined value has no properties." parsing the JavaScript in the following HTML page: <html> <head> <script language='JavaScript'> //<!-- function buggy(){ var option1 = document.f1.elements['select'][0]; option1.value = 'XXX'; // This line causes the exception option1.selected = true; // This line also causes the exception } //--> </script> </head> <body onload='buggy();'> <form name='f1' action='xxx.html'> <SELECT name='select'> <OPTION value='A'>111</OPTION> <OPTION value='B'>222</OPTION> </SELECT> </form> </body> </html> Following is the stack trace: org.mozilla.javascript.EvaluatorException: The undefined value has no properties. at com.gargoylesoftware.htmlunit.javascript.StrictErrorRepor ter.runtimeError(StrictErrorReporter.java:114) at org.mozilla.javascript.Context.reportRuntimeError (Context.java:591) at org.mozilla.javascript.Context.reportRuntimeError (Context.java:630) at org.mozilla.javascript.Context.reportRuntimeError0 (Context.java:600) at org.mozilla.javascript.Undefined.reportError (Undefined.java:138) at org.mozilla.javascript.Undefined.getPrototype (Undefined.java:100) at org.mozilla.javascript.ScriptableObject.getBase (ScriptableObject.java:1585) at org.mozilla.javascript.ScriptableObject.putProperty (ScriptableObject.java:1473) at org.mozilla.javascript.ScriptRuntime.setProp (ScriptRuntime.java:842) at org.mozilla.javascript.gen.c1.call(Embedded script:2) at org.mozilla.javascript.optimizer.OptRuntime.callSimple (OptRuntime.java:275) at org.mozilla.javascript.gen.c4.call (body.onLoad:1) at org.mozilla.javascript.gen.c4.exec (body.onLoad) at org.mozilla.javascript.Context.evaluateReader (Context.java:820) at org.mozilla.javascript.Context.evaluateString (Context.java:784) at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngin e.execute(JavaScriptEngine.java:242) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJav aScriptIfPossible(HtmlPage.java:889) at com.gargoylesoftware.htmlunit.html.HtmlPage.executeBod yOnLoadHandlerIfNeeded(HtmlPage.java:1096) at com.gargoylesoftware.htmlunit.html.HtmlPage.initialize (HtmlPage.java:173) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:356) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:276) at com.gargoylesoftware.htmlunit.WebClient.getPage (WebClient.java:220) at ScriptTest.loadPage(ScriptTest.java:45) at ScriptTest.main(ScriptTest.java:31) ---------------------------------------------------------------------- >Comment By: Andrei Kirshin (akirshin1) Date: 2003-09-04 06:37 Message: Logged In: YES user_id=858153 I guess that indexed properties for a select is not implemented. document.f1.elements['select'][0] returns undefined. document.f1.elements['select'].item(0) also returns undefined. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448266&aid=799752&group_id=47038 |
From: SourceForge.net <no...@so...> - 2003-09-04 00:44:30
|
Patches item #797144, was opened at 2003-08-29 08:06 Message generated for change (Comment added) made by chen_jun You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448268&aid=797144&group_id=47038 Category: None Group: None Status: Closed Resolution: Accepted Priority: 5 Submitted By: Jun Chen (chen_jun) Assigned to: Mike Bowler (mbowler) Summary: about:blank,window.frames["name"] patch & small fix Initial Comment: This patch has done: 1. "about:" URL and "about:blank" javascript handling. 2. window.frames["name"] implementation 3. Multiple cookies submit bug fix. To exchange multiple cookies with some "strict" server like mail.yahoo.com, our HttpClient has to be in strict mode to merge multiple cookie header into one cookie header. 4. WebClient(BrowserVersion, httpProxy,httpPort) misses setting BrowserVersion. 5. document.open() place holder ---------------------------------------------------------------------- >Comment By: Jun Chen (chen_jun) Date: 2003-09-04 00:44 Message: Logged In: YES user_id=850655 About Item 3, I'd like to explain more. When I use htmlunit to get http://mail.yahoo.com, it's ok. One cookie is set by server side. Then I set the login name and password and submit again. This time, server give me another 2 cookies, and redirect me to another page to verify my login. Now the problem appears, htmlunit just send these 3 cookies in 3 cookie hearders . But the yahoo server can only accept one cookie header. And I found httpclient can be set to strict mode, so that httpclient will merge multiple cookies into one cookie header when submitting to server. That's why I think to use httpclient's strict mode is better for htmlunit. BTW, if you use http proxy to access mail.yahoo.com, you may not find this problem, because some proxy can merge multiple cookie headers into one. Sorry for my patch stuffed several features. Next time, I'll keep the rule one patch one feature. My previous wrong idea is that very small patch will annoy you and htmlunit users :) ---------------------------------------------------------------------- Comment By: Mike Bowler (mbowler) Date: 2003-09-03 19:45 Message: Logged In: YES user_id=46756 Part of this patch has been accepted and part has not. I have accepted and commited #1, #2, #4 and #5 - thanks #3 has not been accepted as I don't understand what it's supposed to fix. It claims to fix a problem connecting to mail.yahoo.com but the current code doesn't have a problem connecting to that server. I am closing this item because it covers so many different things and most of them have been addressed. In future, please don't put as many different things into one patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448268&aid=797144&group_id=47038 |
From: <no...@us...> - 2003-09-03 19:48:29
|
Log Message: ----------- Added some javadoc Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host: WindowTest.java Revision Data ------------- Index: WindowTest.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- WindowTest.java 3 Sep 2003 19:15:56 -0000 1.6 +++ WindowTest.java 3 Sep 2003 19:47:58 -0000 1.7 @@ -64,11 +64,18 @@ * @author <a href="mailto:che...@us...">Chen Jun</a> */ public class WindowTest extends WebTestCase { + /** + * Create an instance + * @param name The name of the test + */ public WindowTest( final String name ) { super(name); } + /** + * @throws Exception If the test fails + */ public void testSetLocation() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -102,6 +109,9 @@ } + /** + * @throws Exception If the test fails + */ public void testOpenWindow() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -234,6 +244,9 @@ } + /** + * @throws Exception If the test fails + */ public void testParentAndTop() throws Exception { final String firstContent @@ -285,6 +298,9 @@ } + /** + * @throws Exception If the test fails + */ public void testConfirm() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -316,6 +332,9 @@ } + /** + * @throws Exception If the test fails + */ public void testConfirm_noConfirmHandler() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -341,6 +360,9 @@ } + /** + * @throws Exception If the test fails + */ public void testPrompt() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -372,6 +394,9 @@ } + /** + * @throws Exception If the test fails + */ public void testPrompt_noPromptHandler() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -397,6 +422,9 @@ } + /** + * @throws Exception If the test fails + */ public void testOpener() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -449,6 +477,9 @@ } + /** + * @throws Exception If the test fails + */ public void testSetTimeout() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = new FakeWebConnection( webClient ); @@ -480,6 +511,9 @@ } + /** + * @throws Exception If the test fails + */ public void testAboutURL() throws Exception { final WebClient webClient = new WebClient(); final FakeWebConnection webConnection = |
From: SourceForge.net <no...@so...> - 2003-09-03 19:45:32
|
Patches item #797144, was opened at 2003-08-29 04:06 Message generated for change (Comment added) made by mbowler You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448268&aid=797144&group_id=47038 Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Jun Chen (chen_jun) >Assigned to: Mike Bowler (mbowler) Summary: about:blank,window.frames["name"] patch & small fix Initial Comment: This patch has done: 1. "about:" URL and "about:blank" javascript handling. 2. window.frames["name"] implementation 3. Multiple cookies submit bug fix. To exchange multiple cookies with some "strict" server like mail.yahoo.com, our HttpClient has to be in strict mode to merge multiple cookie header into one cookie header. 4. WebClient(BrowserVersion, httpProxy,httpPort) misses setting BrowserVersion. 5. document.open() place holder ---------------------------------------------------------------------- >Comment By: Mike Bowler (mbowler) Date: 2003-09-03 15:45 Message: Logged In: YES user_id=46756 Part of this patch has been accepted and part has not. I have accepted and commited #1, #2, #4 and #5 - thanks #3 has not been accepted as I don't understand what it's supposed to fix. It claims to fix a problem connecting to mail.yahoo.com but the current code doesn't have a problem connecting to that server. I am closing this item because it covers so many different things and most of them have been addressed. In future, please don't put as many different things into one patch. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=448268&aid=797144&group_id=47038 |
From: <no...@us...> - 2003-09-03 19:41:32
|
Log Message: ----------- Added support for window frames - patch from Jun Chen Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/host: Window.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript: JavaScriptEngine.java Added Files: ----------- /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript: WindowFramesArray.java Revision Data ------------- Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.123 retrieving revision 1.124 diff -u -d -r1.123 -r1.124 --- changes.xml 3 Sep 2003 19:15:56 -0000 1.123 +++ changes.xml 3 Sep 2003 19:41:29 -0000 1.124 @@ -13,7 +13,9 @@ <action type="update" dev="mbowler" id="797144 "> Added support for the about: protocol - patch from Jun Chen </action> - + <action type="update" dev="mbowler" id="797144 "> + Added support for window frames - patch from Jun Chen + </action> </release> Index: Window.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Window.java 3 Sep 2003 15:55:23 -0000 1.23 +++ Window.java 3 Sep 2003 19:41:29 -0000 1.24 @@ -48,13 +48,15 @@ import com.gargoylesoftware.htmlunit.html.HtmlInlineFrame; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.javascript.SimpleScriptable; +import com.gargoylesoftware.htmlunit.javascript.WindowFramesArray; + import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.util.Collections; -import java.util.List; + import org.mozilla.javascript.Context; import org.mozilla.javascript.Function; import org.mozilla.javascript.Scriptable; @@ -64,6 +66,7 @@ * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> + * @author <a href="mailto:che...@us...">Chen Jun</a> */ public final class Window extends SimpleScriptable { @@ -73,7 +76,7 @@ private Screen screen_; private History history_; private Location location_; - + private WindowFramesArray windowFramesArray_; /** * Create an instance. The rhino engine requires all host objects * to have a default constructor. @@ -352,6 +355,9 @@ location_ = (Location)makeJavaScriptObject("Location"); location_.initialize(this); + + windowFramesArray_ =(WindowFramesArray)makeJavaScriptObject("WindowFramesArray"); + windowFramesArray_.initialize(htmlPage); } @@ -408,27 +414,12 @@ /** - * Return the value of the frames property. Currently not implemented + * Return the value of the frames property. * @return The value of window.frames */ - public SimpleScriptable[] jsGet_frames() { - final Page page = webWindow_.getEnclosedPage(); - if( page == null || page instanceof HtmlPage == false ) { - return new SimpleScriptable[0]; - } - - final HtmlPage htmlPage = (HtmlPage)page; - final List frames = htmlPage.getFrames(); - final int frameCount = frames.size(); - final SimpleScriptable[] jsFrames = new SimpleScriptable[frameCount]; - - for( int i=0; i<frameCount; i++ ) { - jsFrames[i] = (SimpleScriptable)((WebWindow)frames.get(i)).getScriptObject(); - } - - return jsFrames; + public WindowFramesArray jsGet_frames() { + return windowFramesArray_; } - /** * Return the WebWindow associated with this Window --- NEW FILE: WindowFramesArray.java --- /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit.javascript; import java.util.List; import org.mozilla.javascript.Scriptable; import com.gargoylesoftware.htmlunit.Assert; import com.gargoylesoftware.htmlunit.WebWindow; import com.gargoylesoftware.htmlunit.html.HtmlPage; /** * An array returned by frames property of Window * * @author <a href="mailto:che...@us...>Chen Jun</a> * @version 1.0, 2003-8-23 */ public class WindowFramesArray extends SimpleScriptable { private HtmlPage htmlPage_; /** * Create an instance. Javascript objects must have a default constructor. */ public WindowFramesArray() { } /** * <p>Return the object at the specified index.</p> * * <p>TODO: This implementation is particularly inefficient but without a way * to detect if an element has been inserted or removed, it isn't safe to * cache the array/<p> * * @param index The index * @param start The object that get is being called on. * @return The object or NOT_FOUND */ public Object get(final int index, final Scriptable start) { final HtmlPage htmlPage = ((WindowFramesArray) start).htmlPage_; if (htmlPage == null) { return super.get(index, start); } final List frames = htmlPage.getFrames(); if( frames == null ) { return NOT_FOUND; } final int frameCount = frames.size(); if (index < 0 || index >= frameCount) { return NOT_FOUND; } return ((WebWindow) frames.get(index)).getScriptObject(); } /** * Return the frame at the specified name or NOT_FOUND. * * @param name The name. * @param start The object that get is being called on. * @return The object or NOT_FOUND */ public Object get(final String name, final Scriptable start) { final HtmlPage htmlPage = ((WindowFramesArray) start).htmlPage_; if (htmlPage == null) { return super.get(name, start); } final List frames = htmlPage.getFrames(); if (frames == null) { return NOT_FOUND; } final int frameCount = frames.size(); for (int i = 0; i < frameCount; i++) { if (((WebWindow) frames.get(i)).getName().equals(name)) { return ((WebWindow) frames.get(i)).getScriptObject(); } } return NOT_FOUND; } /** * Initialize this object * @param page The HtmlPage that this object will retrive elements from. */ public void initialize(final HtmlPage page) { Assert.notNull("page", page); htmlPage_ = page; } /** * Javascript constructor. This must be declared in every javascript file because * the rhino engine won't walk up the hierarchy looking for constructors. */ public final void jsConstructor() { } /** * <p>Return the number of elements in this array</p> * * @return The number of elements in the array */ public int jsGet_length() { Assert.notNull("htmlpage", htmlPage_); return htmlPage_.getFrames().size(); } } Index: JavaScriptEngine.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- JavaScriptEngine.java 3 Sep 2003 15:55:24 -0000 1.19 +++ JavaScriptEngine.java 3 Sep 2003 19:41:29 -0000 1.20 @@ -58,6 +58,7 @@ * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> + * @author <a href="mailto:che...@us...">Chen Jun</a> */ public final class JavaScriptEngine extends ScriptEngine { /** Information specific to the javascript engine */ @@ -150,6 +151,7 @@ ScriptableObject.defineClass(parentScope, DocumentAllArray.class); ScriptableObject.defineClass(parentScope, FormElementsArray.class); + ScriptableObject.defineClass(parentScope, WindowFramesArray.class); final Window window = (Window)newPageInfo.getContext().newObject( parentScope, "Window", new Object[0]); |
From: <no...@us...> - 2003-09-03 19:15:59
|
Log Message: ----------- Added support for the about: protocol - patch from Jun Chen Modified Files: -------------- /cvsroot/htmlunit/htmlunit/src/xdocs: changes.xml /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host: WindowTest.java /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit: WebClient.java Added Files: ----------- /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/protocol/about: Handler.java AboutURLConnection.java Revision Data ------------- Index: changes.xml =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/xdocs/changes.xml,v retrieving revision 1.122 retrieving revision 1.123 diff -u -d -r1.122 -r1.123 --- changes.xml 3 Sep 2003 12:49:36 -0000 1.122 +++ changes.xml 3 Sep 2003 19:15:56 -0000 1.123 @@ -10,6 +10,10 @@ <action type="update" dev="mbowler" id="713646"> Patch for bug in onload handler submitted by Andreas Hangler </action> + <action type="update" dev="mbowler" id="797144 "> + Added support for the about: protocol - patch from Jun Chen + </action> + </release> Index: WindowTest.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/WindowTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- WindowTest.java 18 Jul 2003 13:09:58 -0000 1.5 +++ WindowTest.java 3 Sep 2003 19:15:56 -0000 1.6 @@ -61,6 +61,7 @@ * * @version $Revision$ * @author <a href="mailto:mb...@Ga...">Mike Bowler</a> + * @author <a href="mailto:che...@us...">Chen Jun</a> */ public class WindowTest extends WebTestCase { public WindowTest( final String name ) { @@ -164,6 +165,7 @@ /** * _self is a magic name. If we call open(url, '_self') then the current window must be * reloaded. + * @throws Exception If the test fails. */ public void testOpenWindow_self() throws Exception { final WebClient webClient = new WebClient(); @@ -212,6 +214,7 @@ /** * Regression test to reproduce a known bug + * @throws Exception if the test fails */ public void testAlert_NoAlertHandler() throws Exception { final WebClient webClient = new WebClient(); @@ -474,5 +477,70 @@ Thread.sleep(waitTime); } fail("No alerts written within "+maxTime+"ms"); + } + + + public void testAboutURL() throws Exception { + final WebClient webClient = new WebClient(); + final FakeWebConnection webConnection = + new FakeWebConnection(webClient); + final String firstContent = + "<html><body><script language='JavaScript'>" + + "w2=window.open(\"about:blank\", \"AboutBlank\");" + + "w2.document.open();" + + "w2.document.write(\"<html><head><title>hello</title></head><body></body></html>\");" + + "w2.document.close();" + + "</script></body></html>"; + webConnection.setResponse( + new URL("http://first"), + firstContent, + 200, + "OK", + "text/html", + Collections.EMPTY_LIST); + webClient.setWebConnection(webConnection); + + webClient.getPage( + new URL("http://first"), + SubmitMethod.POST, + Collections.EMPTY_LIST); + final WebWindow webWindow = webClient.getWebWindowByName("AboutBlank"); + assertNotNull(webWindow); + + // final HtmlPage page = (HtmlPage) webWindow.getEnclosedPage(); + // assertEquals("<html><head><title>hello</title></head><body></body></html>",page.getDocument().toString()); + } + + /** + * + * @throws Exception If the test fails + */ + public void testWindowFrames() throws Exception { + final WebClient webClient = new WebClient(); + final FakeWebConnection webConnection = + new FakeWebConnection(webClient); + final List collectedAlerts = new ArrayList(); + + webClient.setAlertHandler(new CollectingAlertHandler(collectedAlerts)); + + final String firstContent = + "<html><body><script language='JavaScript'>" + + "if (typeof top.frames[\"anyXXXname\"] == \"undefined\") {" + + "alert('one')};" + + "</script></body></html>"; + webConnection.setResponse( + new URL("http://first"), + firstContent, + 200, + "OK", + "text/html", + Collections.EMPTY_LIST); + webClient.setWebConnection(webConnection); + + webClient.getPage( + new URL("http://first"), + SubmitMethod.POST, + Collections.EMPTY_LIST); + assertEquals(1, collectedAlerts.size()); } } --- NEW FILE: Handler.java --- /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit.protocol.about; import java.io.IOException; import java.net.URL; import java.net.URLConnection; import java.net.URLStreamHandler; /** * Stream handler for "about:" urls * * @author <a href="mailto:che...@us...">Chen Jun</a> * @version $Revision: 1.1 $ */ public class Handler extends URLStreamHandler { /** * Return a new URLConnection for this url. * @param url The "about:" url. * @return The connection. * @throws IOException If an IO problem occurs */ protected URLConnection openConnection( final URL url ) throws IOException { return new AboutURLConnection(url); } } --- NEW FILE: AboutURLConnection.java --- /* * Copyright (c) 2002, 2003 Gargoyle Software Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The end-user documentation included with the redistribution, if any, must * include the following acknowledgment: * * "This product includes software developed by Gargoyle Software Inc. * (http://www.GargoyleSoftware.com/)." * * Alternately, this acknowledgment may appear in the software itself, if * and wherever such third-party acknowledgments normally appear. * 4. The name "Gargoyle Software" must not be used to endorse or promote * products derived from this software without prior written permission. * For written permission, please contact in...@Ga.... * 5. Products derived from this software may not be called "HtmlUnit", nor may * "HtmlUnit" appear in their name, without prior written permission of * Gargoyle Software Inc. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.gargoylesoftware.htmlunit.protocol.about; import java.io.IOException; import java.net.URL; import java.net.URLConnection; /** * A URLConnection for supporting "about:" urls * * @author <a href="mailto:che...@us...">Chen Jun</a> * @version 1.0, 2003-8-24 */ public class AboutURLConnection extends URLConnection { // private final String content_; /** * Create an instance * @param url The "about:" url. */ public AboutURLConnection(final URL url) { super(url); // content_ = url.toExternalForm().substring("about:".length()); } /** * @see java.net.URLConnection#connect() */ public void connect() throws IOException { } } Index: WebClient.java =================================================================== RCS file: /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/WebClient.java,v retrieving revision 1.45 retrieving revision 1.46 diff -u -d -r1.45 -r1.46 --- WebClient.java 16 Jul 2003 20:11:21 -0000 1.45 +++ WebClient.java 3 Sep 2003 19:15:57 -0000 1.46 @@ -68,6 +68,7 @@ * @author <a href="mailto:gud...@sf...">Mike J. Bresnahan</a> * @author Dominique Broeglin * @author Noboru Sinohara + * @author <a href="mailto:che...@us..."> Chen Jun</a> */ public class WebClient { @@ -94,9 +95,51 @@ private final List webWindows_ = new ArrayList(); private WebWindow currentWindow_ = new TopLevelWindow("", this); - + private static URLStreamHandler JavaScriptUrlStreamHandler_ = new com.gargoylesoftware.htmlunit.protocol.javascript.Handler(); + private static URLStreamHandler AboutUrlStreamHandler_ + = new com.gargoylesoftware.htmlunit.protocol.about.Handler(); + //singleton WebResponse for "about:blank" + private static final WebResponse WEB_RESPONSE_FOR_ABOUT_BLANK = new WebResponse() { + public int getStatusCode() { + return 200; + } + public String getStatusMessage() { + return "OK"; + } + public String getContentType() { + return "text/html"; + } + public String getContentAsString() { + return ""; + } + public InputStream getContentAsStream() { + return TextUtil.toInputStream(""); + } + public URL getUrl() { + try { + return new URL(null,"about:blank",AboutUrlStreamHandler_); + } + catch (MalformedURLException e) { + // impossible + e.printStackTrace(); + return null; + } + } + public String getResponseHeaderValue(final String key) { + return ""; + } + public long getLoadTimeInMilliSeconds() { + return 0; + } + public byte[] getResponseBody() { + return "".getBytes(); + } + public String getContentCharSet() { + return "ISO-8859-1"; + } + }; /** @@ -136,6 +179,7 @@ Assert.notNull("browserVersion", browserVersion); Assert.notNull( "proxyHost", proxyHost ); + browserVersion_ = browserVersion; proxyHost_ = proxyHost; proxyPort_ = proxyPort; try { @@ -334,7 +378,10 @@ final WebResponse webResponse; if( protocol.equals("javascript") ) { webResponse = makeWebResponseForJavaScriptUrl(webWindow, url); - } + } + else if (protocol.equals("about")) { + webResponse = makeWebResponseForAboutUrl(webWindow,url); + } else { webResponse = loadWebResponse( url, method, parameters ); } @@ -825,7 +872,10 @@ if( TextUtil.startsWithIgnoreCase(urlString, "javascript:") ) { return new URL(null, urlString, JavaScriptUrlStreamHandler_); - } + } + else if (TextUtil.startsWithIgnoreCase(urlString,"about:")){ + return new URL(null, urlString, AboutUrlStreamHandler_); + } else { return new URL(urlString); } @@ -908,6 +958,15 @@ buffer.append("/"); } return makeUrl( buffer.toString() ); + } + private WebResponse makeWebResponseForAboutUrl( + final WebWindow webWindow, + final URL url) { + if (!url.toExternalForm().substring("about:".length()).equalsIgnoreCase("blank")){ + throw new IllegalArgumentException( + url.toExternalForm()+"is not supported, only about:blank is supported now."); + } + return WEB_RESPONSE_FOR_ABOUT_BLANK; } |
From: <no...@us...> - 2003-09-03 19:15:53
|
Update of /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/protocol/about In directory sc8-pr-cvs1:/tmp/cvs-serv11965/src/java/com/gargoylesoftware/htmlunit/protocol/about Log Message: Directory /cvsroot/htmlunit/htmlunit/src/java/com/gargoylesoftware/htmlunit/protocol/about added to the repository |