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
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
1
(18) |
2
(15) |
3
|
4
|
5
(18) |
6
(2) |
7
(2) |
8
(3) |
9
|
10
|
11
|
12
(1) |
13
|
14
(1) |
15
|
16
(1) |
17
|
18
|
19
|
20
(1) |
21
|
22
|
23
(2) |
24
|
25
(15) |
26
(4) |
27
(4) |
28
(4) |
29
(5) |
30
(2) |
31
(7) |
From: <bui...@ca...> - 2013-08-31 16:07:25
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD COMPLETE - build.2384</h1> <table> <tr> <th>Date of build</th><td>08/31/2013 16:38:16</td> </tr> <tr> <th>Time to build</th><td>88 minute(s) 47 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/31/2013 16:35:06</td> </tr> <tr> <th>Last log entry</th><td>remove the pixel value cache (rbri) </td> </tr> </table> <h2>Unit Tests</h2> <p>Test cases: <b>17741</b>, passed: <b>17741</b>, failures: <b>0</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="100%"> </td> </tr> </table> <h2>Modifications</h2> <p>6 modifications since last build.</p> <h3>rbri: correct processing of the target when for anchors with hash-only href Issue 1537 (08/29/2013 21:59:29)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java</li> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor2Test.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/changes/changes.xml</li> </ul> <h3>rbri: force build (08/30/2013 06:32:44)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/force.build</li> </ul> <h3>rbri: remove the pixel value cache (08/31/2013 16:35:06)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java</li> </ul> </body> </html> |
From: <rb...@us...> - 2013-08-31 14:35:11
|
Revision: 8461 http://sourceforge.net/p/htmlunit/code/8461 Author: rbri Date: 2013-08-31 14:35:06 +0000 (Sat, 31 Aug 2013) Log Message: ----------- remove the pixel value cache Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-08-30 04:32:44 UTC (rev 8460) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleDeclaration.java 2013-08-31 14:35:06 UTC (rev 8461) @@ -251,9 +251,6 @@ private static final Log LOG = LogFactory.getLog(CSSStyleDeclaration.class); private static final Map<String, String> CSSColors_ = new HashMap<String, String>(); private static final Map<String, String> CamelizeCache_ = new ConcurrentHashMap<String, String>(400, 0.75f, 2); - private static final Map<String, Integer> PixelValuesCache_ - = new ConcurrentHashMap<String, Integer>(1000, 0.75f, 2); - private static final int MaxPixelValuesCacheSize = 20000; /** The different types of shorthand values. */ private enum Shorthand { @@ -4322,7 +4319,7 @@ final int absoluteValue = (parent == null) ? value.getWindowDefaultValue() : pixelValue(parent, value); return (int) ((i / 100D) * absoluteValue); } - else if (s.isEmpty() && element instanceof HTMLCanvasElement) { + if (s.isEmpty() && element instanceof HTMLCanvasElement) { return value.getWindowDefaultValue(); } return pixelValue(s); @@ -4338,12 +4335,11 @@ * @see #pixelValue(HTMLElement, CssValue) */ protected static int pixelValue(final String value) { - final Integer result = PixelValuesCache_.get(value); - if (null != result) { - return result.intValue(); + int i = NumberUtils.toInt(TO_INT_PATTERN.matcher(value).replaceAll("$1"), 0); + if (value.length() < 2) { + return i; } - int i = NumberUtils.toInt(TO_INT_PATTERN.matcher(value).replaceAll("$1"), 0); if (value.endsWith("px")) { // nothing to do } @@ -4368,12 +4364,6 @@ else if (value.endsWith("pc")) { i = i * 24; } - - // refresh in case of overflow - if (PixelValuesCache_.size() > MaxPixelValuesCacheSize) { - PixelValuesCache_.clear(); - } - PixelValuesCache_.put(value, Integer.valueOf(i)); return i; } |
From: <bui...@ca...> - 2013-08-30 05:57:33
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD FAILED</h1> <table> <tr> <th>Date of build</th><td>08/30/2013 06:34:45</td> </tr> <tr> <th>Time to build</th><td>82 minute(s) 31 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/30/2013 06:32:44</td> </tr> <tr> <th>Last log entry</th><td>force build (rbri) </td> </tr> </table> <h2>Ant Error Message</h2> <pre>Return code is 1</pre> <pre></pre> <h2>Unit Tests</h2> <p>Test cases: <b>17741</b>, passed: <b>17740</b>, failures: <b>1</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="99.99436333915789%"> </td><td bgcolor="#FFFFA0" width="0.0056366608421171294%"> </td> </tr> </table> <h3>Failures</h3> <ul> <li class="oddrow">WebSocketTest.chat [FF17]</li> </ul> <h3>Unit Test Error Details: (1)</h3> <h4>Test: WebSocketTest.chat [FF17]</h4> <p>Type: org.junit.ComparisonFailure</p> <p>Message: expected:<[Browser: has joined!]> but was:<[]></p> <PRE> </PRE> <h2>Modifications</h2> <p>5 modifications since last build.</p> <h3>rbri: correct processing of the target when for anchors with hash-only href Issue 1537 (08/29/2013 21:59:29)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java</li> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor2Test.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/changes/changes.xml</li> </ul> <h3>rbri: force build (08/30/2013 06:32:44)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/force.build</li> </ul> </body> </html> |
From: <rb...@us...> - 2013-08-30 04:32:47
|
Revision: 8460 http://sourceforge.net/p/htmlunit/code/8460 Author: rbri Date: 2013-08-30 04:32:44 +0000 (Fri, 30 Aug 2013) Log Message: ----------- force build Modified Paths: -------------- trunk/htmlunit/force.build Modified: trunk/htmlunit/force.build =================================================================== --- trunk/htmlunit/force.build 2013-08-29 19:59:29 UTC (rev 8459) +++ trunk/htmlunit/force.build 2013-08-30 04:32:44 UTC (rev 8460) @@ -1 +1 @@ -22 \ No newline at end of file +23 \ No newline at end of file |
From: <bui...@ca...> - 2013-08-29 21:37:04
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD FAILED</h1> <table> <tr> <th>Date of build</th><td>08/29/2013 22:02:49</td> </tr> <tr> <th>Time to build</th><td>93 minute(s) 55 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/29/2013 21:59:29</td> </tr> <tr> <th>Last log entry</th><td>correct processing of the target when for anchors with hash-only href Issue 1537 (rbri) </td> </tr> </table> <h2>Ant Error Message</h2> <pre>Return code is 1</pre> <pre></pre> <h2>Unit Tests</h2> <p>Test cases: <b>17741</b>, passed: <b>17740</b>, failures: <b>1</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="99.99436333915789%"> </td><td bgcolor="#FFFFA0" width="0.0056366608421171294%"> </td> </tr> </table> <h3>Failures</h3> <ul> <li class="oddrow">waitForJobs_complexJobs</li> </ul> <h3>Unit Test Error Details: (1)</h3> <h4>Test: waitForJobs_complexJobs</h4> <p>Type: java.lang.AssertionError</p> <p>Message: expected:<2> but was:<0></p> <PRE> </PRE> <h2>Modifications</h2> <p>4 modifications since last build.</p> <h3>rbri: correct processing of the target when for anchors with hash-only href Issue 1537 (08/29/2013 21:59:29)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java</li> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor2Test.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/changes/changes.xml</li> </ul> </body> </html> |
From: <rb...@us...> - 2013-08-29 19:59:33
|
Revision: 8459 http://sourceforge.net/p/htmlunit/code/8459 Author: rbri Date: 2013-08-29 19:59:29 +0000 (Thu, 29 Aug 2013) Log Message: ----------- correct processing of the target when for anchors with hash-only href Issue 1537 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/html/HtmlAnchor2Test.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-08-28 09:19:01 UTC (rev 8458) +++ trunk/htmlunit/src/changes/changes.xml 2013-08-29 19:59:29 UTC (rev 8459) @@ -8,6 +8,9 @@ <body> <release version="2.13" date="???" description="Bugfixes"> + <action type="add" dev="rbri" issue="1537"> + Correct processing of the target when for anchors with hash-only href. + </action> <action type="add" dev="rbri"> JavaScript: support for the 'type' and 'media' property of style elements added. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-08-28 09:19:01 UTC (rev 8458) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-08-29 19:59:29 UTC (rev 8459) @@ -1962,7 +1962,7 @@ final LoadJob loadJob; if (justHashJump) { - loadJob = new LoadJob(request, win, target, url); + loadJob = new LoadJob(request, requestingWindow, target, url); } else { try { @@ -2006,25 +2006,24 @@ LOG.info("No usage of download: " + downloadedResponse); continue; } - if (downloadedResponse.urlWithOnlyHashChange_ != null) { - final WebWindow window = downloadedResponse.requestingWindow_; - final HtmlPage page = (HtmlPage) window.getEnclosedPage(); - page.getWebResponse().getWebRequest().setUrl(downloadedResponse.urlWithOnlyHashChange_); - window.getHistory().addPage(page); + final WebWindow window = resolveWindow(downloadedResponse.requestingWindow_, + downloadedResponse.target_); + if (!updatedWindows.contains(window)) { + final WebWindow win = openTargetWindow(downloadedResponse.requestingWindow_, + downloadedResponse.target_, "_self"); + if (downloadedResponse.urlWithOnlyHashChange_ != null) { + final HtmlPage page = (HtmlPage) downloadedResponse.requestingWindow_.getEnclosedPage(); + page.getWebResponse().getWebRequest().setUrl(downloadedResponse.urlWithOnlyHashChange_); + win.getHistory().addPage(page); - // update location.hash - final Window jsWindow = (Window) window.getScriptObject(); - if (null != jsWindow) { - final Location location = jsWindow.getLocation(); - location.setHash(downloadedResponse.urlWithOnlyHashChange_.getRef()); + // update location.hash + final Window jsWindow = (Window) win.getScriptObject(); + if (null != jsWindow) { + final Location location = jsWindow.getLocation(); + location.setHash(downloadedResponse.urlWithOnlyHashChange_.getRef()); + } } - } - else { - final WebWindow window = resolveWindow(downloadedResponse.requestingWindow_, - downloadedResponse.target_); - if (!updatedWindows.contains(window)) { - final WebWindow win = openTargetWindow(downloadedResponse.requestingWindow_, - downloadedResponse.target_, "_self"); + else { final Page pageBeforeLoad = win.getEnclosedPage(); loadWebResponseInto(downloadedResponse.response_, win); @@ -2040,10 +2039,10 @@ // check and report problems if needed throwFailingHttpStatusCodeExceptionIfNecessary(downloadedResponse.response_); } - else { - LOG.info("No usage of download: " + downloadedResponse); - } } + else { + LOG.info("No usage of download: " + downloadedResponse); + } } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor2Test.java 2013-08-28 09:19:01 UTC (rev 8458) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchor2Test.java 2013-08-29 19:59:29 UTC (rev 8459) @@ -262,4 +262,23 @@ assertEquals(new URL(getDefaultUrl(), "page2.html").toString(), driver.getCurrentUrl()); } + /** + * @throws Exception if an error occurs + */ + @Test + public void clickBlankTargetHashOnly() throws Exception { + final String html = + "<html>\n" + + "<head><title>foo</title></head>\n" + + "<body>\n" + + "<a id='a' target='_blank' href='#'>Foo</a>\n" + + "</body></html>\n"; + + final WebDriver driver = loadPage2(html); + assertEquals(1, driver.getWindowHandles().size()); + + final WebElement tester = driver.findElement(By.id("a")); + tester.click(); + assertEquals(2, driver.getWindowHandles().size()); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java 2013-08-28 09:19:01 UTC (rev 8458) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlAnchorTest.java 2013-08-29 19:59:29 UTC (rev 8459) @@ -592,10 +592,19 @@ */ @Test public void testHashAnchor() throws Exception { - final String html = "<html><body><a id='a' href='#a'>a</a></body></html>"; + final String html = "<html><body>" + + "<a id='a' href='#a'>a</a>" + + "<a id='a_target' href='#target' target='_blank'>target</a>" + + "</body></html>"; HtmlPage page = loadPage(html); - page = page.getHtmlElementById("a").click(); + HtmlPage targetPage = page.getHtmlElementById("a").click(); assertEquals(new URL(getDefaultUrl(), "#a"), page.getUrl()); + assertEquals(page.getEnclosingWindow(), targetPage.getEnclosingWindow()); + + page = loadPage(html); + targetPage = page.getHtmlElementById("a_target").click(); + assertEquals(new URL(getDefaultUrl(), "#target"), targetPage.getUrl()); + assertFalse(page.getEnclosingWindow().equals(targetPage.getEnclosingWindow())); } /** |
From: <bui...@ca...> - 2013-08-28 10:49:51
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD COMPLETE - build.2383</h1> <table> <tr> <th>Date of build</th><td>08/28/2013 11:22:23</td> </tr> <tr> <th>Time to build</th><td>87 minute(s) 9 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/28/2013 11:19:01</td> </tr> <tr> <th>Last log entry</th><td>fource build (rbri) </td> </tr> </table> <h2>Unit Tests</h2> <p>Test cases: <b>17738</b>, passed: <b>17738</b>, failures: <b>0</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="100%"> </td> </tr> </table> <h2>Modifications</h2> <p>2 modifications since last build.</p> <h3>rbri: cleanup (08/27/2013 21:24:37)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java</li> </ul> <h3>rbri: fource build (08/28/2013 11:19:01)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/force.build</li> </ul> </body> </html> |
From: <rb...@us...> - 2013-08-28 09:19:04
|
Revision: 8458 http://sourceforge.net/p/htmlunit/code/8458 Author: rbri Date: 2013-08-28 09:19:01 +0000 (Wed, 28 Aug 2013) Log Message: ----------- fource build Modified Paths: -------------- trunk/htmlunit/force.build Modified: trunk/htmlunit/force.build =================================================================== --- trunk/htmlunit/force.build 2013-08-27 19:24:37 UTC (rev 8457) +++ trunk/htmlunit/force.build 2013-08-28 09:19:01 UTC (rev 8458) @@ -1 +1 @@ -21 \ No newline at end of file +22 \ No newline at end of file |
From: <bui...@ca...> - 2013-08-27 21:08:39
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD FAILED</h1> <table> <tr> <th>Date of build</th><td>08/27/2013 21:27:43</td> </tr> <tr> <th>Time to build</th><td>100 minute(s) 31 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/27/2013 21:24:37</td> </tr> <tr> <th>Last log entry</th><td>cleanup (rbri) </td> </tr> </table> <h2>Ant Error Message</h2> <pre>Return code is 1</pre> <pre></pre> <h2>Unit Tests</h2> <p>Test cases: <b>17738</b>, passed: <b>17737</b>, failures: <b>1</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="99.99436238583831%"> </td><td bgcolor="#FFFFA0" width="0.005637614161686774%"> </td> </tr> </table> <h3>Failures</h3> <ul> <li class="oddrow">waitForComplexJobs</li> </ul> <h3>Unit Test Error Details: (1)</h3> <h4>Test: waitForComplexJobs</h4> <p>Type: java.lang.AssertionError</p> <p>Message: expected:<1> but was:<2></p> <PRE> </PRE> <h2>Modifications</h2> <p>1 modifications since last build.</p> <h3>rbri: cleanup (08/27/2013 21:24:37)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java</li> </ul> </body> </html> |
From: <rb...@us...> - 2013-08-27 19:24:40
|
Revision: 8457 http://sourceforge.net/p/htmlunit/code/8457 Author: rbri Date: 2013-08-27 19:24:37 +0000 (Tue, 27 Aug 2013) Log Message: ----------- cleanup Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2013-08-27 11:19:05 UTC (rev 8456) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLDocument.java 2013-08-27 19:24:37 UTC (rev 8457) @@ -555,9 +555,10 @@ if (thisObj instanceof HTMLDocument && thisObj.getPrototype() instanceof HTMLDocument) { return (HTMLDocument) thisObj; } - else if (thisObj instanceof DocumentProxy && thisObj.getPrototype() instanceof HTMLDocument) { + if (thisObj instanceof DocumentProxy && thisObj.getPrototype() instanceof HTMLDocument) { return (HTMLDocument) ((DocumentProxy) thisObj).getDelegee(); } + final Window window = getWindow(thisObj); final BrowserVersion browser = window.getWebWindow().getWebClient().getBrowserVersion(); if (browser.hasFeature(GENERATED_53)) { |
From: <rb...@us...> - 2013-08-27 11:19:11
|
Revision: 8456 http://sourceforge.net/p/htmlunit/code/8456 Author: rbri Date: 2013-08-27 11:19:05 +0000 (Tue, 27 Aug 2013) Log Message: ----------- don' use the same feature for different things Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-26 12:15:05 UTC (rev 8455) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-27 11:19:05 UTC (rev 8456) @@ -576,6 +576,12 @@ @BrowserFeature(@WebBrowser(IE)) HTMLELEMENT_OUTER_HTML_UPPER_CASE, + /** + * Indicates outer/innerHtml quotes attributes. + **/ + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + HTMLELEMENT_OUTER_INNER_HTML_QUOTE_ATTRIBUTES, + /** */ HTMLELEMENT_TRIM_CLASS_ATTRIBUTE, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-26 12:15:05 UTC (rev 8455) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-27 11:19:05 UTC (rev 8456) @@ -18,6 +18,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_72; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_ATTRIBUTE_FIX_IN_QUIRKS_MODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_OUTER_HTML_UPPER_CASE; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_OUTER_INNER_HTML_QUOTE_ATTRIBUTES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML_COLOR_RESTRICT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ALIGN_ACCEPTS_ARBITRARY_VALUES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_BOUNDING_CLIENT_RECT_OFFSET_TWO; @@ -934,10 +935,11 @@ } buffer.append("<").append(tag); // Add the attributes. IE does not use quotes, FF does. + final boolean doQoute = getBrowserVersion().hasFeature(HTMLELEMENT_OUTER_INNER_HTML_QUOTE_ATTRIBUTES); for (final DomAttr attr : element.getAttributesMap().values()) { final String name = attr.getName(); final String value = PRINT_NODE_QUOTE_PATTERN.matcher(attr.getValue()).replaceAll("""); - final boolean quote = !isUpperCase + final boolean quote = doQoute || com.gargoylesoftware.htmlunit.util.StringUtils.containsWhitespace(value) || value.isEmpty() || (element instanceof HtmlAnchor && "href".equals(name)); |
From: <rb...@us...> - 2013-08-26 12:15:08
|
Revision: 8455 http://sourceforge.net/p/htmlunit/code/8455 Author: rbri Date: 2013-08-26 12:15:05 +0000 (Mon, 26 Aug 2013) Log Message: ----------- another feature cleanup Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-26 08:29:07 UTC (rev 8454) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-26 12:15:05 UTC (rev 8455) @@ -292,10 +292,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_125, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_13, /** Was originally .isIE(). */ @@ -436,14 +432,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_73, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) - GENERATED_74, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_80, /** Was originally .isIE(). */ @@ -1024,6 +1012,10 @@ @BrowserFeature(@WebBrowser(IE)) JS_PARENT_PROTO_PROPERTIES, + /** Indicates that the prefix property returns an empty string if no prefix defined. */ + @BrowserFeature(@WebBrowser(IE)) + JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED, + /** Indicates that document.queryCommandSupported(..) is only available in design mode. */ @BrowserFeature(@WebBrowser(value = FF, maxVersion = 3.6f)) JS_QUERYCOMMAND_SUPPORTED_ONLY_DESIGNMODE, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-08-26 08:29:07 UTC (rev 8454) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Node.java 2013-08-26 12:15:05 UTC (rev 8455) @@ -16,11 +16,11 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_121; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_124; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_125; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_45; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPEND_CHILD_CREATE_DOCUMENT_FRAGMENT_PARENT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_APPEND_CHILD_THROWS_NO_EXCEPTION_FOR_WRONG_NOTE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CLONE_NODE_COPIES_EVENT_LISTENERS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SERIALIZER_APPENDS_CRLF; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_XML_SUPPORT_VIA_ACTIVEXOBJECT; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; @@ -899,7 +899,7 @@ public String getPrefix() { final DomNode domNode = getDomNodeOrDie(); final String prefix = domNode.getPrefix(); - if (getBrowserVersion().hasFeature(GENERATED_125) + if (getBrowserVersion().hasFeature(JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED) && (prefix == null || domNode.getHtmlPageOrNull() != null)) { return ""; } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-26 08:29:07 UTC (rev 8454) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-26 12:15:05 UTC (rev 8455) @@ -16,8 +16,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_65; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_72; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_73; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_74; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_ATTRIBUTE_FIX_IN_QUIRKS_MODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_OUTER_HTML_UPPER_CASE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML_COLOR_RESTRICT; @@ -35,6 +33,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_REDUCE_WHITESPACES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NATIVE_FUNCTION_TOSTRING_NEW_LINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_OFFSET_PARENT_THROWS_NOT_ATTACHED; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SET_ATTRIBUTE_CONSIDERS_ATTR_FOR_CLASS_AS_REAL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SET_ATTRIBUTE_SUPPORTS_EVENT_HANDLERS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES; @@ -2091,7 +2090,7 @@ */ @Override public String getPrefix() { - if (getBrowserVersion().hasFeature(GENERATED_73)) { + if (getBrowserVersion().hasFeature(JS_PREFIX_RETURNS_EMPTY_WHEN_UNDEFINED)) { return ""; } return null; @@ -2266,7 +2265,7 @@ } } catch (final NumberFormatException e) { - if (getBrowserVersion().hasFeature(GENERATED_74)) { + if (!getBrowserVersion().hasFeature(JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES)) { value = ""; } } |
From: <rb...@us...> - 2013-08-26 08:29:11
|
Revision: 8454 http://sourceforge.net/p/htmlunit/code/8454 Author: rbri Date: 2013-08-26 08:29:07 +0000 (Mon, 26 Aug 2013) Log Message: ----------- another feature cleanup Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-26 08:19:41 UTC (rev 8453) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-26 08:29:07 UTC (rev 8454) @@ -432,10 +432,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_71, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_72, /** Was originally .isIE(). */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-26 08:19:41 UTC (rev 8453) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-26 08:29:07 UTC (rev 8454) @@ -15,7 +15,6 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_65; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_71; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_72; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_73; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_74; @@ -1026,9 +1025,10 @@ domNode.appendChild(new DomText(domNode.getPage(), Context.toString(value))); } - //if the parentNode has null parentNode in IE, - //create a DocumentFragment to be the parentNode's parentNode. - if (domNode.getParentNode() == null && getBrowserVersion().hasFeature(GENERATED_71)) { + final boolean createFragment = getBrowserVersion().hasFeature(JS_INNER_HTML_CREATES_DOC_FRAGMENT_AS_PARENT); + // if the parentNode has null parentNode in IE, + // create a DocumentFragment to be the parentNode's parentNode. + if (domNode.getParentNode() == null && createFragment) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } |
From: <rb...@us...> - 2013-08-26 08:19:45
|
Revision: 8453 http://sourceforge.net/p/htmlunit/code/8453 Author: rbri Date: 2013-08-26 08:19:41 +0000 (Mon, 26 Aug 2013) Log Message: ----------- use the correct url in the log message and javadoc fix Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java 2013-08-25 21:49:47 UTC (rev 8452) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/CSSStyleSheet.java 2013-08-26 08:19:41 UTC (rev 8453) @@ -277,15 +277,15 @@ * Loads the stylesheet at the specified link or href. * @param window the current window * @param element the parent DOM element - * @param link the stylesheet's link (may be <tt>null</tt> if an <tt>href</tt> is specified) + * @param link the stylesheet's link (may be <tt>null</tt> if an <tt>url</tt> is specified) * @param url the stylesheet's url (may be <tt>null</tt> if a <tt>link</tt> is specified) * @return the loaded stylesheet */ public static CSSStyleSheet loadStylesheet(final Window window, final HTMLElement element, final HtmlLink link, final String url) { CSSStyleSheet sheet; - final HtmlPage page = (HtmlPage) element.getDomNodeOrDie().getPage(); // fallback uri for exceptions - String uri = page.getUrl().toExternalForm(); + final HtmlPage page = (HtmlPage) element.getDomNodeOrDie().getPage(); + String uri = page.getUrl().toExternalForm(); // fallback uri for exceptions try { // Retrieve the associated content and respect client settings regarding failing HTTP status codes. final WebRequest request; @@ -322,24 +322,24 @@ } catch (final FailingHttpStatusCodeException e) { // Got a 404 response or something like that; behave nicely. - LOG.error("Exception loading " + url, e); + LOG.error("Exception loading " + uri, e); final InputSource source = new InputSource(new StringReader("")); sheet = new CSSStyleSheet(element, source, uri); } catch (final IOException e) { // Got a basic IO error; behave nicely. - LOG.error("IOException loading " + url, e); + LOG.error("IOException loading " + uri, e); final InputSource source = new InputSource(new StringReader("")); sheet = new CSSStyleSheet(element, source, uri); } catch (final RuntimeException e) { // Got something unexpected; we can throw an exception in this case. - LOG.error("RuntimeException loading " + url, e); + LOG.error("RuntimeException loading " + uri, e); throw Context.reportRuntimeError("Exception: " + e); } catch (final Exception e) { // Got something unexpected; we can throw an exception in this case. - LOG.error("Exception loading " + url, e); + LOG.error("Exception loading " + uri, e); throw Context.reportRuntimeError("Exception: " + e); } return sheet; |
From: <rb...@us...> - 2013-08-25 21:49:52
|
Revision: 8452 http://sourceforge.net/p/htmlunit/code/8452 Author: rbri Date: 2013-08-25 21:49:47 +0000 (Sun, 25 Aug 2013) Log Message: ----------- misc code cleanup and more feature naming Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-25 17:57:14 UTC (rev 8451) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-25 21:49:47 UTC (rev 8452) @@ -432,10 +432,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_70, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_71, /** Was originally .isIE(). */ @@ -972,6 +968,19 @@ @BrowserFeature(@WebBrowser(IE)) JS_IMAGE_WIDTH_HEIGHT_RETURNS_28x30x1, + /** Indicates that innerHTML adds the child also for null values. */ + @BrowserFeature(@WebBrowser(IE)) + JS_INNER_HTML_ADD_CHILD_FOR_NULL_VALUE, + + /** Indicates that innerHTML creates a document fragment as parent node + * if the receiver node has no parent at all. */ + @BrowserFeature(@WebBrowser(IE)) + JS_INNER_HTML_CREATES_DOC_FRAGMENT_AS_PARENT, + + /** Indicates that innerHTML is readonly for some tags. */ + @BrowserFeature(@WebBrowser(IE)) + JS_INNER_HTML_READONLY_FOR_SOME_TAGS, + /** Indicates if multiple spaces are replaced by a single one when accessing innerHTML. */ @BrowserFeature(@WebBrowser(IE)) JS_INNER_HTML_REDUCE_WHITESPACES, Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-25 17:57:14 UTC (rev 8451) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-25 21:49:47 UTC (rev 8452) @@ -15,7 +15,6 @@ package com.gargoylesoftware.htmlunit.javascript.host.html; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_65; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_70; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_71; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_72; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_73; @@ -31,6 +30,9 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CHAR_UNDEFINED_DOT; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_CLIENT_LEFT_TOP_ZERO; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ELEMENT_EXTENT_WITHOUT_PADDING; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_ADD_CHILD_FOR_NULL_VALUE; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_CREATES_DOC_FRAGMENT_AS_PARENT; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_READONLY_FOR_SOME_TAGS; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INNER_HTML_REDUCE_WHITESPACES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_NATIVE_FUNCTION_TOSTRING_NEW_LINE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_OFFSET_PARENT_THROWS_NOT_ATTACHED; @@ -975,9 +977,9 @@ @JsxSetter public void setInnerHTML(final Object value) { final DomNode domNode = getDomNodeOrDie(); - final boolean ie = getBrowserVersion().hasFeature(GENERATED_70); + final boolean readonly = getBrowserVersion().hasFeature(JS_INNER_HTML_READONLY_FOR_SOME_TAGS); - if (ie && INNER_HTML_READONLY_IN_IE.contains(domNode.getNodeName())) { + if (readonly && INNER_HTML_READONLY_IN_IE.contains(domNode.getNodeName())) { throw Context.reportRuntimeError("innerHTML is read-only for tag " + domNode.getNodeName()); } @@ -986,14 +988,16 @@ // null && IE -> add child // null && non-IE -> Don't add // '' -> Don't add - if ((value == null && ie) || (value != null && !"".equals(value))) { + final boolean addChildForNull = getBrowserVersion().hasFeature(JS_INNER_HTML_ADD_CHILD_FOR_NULL_VALUE); + if ((value == null && addChildForNull) || (value != null && !"".equals(value))) { final String valueAsString = Context.toString(value); parseHtmlSnippet(domNode, true, valueAsString); - //if the parentNode has null parentNode in IE, - //create a DocumentFragment to be the parentNode's parentNode. - if (domNode.getParentNode() == null && ie) { + final boolean createFragment = getBrowserVersion().hasFeature(JS_INNER_HTML_CREATES_DOC_FRAGMENT_AS_PARENT); + // if the parentNode has null parentNode in IE, + // create a DocumentFragment to be the parentNode's parentNode. + if (domNode.getParentNode() == null && createFragment) { final DomDocumentFragment fragment = ((HtmlPage) domNode.getPage()).createDomDocumentFragment(); fragment.appendChild(domNode); } @@ -2241,33 +2245,33 @@ * if <tt>null</tt>, this method returns <tt>0</tt> in lieu of negative values */ protected String getWidthOrHeight(final String attributeName, final Boolean returnNegativeValues) { - String s = getDomNodeOrDie().getAttribute(attributeName); - if (!PERCENT_VALUE.matcher(s).matches()) { + String value = getDomNodeOrDie().getAttribute(attributeName); + if (!PERCENT_VALUE.matcher(value).matches()) { try { - final Float f = Float.valueOf(s); + final Float f = Float.valueOf(value); final int i = f.intValue(); if (i < 0) { if (returnNegativeValues == null) { - s = "0"; + value = "0"; } else if (!returnNegativeValues.booleanValue()) { - s = ""; + value = ""; } else { - s = Integer.toString(i); + value = Integer.toString(i); } } else { - s = Integer.toString(i); + value = Integer.toString(i); } } catch (final NumberFormatException e) { if (getBrowserVersion().hasFeature(GENERATED_74)) { - s = ""; + value = ""; } } } - return s; + return value; } /** |
From: <rb...@us...> - 2013-08-25 17:57:18
|
Revision: 8451 http://sourceforge.net/p/htmlunit/code/8451 Author: rbri Date: 2013-08-25 17:57:14 +0000 (Sun, 25 Aug 2013) Log Message: ----------- misc code cleanup, feature naming and javadoc fixes Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableCellElement.java trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-25 15:42:34 UTC (rev 8450) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2013-08-25 17:57:14 UTC (rev 8451) @@ -452,10 +452,6 @@ /** Was originally .isIE(). */ @BrowserFeature(@WebBrowser(IE)) - GENERATED_75, - - /** Was originally .isIE(). */ - @BrowserFeature(@WebBrowser(IE)) GENERATED_80, /** Was originally .isIE(). */ @@ -1154,6 +1150,10 @@ @BrowserFeature(@WebBrowser(value = FF, minVersion = 17)) JS_TREEWALKER_EXPAND_ENTITY_REFERENCES_FALSE, + /** Setting the property width/heigth to arbitrary values is allowed. */ + @BrowserFeature({ @WebBrowser(FF), @WebBrowser(CHROME) }) + JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES, + /** Changing the opener of an window to something not null * is not valid (in FF). */ Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-25 15:42:34 UTC (rev 8450) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java 2013-08-25 17:57:14 UTC (rev 8451) @@ -20,7 +20,6 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_72; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_73; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_74; -import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.GENERATED_75; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_ATTRIBUTE_FIX_IN_QUIRKS_MODE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLELEMENT_OUTER_HTML_UPPER_CASE; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTML_COLOR_RESTRICT; @@ -37,6 +36,7 @@ import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_OFFSET_PARENT_THROWS_NOT_ATTACHED; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SET_ATTRIBUTE_CONSIDERS_ATTR_FOR_CLASS_AS_REAL; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_SET_ATTRIBUTE_SUPPORTS_EVENT_HANDLERS; +import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES; import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.QUERYSELECTORALL_NOT_IN_QUIRKS; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.CHROME; import static com.gargoylesoftware.htmlunit.javascript.configuration.BrowserName.FF; @@ -2275,24 +2275,22 @@ * @param attributeName the name of the attribute to set (<tt>"width"</tt> or <tt>"height"</tt>) * @param value the value of the specified attribute (width or height) * @param allowNegativeValues if <tt>true</tt>, negative values will be stored; - * if <tt>false</tt>, negative values cause an exception to be thrown; - * if <tt>null</tt>, negative values set the value to <tt>0</tt> + * if <tt>false</tt>, negative values cause an exception to be thrown;<br> + * this check/conversion is only done if the feature JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES + * is set for the simulated browser */ - protected void setWidthOrHeight(final String attributeName, String value, final Boolean allowNegativeValues) { + protected void setWidthOrHeight(final String attributeName, String value, final boolean allowNegativeValues) { if (value.endsWith("px")) { value = value.substring(0, value.length() - 2); } - if (getBrowserVersion().hasFeature(GENERATED_75) && value.length() > 0) { + if (!getBrowserVersion().hasFeature(JS_WIDTH_HEIGHT_ACCEPTS_ARBITRARY_VALUES) && value.length() > 0) { boolean error = false; if (!PERCENT_VALUE.matcher(value).matches()) { try { final Float f = Float.valueOf(value); final int i = f.intValue(); if (i < 0) { - if (allowNegativeValues == null) { - value = "0"; - } - else if (!allowNegativeValues.booleanValue()) { + if (!allowNegativeValues) { error = true; } } @@ -2302,7 +2300,8 @@ } } if (error) { - final Exception e = new Exception("Cannot set the width property to invalid value: " + value); + final Exception e = new Exception("Cannot set the '" + attributeName + + "' property to invalid value: '" + value + "'"); Context.throwAsScriptRuntimeEx(e); } } Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java 2013-08-25 15:42:34 UTC (rev 8450) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLIFrameElement.java 2013-08-25 17:57:14 UTC (rev 8451) @@ -173,7 +173,7 @@ */ @JsxSetter public void setWidth(final String width) { - setWidthOrHeight("width", width, Boolean.TRUE); + setWidthOrHeight("width", width, true); } /** @@ -188,12 +188,12 @@ } /** - * Sets the value of the "width" property. - * @param width the value of the "width" property + * Sets the value of the "height" property. + * @param height the value of the "height" property */ @JsxSetter - public void setHeight(final String width) { - setWidthOrHeight("height", width, Boolean.TRUE); + public void setHeight(final String height) { + setWidthOrHeight("height", height, true); } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableCellElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableCellElement.java 2013-08-25 15:42:34 UTC (rev 8450) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableCellElement.java 2013-08-25 17:57:14 UTC (rev 8451) @@ -327,12 +327,12 @@ } /** - * Sets the value of the "width" property. - * @param width the value of the "width" property + * Sets the value of the "height" property. + * @param height the value of the "height" property */ @JsxSetter - public void setHeight(final String width) { - setWidthOrHeight("height", width, !getBrowserVersion().hasFeature(GENERATED_101)); + public void setHeight(final String height) { + setWidthOrHeight("height", height, !getBrowserVersion().hasFeature(GENERATED_101)); } /** Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java 2013-08-25 15:42:34 UTC (rev 8450) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLTableColElement.java 2013-08-25 17:57:14 UTC (rev 8451) @@ -91,7 +91,7 @@ */ @JsxSetter public void setWidth(final Object width) { - setWidthOrHeight("width", (width == null ? "" : Context.toString(width)), Boolean.FALSE); + setWidthOrHeight("width", (width == null ? "" : Context.toString(width)), false); } /** |
From: <bui...@ca...> - 2013-08-25 17:56:14
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD COMPLETE - build.2376</h1> <table> <tr> <th>Date of build</th><td>08/25/2013 18:33:02</td> </tr> <tr> <th>Time to build</th><td>82 minute(s) 55 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/25/2013 17:42:34</td> </tr> <tr> <th>Last log entry</th><td>support for the 'media' property of style elements added (rbri) </td> </tr> </table> <h2>Unit Tests</h2> <p>Test cases: <b>17738</b>, passed: <b>17738</b>, failures: <b>0</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="100%"> </td> </tr> </table> <h2>Modifications</h2> <p>6 modifications since last build.</p> <h3>rbri: support for the type property of style elements added (08/25/2013 15:55:14)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/changes/changes.xml</li> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java</li> </ul> <h3>rbri: support for the 'media' property of style elements added (08/25/2013 17:42:34)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/changes/changes.xml</li> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java</li> </ul> </body> </html> |
From: <bui...@ca...> - 2013-08-25 16:28:07
|
<html> <head> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>CruiseControl Build Result</title> </head> <body> <h1 xmlns:xslt="http://xml.apache.org/xslt">BUILD FAILED</h1> <table> <tr> <th>Date of build</th><td>08/25/2013 17:06:01</td> </tr> <tr> <th>Time to build</th><td>81 minute(s) 48 second(s)</td> </tr> <tr> <th>Last changed</th><td>08/25/2013 15:55:14</td> </tr> <tr> <th>Last log entry</th><td>support for the type property of style elements added (rbri) </td> </tr> </table> <h2>Ant Error Message</h2> <pre>Return code is 1</pre> <pre></pre> <h2>Unit Tests</h2> <p>Test cases: <b>17735</b>, passed: <b>17732</b>, failures: <b>3</b>, errors: <b>0</b>.</p> <table cellpadding="0" cellspacing="0" bgcolor="white" id="utests"> <tr> <td bgcolor="green" width="99.98308429658867%"> </td><td bgcolor="#FFFFA0" width="0.01691570341133352%"> </td> </tr> </table> <h3>Failures</h3> <ul> <li class="oddrow">HTMLStyleElementTest.innerHtml [FF3.6]</li> <li class="evenrow">HTMLStyleElementTest.innerHtml [FF17]</li> <li class="oddrow">HTMLStyleElementTest.innerHtml [IE8]</li> </ul> <h3>Unit Test Error Details: (3)</h3> <h4>Test: HTMLStyleElementTest.innerHtml [FF3.6]</h4> <p>Type: org.junit.ComparisonFailure</p> <p>Message: expected:<[[.a > .t { }, .b > .t { }, .c > .t] { }]> but was:<[[my { }, my { }, my] { }]></p> <PRE> </PRE> <h4>Test: HTMLStyleElementTest.innerHtml [FF17]</h4> <p>Type: org.junit.ComparisonFailure</p> <p>Message: expected:<[[.a > .t { }, .b > .t { }, .c > .t] { }]> but was:<[[my { }, my { }, my] { }]></p> <PRE> </PRE> <h4>Test: HTMLStyleElementTest.innerHtml [IE8]</h4> <p>Type: org.junit.ComparisonFailure</p> <p>Message: expected:<[[.a > .t { }, .b > .t { }, .c > .t] { }]> but was:<[[my { }, my { }, my] { }]></p> <PRE> </PRE> <h2>Modifications</h2> <p>3 modifications since last build.</p> <h3>rbri: support for the type property of style elements added (08/25/2013 15:55:14)</h3> <ul> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java</li> <li class="evenrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/changes/changes.xml</li> <li class="oddrow"> <span class="modifificationType">></span> /trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java</li> </ul> </body> </html> |
From: <rb...@us...> - 2013-08-25 15:42:38
|
Revision: 8450 http://sourceforge.net/p/htmlunit/code/8450 Author: rbri Date: 2013-08-25 15:42:34 +0000 (Sun, 25 Aug 2013) Log Message: ----------- support for the 'media' property of style elements added Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-08-25 13:55:14 UTC (rev 8449) +++ trunk/htmlunit/src/changes/changes.xml 2013-08-25 15:42:34 UTC (rev 8450) @@ -9,7 +9,7 @@ <body> <release version="2.13" date="???" description="Bugfixes"> <action type="add" dev="rbri"> - JavaScript: support for the type property of style elements added. + JavaScript: support for the 'type' and 'media' property of style elements added. </action> <action type="fix" dev="rbri" issue="1534"> WebClient.getTopLevelWindows() returns a snapshot of the list of open top level windows. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-08-25 13:55:14 UTC (rev 8449) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-08-25 15:42:34 UTC (rev 8450) @@ -34,6 +34,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Marc Guillemot + * @author Ronald Brill */ @JsxClass(domClasses = HtmlStyle.class) public class HTMLStyleElement extends HTMLElement { @@ -88,4 +89,14 @@ final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); return style.getTypeAttribute(); } + + /** + * Returns the media of this style. + * @return the media + */ + @JsxGetter() + public String getMedia() { + final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); + return style.getAttribute("media"); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java 2013-08-25 13:55:14 UTC (rev 8449) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java 2013-08-25 15:42:34 UTC (rev 8450) @@ -89,9 +89,9 @@ final String html = "<html><head><title>foo</title>\n" - + "<style id='style_none'>my { }</style>\n" - + "<style type='text/test' id='style_text'>my { }</style>\n" - + "<style type='text/html' id='style_html'>my { }</style>\n" + + "<style id='style_none'>.a > .t { }</style>\n" + + "<style type='text/test' id='style_text'>.b > .t { }</style>\n" + + "<style type='text/html' id='style_html'>.c > .t { }</style>\n" + "<script>\n" + "function doTest() {\n" @@ -118,9 +118,9 @@ final String html = "<html><head><title>foo</title>\n" - + "<style id='style_none'>.a > .t { }</style>\n" - + "<style type='text/test' id='style_text'>.b > .t { }</style>\n" - + "<style type='text/css' id='style_css'>.c > .t { }</style>\n" + + "<style id='style_none'>my { }</style>\n" + + "<style type='text/test' id='style_text'>my { }</style>\n" + + "<style type='text/css' id='style_css'>my { }</style>\n" + "<script>\n" + "function doTest() {\n" @@ -137,4 +137,33 @@ loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({ "", "all", "screen, print,test" }) + public void media() throws Exception { + final String html + = "<html><head><title>foo</title>\n" + + + "<style id='style_none'>my { }</style>\n" + + "<style media='all' id='style_all'>my { }</style>\n" + + "<style media='screen, print,test' id='style_some'>my { }</style>\n" + + + "<script>\n" + + "function doTest() {\n" + + " style = document.getElementById('style_none');\n" + + " alert(style.media);\n" + + " style = document.getElementById('style_all');\n" + + " alert(style.media);\n" + + " style = document.getElementById('style_some');\n" + + " alert(style.media);\n" + + "}\n" + + "</script>\n" + + "</head><body onload='doTest()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <rb...@us...> - 2013-08-25 13:55:18
|
Revision: 8449 http://sourceforge.net/p/htmlunit/code/8449 Author: rbri Date: 2013-08-25 13:55:14 +0000 (Sun, 25 Aug 2013) Log Message: ----------- support for the type property of style elements added Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-08-25 13:30:02 UTC (rev 8448) +++ trunk/htmlunit/src/changes/changes.xml 2013-08-25 13:55:14 UTC (rev 8449) @@ -8,8 +8,8 @@ <body> <release version="2.13" date="???" description="Bugfixes"> - <action type="fix" dev="rbri" issue="1535"> - Use the correct separator for headers in the preflight CORS request. + <action type="add" dev="rbri"> + JavaScript: support for the type property of style elements added. </action> <action type="fix" dev="rbri" issue="1534"> WebClient.getTopLevelWindows() returns a snapshot of the list of open top level windows. Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-08-25 13:30:02 UTC (rev 8448) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElement.java 2013-08-25 13:55:14 UTC (rev 8449) @@ -78,4 +78,14 @@ public CSSStyleSheet getStyleSheet() { return getSheet(); } + + /** + * Returns the type of this style. + * @return the type + */ + @JsxGetter() + public String getType() { + final HtmlStyle style = (HtmlStyle) getDomNodeOrDie(); + return style.getTypeAttribute(); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java 2013-08-25 13:30:02 UTC (rev 8448) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLStyleElementTest.java 2013-08-25 13:55:14 UTC (rev 8449) @@ -89,9 +89,9 @@ final String html = "<html><head><title>foo</title>\n" - + "<style id='style_none'>.a > .t { }</style>\n" - + "<style type='text/test' id='style_text'>.b > .t { }</style>\n" - + "<style type='text/html' id='style_html'>.c > .t { }</style>\n" + + "<style id='style_none'>my { }</style>\n" + + "<style type='text/test' id='style_text'>my { }</style>\n" + + "<style type='text/html' id='style_html'>my { }</style>\n" + "<script>\n" + "function doTest() {\n" @@ -108,4 +108,33 @@ loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({ "", "text/test", "text/css" }) + public void type() throws Exception { + final String html + = "<html><head><title>foo</title>\n" + + + "<style id='style_none'>.a > .t { }</style>\n" + + "<style type='text/test' id='style_text'>.b > .t { }</style>\n" + + "<style type='text/css' id='style_css'>.c > .t { }</style>\n" + + + "<script>\n" + + "function doTest() {\n" + + " style = document.getElementById('style_none');\n" + + " alert(style.type);\n" + + " style = document.getElementById('style_text');\n" + + " alert(style.type);\n" + + " style = document.getElementById('style_css');\n" + + " alert(style.type);\n" + + "}\n" + + "</script>\n" + + "</head><body onload='doTest()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: <rb...@us...> - 2013-08-25 13:30:05
|
Revision: 8448 http://sourceforge.net/p/htmlunit/code/8448 Author: rbri Date: 2013-08-25 13:30:02 +0000 (Sun, 25 Aug 2013) Log Message: ----------- use the correct separator for headers in the preflight CORS request Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-08-25 13:29:07 UTC (rev 8447) +++ trunk/htmlunit/src/changes/changes.xml 2013-08-25 13:30:02 UTC (rev 8448) @@ -8,6 +8,9 @@ <body> <release version="2.13" date="???" description="Bugfixes"> + <action type="fix" dev="rbri" issue="1535"> + Use the correct separator for headers in the preflight CORS request. + </action> <action type="fix" dev="rbri" issue="1534"> WebClient.getTopLevelWindows() returns a snapshot of the list of open top level windows. This avoids ConcurrentModificationExceptions when using this list by a client. |
From: <rb...@us...> - 2013-08-25 13:29:11
|
Revision: 8447 http://sourceforge.net/p/htmlunit/code/8447 Author: rbri Date: 2013-08-25 13:29:07 +0000 (Sun, 25 Aug 2013) Log Message: ----------- use the correct separator for headers in the preflight CORS request Issue 1535 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2013-08-25 08:04:14 UTC (rev 8446) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequest.java 2013-08-25 13:29:07 UTC (rev 8447) @@ -106,6 +106,14 @@ /** All the data has been received; the complete data is available in responseBody and responseText. */ public static final int STATE_DONE = 4; + private static final String HEADER_ORIGIN = "Origin"; + private static final char REQUEST_HEADERS_SEPARATOR = ','; + + private static final String HEADER_ACCESS_CONTROL_REQUEST_METHOD = "Access-Control-Request-Method"; + private static final String HEADER_ACCESS_CONTROL_REQUEST_HEADERS = "Access-Control-Request-Headers"; + private static final String HEADER_ACCESS_CONTROL_ALLOW_ORIGIN = "Access-Control-Allow-Origin"; + private static final String HEADER_ACCESS_CONTROL_ALLOW_HEADERS = "Access-Control-Allow-Headers"; + private static final String[] ALL_PROPERTIES_ = {"onreadystatechange", "readyState", "responseText", "responseXML", "status", "statusText", "abort", "getAllResponseHeaders", "getResponseHeader", "open", "send", "setRequestHeader"}; @@ -497,7 +505,7 @@ if (originUrl.getPort() != -1) { origin.append(':').append(originUrl.getPort()); } - request.setAdditionalHeader("Origin", origin.toString()); + request.setAdditionalHeader(HEADER_ORIGIN, origin.toString()); } request.setHttpMethod(HttpMethod.valueOf(method.toUpperCase(Locale.ENGLISH))); @@ -635,24 +643,33 @@ private void doSend(final Context context) { final WebClient wc = getWindow().getWebWindow().getWebClient(); try { - final boolean crossOriginResourceSharing = webRequest_.getAdditionalHeaders().get("Origin") != null; + final String originHeaderValue = webRequest_.getAdditionalHeaders().get(HEADER_ORIGIN); + final boolean crossOriginResourceSharing = originHeaderValue != null; if (crossOriginResourceSharing && isPreflight()) { final WebRequest preflightRequest = new WebRequest(webRequest_.getUrl(), HttpMethod.OPTIONS); - preflightRequest.setAdditionalHeader("Origin", webRequest_.getAdditionalHeaders().get("Origin")); - preflightRequest.setAdditionalHeader("Access-Control-Request-Method", + + // header origin + preflightRequest.setAdditionalHeader(HEADER_ORIGIN, originHeaderValue); + + // header request-method + preflightRequest.setAdditionalHeader( + HEADER_ACCESS_CONTROL_REQUEST_METHOD, webRequest_.getHttpMethod().name()); + + // header request-headers final StringBuilder builder = new StringBuilder(); for (final Entry<String, String> header : webRequest_.getAdditionalHeaders().entrySet()) { final String name = header.getKey().toLowerCase(Locale.ENGLISH); - final String value = header.getValue().toLowerCase(Locale.ENGLISH); - if (isPreflightHeader(name, value)) { + if (isPreflightHeader(name, header.getValue())) { if (builder.length() != 0) { - builder.append(' '); + builder.append(REQUEST_HEADERS_SEPARATOR); } builder.append(name); } } - preflightRequest.setAdditionalHeader("Access-Control-Request-Headers", builder.toString()); + preflightRequest.setAdditionalHeader(HEADER_ACCESS_CONTROL_REQUEST_HEADERS, builder.toString()); + + // do the preflight request final WebResponse preflightResponse = wc.loadWebResponse(preflightRequest); if (!isPreflightAuthorized(preflightResponse)) { setState(STATE_HEADERS_RECEIVED, context); @@ -672,9 +689,8 @@ } boolean allowOriginResponse = true; if (crossOriginResourceSharing) { - final String value = webResponse.getResponseHeaderValue("Access-Control-Allow-Origin"); - allowOriginResponse = "*".equals(value) - || webRequest_.getAdditionalHeaders().get("Origin").equals(value); + final String value = webResponse.getResponseHeaderValue(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN); + allowOriginResponse = "*".equals(value) || originHeaderValue.equals(value); } if (allowOriginResponse) { if (overriddenMimeType_ == null) { @@ -722,7 +738,7 @@ } for (final Entry<String, String> header : webRequest_.getAdditionalHeaders().entrySet()) { if (isPreflightHeader(header.getKey().toLowerCase(Locale.ENGLISH), - header.getValue().toLowerCase(Locale.ENGLISH))) { + header.getValue())) { return true; } } @@ -730,11 +746,11 @@ } private boolean isPreflightAuthorized(final WebResponse preflightResponse) { - final String originHeader = preflightResponse.getResponseHeaderValue("Access-Control-Allow-Origin"); - if (!"*".equals(originHeader) && !webRequest_.getAdditionalHeaders().get("Origin").equals(originHeader)) { + final String originHeader = preflightResponse.getResponseHeaderValue(HEADER_ACCESS_CONTROL_ALLOW_ORIGIN); + if (!"*".equals(originHeader) && !webRequest_.getAdditionalHeaders().get(HEADER_ORIGIN).equals(originHeader)) { return false; } - String headersHeader = preflightResponse.getResponseHeaderValue("Access-Control-Allow-Headers"); + String headersHeader = preflightResponse.getResponseHeaderValue(HEADER_ACCESS_CONTROL_ALLOW_HEADERS); if (headersHeader == null) { headersHeader = ""; } @@ -743,7 +759,7 @@ } for (final Entry<String, String> header : webRequest_.getAdditionalHeaders().entrySet()) { final String key = header.getKey().toLowerCase(Locale.ENGLISH); - if (isPreflightHeader(key, header.getValue().toLowerCase(Locale.ENGLISH)) + if (isPreflightHeader(key, header.getValue()) && !headersHeader.contains(key)) { return false; } @@ -752,15 +768,16 @@ } /** - * @param name header name (MUST be lower-case), for performance reasons - * @param value header value (MUST be lower-case), for performance reasons + * @param name header name (MUST be lower-case for performance reasons) + * @param value header value */ private boolean isPreflightHeader(final String name, final String value) { if ("content-type".equals(name)) { - if ("application/x-www-form-urlencoded".equals(value) - || "multipart/form-data".equals(value) - || "text/plain".equals(value) - || value.startsWith("text/plain;charset=")) { + final String lcValue = value.toLowerCase(Locale.ENGLISH); + if ("application/x-www-form-urlencoded".equals(lcValue) + || "multipart/form-data".equals(lcValue) + || "text/plain".equals(lcValue) + || lcValue.startsWith("text/plain;charset=")) { return false; } return true; Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java 2013-08-25 08:04:14 UTC (rev 8446) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/xml/XMLHttpRequestCORSTest.java 2013-08-25 13:29:07 UTC (rev 8447) @@ -38,6 +38,7 @@ * @version $Revision$ * @author Ahmed Ashour * @author Marc Guillemot + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class XMLHttpRequestCORSTest extends WebDriverTestCase { @@ -328,6 +329,45 @@ * @throws Exception if the test fails. */ @Test + @Alerts(DEFAULT = { "4", "200", "options_headers", "x-ping,x-pong" }, + IE = { "4", "200", "options_headers", "null" }) + public void preflight_many_header_values() throws Exception { + expandExpectedAlertsVariables(new URL("http://localhost:" + PORT)); + + final String html = "<html><head>\n" + + "<script>\n" + + "var xhr = " + XHRInstantiation_ + ";\n" + + "function test() {\n" + + " try {\n" + + " var url = 'http://' + window.location.hostname + ':" + PORT2 + "/preflight2';\n" + + " xhr.open('GET', url, false);\n" + + " xhr.setRequestHeader('X-PING', 'ping');\n" + + " xhr.setRequestHeader('X-PONG', 'pong');\n" + + " xhr.send();\n" + + " } catch(e) { alert('exception') }\n" + + " alert(xhr.readyState);\n" + + " alert(xhr.status);\n" + + " alert(xhr.responseXML.firstChild.childNodes[3].tagName);" + + " alert(xhr.responseXML.firstChild.childNodes[3].firstChild.nodeValue);" + + "}\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'></body></html>"; + + PreflightServerServlet.ACCESS_CONTROL_ALLOW_ORIGIN_ = "http://localhost:" + PORT; + PreflightServerServlet.ACCESS_CONTROL_ALLOW_METHODS_ = "POST, GET, OPTIONS"; + PreflightServerServlet.ACCESS_CONTROL_ALLOW_HEADERS_ = "X-PING, X-PONG"; + final Map<String, Class<? extends Servlet>> servlets2 = new HashMap<String, Class<? extends Servlet>>(); + servlets2.put("/preflight2", PreflightServerServlet.class); + startWebServer2(".", null, servlets2); + + loadPageWithAlerts2(html, new URL(getDefaultUrl(), "/preflight1")); + } + + /** + * @throws Exception if the test fails. + */ + @Test @Alerts({ "4", "200" }) public void withCredentials() throws Exception { testWithCredentials("true"); |
From: <rb...@us...> - 2013-08-25 08:04:18
|
Revision: 8446 http://sourceforge.net/p/htmlunit/code/8446 Author: rbri Date: 2013-08-25 08:04:14 +0000 (Sun, 25 Aug 2013) Log Message: ----------- WebClient.getTopLevelWindows() returns a snapshot of the list of open top level windows. This avoids ConcurrentModificationExceptions when using this list by a client. Issue 1534 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 2013-08-25 07:29:56 UTC (rev 8445) +++ trunk/htmlunit/src/changes/changes.xml 2013-08-25 08:04:14 UTC (rev 8446) @@ -8,6 +8,10 @@ <body> <release version="2.13" date="???" description="Bugfixes"> + <action type="fix" dev="rbri" issue="1534"> + WebClient.getTopLevelWindows() returns a snapshot of the list of open top level windows. + This avoids ConcurrentModificationExceptions when using this list by a client. + </action> <action type="fix" dev="rbri"> In case the server reports an error via http error code, the curretn page content was not replaced with the content of that error page if the error was the result Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-08-25 07:29:56 UTC (rev 8445) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-08-25 08:04:14 UTC (rev 8446) @@ -954,7 +954,7 @@ WebAssert.notNull("name", name); for (final WebWindow webWindow : windows_) { - if (webWindow.getName().equals(name)) { + if (name.equals(webWindow.getName())) { return webWindow; } } @@ -1362,6 +1362,8 @@ /** * Returns an immutable list of open web windows (whether they are top level windows or not). + * This is a snapshot; future changes are not reflected by this list. + * * @return an immutable list of open web windows (whether they are top level windows or not) * @see #getWebWindowByName(String) * @see #getTopLevelWindows() @@ -1386,12 +1388,14 @@ /** * Returns an immutable list of open top level windows. + * This is a snapshot; future changes are not reflected by this list. + * * @return an immutable list of open top level windows * @see #getWebWindowByName(String) * @see #getWebWindows() */ public List<TopLevelWindow> getTopLevelWindows() { - return Collections.unmodifiableList(topLevelWindows_); + return Collections.unmodifiableList(new ArrayList<TopLevelWindow>(topLevelWindows_)); } /** @@ -1701,12 +1705,7 @@ } // NB: this implementation is too simple as a new TopLevelWindow may be opened by // some JS script while we are closing the others - final List<TopLevelWindow> topWindows = new ArrayList<TopLevelWindow>(); - for (final WebWindow window : topLevelWindows_) { - if (window instanceof TopLevelWindow) { - topWindows.add((TopLevelWindow) window); - } - } + final List<TopLevelWindow> topWindows = new ArrayList<TopLevelWindow>(topLevelWindows_); for (final TopLevelWindow topWindow : topWindows) { if (topLevelWindows_.contains(topWindow)) { topWindow.close(); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java 2013-08-25 07:29:56 UTC (rev 8445) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebClientTest.java 2013-08-25 08:04:14 UTC (rev 8446) @@ -82,6 +82,7 @@ * @author Ahmed Ashour * @author Daniel Gredler * @author Sudhan Moghe + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class WebClientTest extends SimpleWebTestCase { @@ -1627,7 +1628,7 @@ @Test public void testUrlEncoding() throws Exception { final URL url = new URL("http://host/x+y\u00E9/a\u00E9 b?c \u00E9 d"); - final HtmlPage page = loadPage(BrowserVersion.FIREFOX_3_6, "<html></html>", new ArrayList<String>(), url); + final HtmlPage page = loadPage(BrowserVersion.FIREFOX_17, "<html></html>", new ArrayList<String>(), url); final WebRequest wrs = page.getWebResponse().getWebRequest(); assertEquals("http://host/x+y%C3%A9/a%C3%A9%20b?c%20%E9%20d", wrs.getUrl()); } @@ -2158,6 +2159,35 @@ } /** + * Test that the result of getTopLevelWindows() is usable without + * getting a ConcurrentModificationException. + * + * @throws Exception if an error occurs + */ + @Test + public void getTopLevelWindowsJSConcurrency() throws Exception { + final String html = "<html><head><title>Toplevel</title></head>\n<body>\n" + + "<script>\n" + + " setInterval(function() {\n" + + " window.open('');\n" + + " }, 10);\n" + + "</script>\n" + + "</body></html>\n"; + + final WebClient client = getWebClientWithMockWebConnection(); + getMockWebConnection().setResponse(URL_FIRST, html); + + client.getPage(URL_FIRST); + final List<TopLevelWindow> windows = client.getTopLevelWindows(); + for (int i = 0; i < 100; i++) { + for (TopLevelWindow window : windows) { + Thread.sleep(13); + window.getName(); + } + } + } + + /** * Regression test for * <a href="http://sourceforge.net/support/tracker.php?aid=2819046>bug 2819046</a>. * |
From: <rb...@us...> - 2013-08-25 07:30:00
|
Revision: 8445 http://sourceforge.net/p/htmlunit/code/8445 Author: rbri Date: 2013-08-25 07:29:56 +0000 (Sun, 25 Aug 2013) Log Message: ----------- minor code optimization Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java 2013-08-07 19:15:32 UTC (rev 8444) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlInput.java 2013-08-25 07:29:56 UTC (rev 8445) @@ -490,10 +490,12 @@ } final ScriptResult scriptResult = htmlElement.fireEvent(Event.TYPE_CHANGE); - if (page.getWebClient().getWebWindows().contains(page.getEnclosingWindow())) { - return page.getEnclosingWindow().getEnclosedPage(); // may be itself or a newly loaded one + if (page.getWebClient().containsWebWindow(page.getEnclosingWindow())) { + // may be itself or a newly loaded one + return page.getEnclosingWindow().getEnclosedPage(); } - else if (scriptResult != null) { + + if (scriptResult != null) { // current window doesn't exist anymore return scriptResult.getNewPage(); } |
From: <rb...@us...> - 2013-08-07 19:15:35
|
Revision: 8444 http://sourceforge.net/p/htmlunit/code/8444 Author: rbri Date: 2013-08-07 19:15:32 +0000 (Wed, 07 Aug 2013) Log Message: ----------- In case the server reports an error via http error code, the curretn page content was not replaced with the content of that error page if the error was the result of a form submit or an anchor click. 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/FailingHttpStatusCodeExceptionTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2013-08-07 16:20:25 UTC (rev 8443) +++ trunk/htmlunit/src/changes/changes.xml 2013-08-07 19:15:32 UTC (rev 8444) @@ -8,6 +8,11 @@ <body> <release version="2.13" date="???" description="Bugfixes"> + <action type="fix" dev="rbri"> + In case the server reports an error via http error code, the curretn page content + was not replaced with the content of that error page if the error was the result + of a form submit or an anchor click. + </action> <action type="fix" dev="mguillem" issue="1481"> JavaScript: added (simple) support for window.postMessage. </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-08-07 16:20:25 UTC (rev 8443) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2013-08-07 19:15:32 UTC (rev 8444) @@ -1968,9 +1968,6 @@ else { try { final WebResponse response = loadWebResponse(request); - // check and report problems if needed - throwFailingHttpStatusCodeExceptionIfNecessary(response); - loadJob = new LoadJob(request, requestingWindow, target, response); } catch (final IOException e) { @@ -2040,6 +2037,9 @@ if (pageBeforeLoad != win.getEnclosedPage()) { updatedWindows.add(win); } + + // check and report problems if needed + throwFailingHttpStatusCodeExceptionIfNecessary(downloadedResponse.response_); } else { LOG.info("No usage of download: " + downloadedResponse); Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeExceptionTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeExceptionTest.java 2013-08-07 16:20:25 UTC (rev 8443) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/FailingHttpStatusCodeExceptionTest.java 2013-08-07 19:15:32 UTC (rev 8444) @@ -19,9 +19,11 @@ import org.apache.commons.lang3.ArrayUtils; import org.apache.http.HttpStatus; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import com.gargoylesoftware.htmlunit.html.HtmlElement; import com.gargoylesoftware.htmlunit.html.HtmlPage; import com.gargoylesoftware.htmlunit.util.NameValuePair; @@ -30,6 +32,7 @@ * * @version $Revision$ * @author Marc Guillemot + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public final class FailingHttpStatusCodeExceptionTest extends SimpleWebTestCase { @@ -55,20 +58,62 @@ /** * @throws Exception if the test fails */ - @Test(expected = FailingHttpStatusCodeException.class) + @Test public void failureByGetPage() throws Exception { - getMockWebConnection().setDefaultResponse("", 404, "Not Found", "text/html"); - getWebClientWithMockWebConnection().getPage(getDefaultUrl()); + getMockWebConnection().setDefaultResponse("Error: not found", 404, "Not Found", "text/html"); + final WebClient client = getWebClientWithMockWebConnection(); + try { + client.getPage(getDefaultUrl()); + Assert.fail("FailingHttpStatusCodeException expected"); + } + catch (final FailingHttpStatusCodeException e) { + // expected + } + assertEquals("Error: not found", + client.getCurrentWindow().getEnclosedPage().getWebResponse().getContentAsString()); } /** * @throws Exception if the test fails */ - @Test(expected = FailingHttpStatusCodeException.class) + @Test public void failureByClickLink() throws Exception { final String html = "<html><body><a href='doesntExist'>go</a></body></html>"; - getMockWebConnection().setDefaultResponse("", 404, "Not Found", "text/html"); - final HtmlPage page = loadPageWithAlerts(html); - page.getAnchors().get(0).click(); + getMockWebConnection().setDefaultResponse("Error: not found", 404, "Not Found", "text/html"); + + final WebClient client = getWebClientWithMockWebConnection(); + try { + final HtmlPage page = loadPageWithAlerts(html); + page.getAnchors().get(0).click(); + } + catch (final FailingHttpStatusCodeException e) { + // expected + } + assertEquals("Error: not found", + client.getCurrentWindow().getEnclosedPage().getWebResponse().getContentAsString()); } + + /** + * @throws Exception if the test fails + */ + @Test + public void failureBySubmit() throws Exception { + final String html = "<html><body>\n" + + "<form name='form1' method='get' action='foo.html'>\n" + + " <input name='button' type='submit' id='mySubmit'/>\n" + + "</form>\n" + + "</body></html>"; + getMockWebConnection().setDefaultResponse("Error: not found", 404, "Not Found", "text/html"); + + final WebClient client = getWebClientWithMockWebConnection(); + try { + final HtmlPage page = loadPageWithAlerts(html); + ((HtmlElement) page.getElementById("mySubmit")).click(); + } + catch (final FailingHttpStatusCodeException e) { + // expected + } + assertEquals("Error: not found", + client.getCurrentWindow().getEnclosedPage().getWebResponse().getContentAsString()); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java 2013-08-07 16:20:25 UTC (rev 8443) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/NoHttpResponseTest.java 2013-08-07 19:15:32 UTC (rev 8444) @@ -26,7 +26,6 @@ import java.nio.CharBuffer; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.junit.Test; @@ -50,9 +49,9 @@ public class NoHttpResponseTest { private static final String html = "<html><body><script>\n" - + "function fillField(){\n" - + " document.forms.loginform.textfield.value = 'new value';\n" - + "}\n" + + " function fillField(){\n" + + " document.forms.loginform.textfield.value = 'new value';\n" + + " }\n" + "</script>\n" + "<form name='loginform' action='page2' method='get'>\n" + " <input type='text' name='textfield' value='' />\n" @@ -115,9 +114,6 @@ final HtmlPage page = getWebClient().getPage(getDefaultUrl()); ((HtmlElement) page.getElementById("loginButton")).click(); } - catch (final Exception e) { - throw ExceptionUtils.getRootCause(e); - } finally { miniServer.shutDown(); } |