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: RBRi <rb...@us...> - 2018-08-10 06:18:11
|
- **status**: pending --> accepted - **Comment**: ok, now i got your point - will have a look if i can fix this --- ** [bugs:#1968] Function.prototype.toString shall return actual source code** **Status:** accepted **Group:** 2.31 **Created:** Sun Jun 17, 2018 11:49 AM UTC by Alex **Last Updated:** Sun Jul 22, 2018 05:38 PM UTC **Owner:** RBRi Some scripts make use of Function.prototype.toString and rely on it beeing the original source code especially newlines. This is due to some pattern matching done later via regexp. This breaks with the unparsing/decompiling that HTMLUNIT does. I therefore propose to store the original JS source and directly return it. This is the same as browsers do. Example: https://bugzilla.mozilla.org/show_bug.cgi?id=761723 --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-10 06:17:09
|
Strange, not sure why this API returns a list (internally we use Sets - means there is no order at all). Will have a look, maybe we will stay with lists for this and preserve the order internally (and document it :-) --- ** [bugs:#1979] WebClient.getTopLevelWindows() wrongly ordered, probably** **Status:** accepted **Group:** Latest SVN **Created:** Thu Aug 02, 2018 07:17 AM UTC by Atsushi Nakagawa **Last Updated:** Thu Aug 02, 2018 10:18 AM UTC **Owner:** RBRi ### Problem in brief Prior to around 2.30, `WebClient.getTopLevelWindows()` was FIFO (i.e. oldest window first), and was in line with `WebClient.getWebWindows()` which is also FIFO. Now, `WebClient.getTopLevelWindows()` is reversed and is the opposite of `WebClient.getWebWindows()`. This change is probably an inadvertent resulting from [r15202](https://sourceforge.net/p/htmlunit/code/15202/#diff-2). ### Possible fix Below is the code we're using locally since changing the spec will break code compatibility. N.B.: r15202 [also changed the order of window close in `WebClient.close()`](https://sourceforge.net/p/htmlunit/code/15202/tree/trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java#l1880) but I think that might've been for the better so I've left that one as is. ```diff --- a/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java +++ b/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java @@ -1535,7 +1535,9 @@ public boolean containsWebWindow(final WebWindow webWindow) { * @see #getWebWindows() */ public List<TopLevelWindow> getTopLevelWindows() { - return Collections.unmodifiableList(new ArrayList<>(topLevelWindows_)); + List<TopLevelWindow> l = new ArrayList<>(topLevelWindows_.size()); + topLevelWindows_.descendingIterator().forEachRemaining(l::add); + return Collections.unmodifiableList(l); } /** ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-08-10 06:12:04
|
Revision: 15513 http://sourceforge.net/p/htmlunit/code/15513 Author: rbri Date: 2018-08-10 06:12:02 +0000 (Fri, 10 Aug 2018) Log Message: ----------- switch to the latest core-js docuement last fix Modified Paths: -------------- trunk/htmlunit/pom.xml trunk/htmlunit/src/changes/changes.xml Modified: trunk/htmlunit/pom.xml =================================================================== --- trunk/htmlunit/pom.xml 2018-08-09 19:39:03 UTC (rev 15512) +++ trunk/htmlunit/pom.xml 2018-08-10 06:12:02 UTC (rev 15513) @@ -859,7 +859,7 @@ <dependency> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit-core-js</artifactId> - <version>2.32</version> + <version>2.33-SNAPSHOT</version> </dependency> <dependency> <groupId>net.sourceforge.htmlunit</groupId> Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2018-08-09 19:39:03 UTC (rev 15512) +++ trunk/htmlunit/src/changes/changes.xml 2018-08-10 06:12:02 UTC (rev 15513) @@ -8,6 +8,12 @@ <body> <release version="2.33" date="xxxx, 2018" description="Bugfixes"> + <action type="fix" dev="rbri" issue="1980" due-to="Atsushi Nakagawa"> + Improved support for javascript named function expressions. + </action> + <action type="fix" dev="rbri" issue="1982" due-to="Steve Harney"> + DomNodeIterator no longer traverses uncles of root node. + </action> <action type="fix" dev="rbri" issue="1978" due-to="Atsushi Nakagawa"> Add missing default delegating methods getContentLength(), cleanUp(), and defaultCharsetUtf8() to WebResponseWrapper. |
From: RBRi <rb...@us...> - 2018-08-10 06:11:22
|
BTW: will inform on twitter if a new SNASPHOT build is available --- ** [bugs:#1980] [corejs] Quirky handling of named function expression** **Status:** closed **Group:** Latest SVN **Created:** Sun Aug 05, 2018 12:28 PM UTC by Atsushi Nakagawa **Last Updated:** Fri Aug 10, 2018 06:10 AM UTC **Owner:** RBRi **Attachments:** - [test1.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test1.html) (194 Bytes; text/html) - [test2.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test2.html) (275 Bytes; text/html) - [test3.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test3.html) (227 Bytes; text/html) - [test4.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test4.html) (182 Bytes; text/html) - [test5.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test5.html) (1.2 kB; text/html) Attached are five tests for testing various aspects of **[named function expressions](https://stackoverflow.com/questions/15336347)** in htmlunit. As at 2.32, support for them are *quirky*, leading to subtly misinterpreted JS that are hard to debug. For example, the following code from `test1.html` incorrectly throws a `ScriptException: ReferenceError: Assignment to undefined "abc" in strict mode` on the second line. ```javascript 'use strict'; var abc = 1; var foo = function abc() {} ``` This code from `test2.html` should print `a` followed by `b`. Instead `b` is printed twice. (Unfortunatley, code like this is all too common for minimized scripts.) ```javascript var a = function () { var x = (function x () { console.log("a") }) return function () { x() } }() var b = function () { var x = (function x () { console.log("b") }) return function () { x() } }() a() b() ``` ### Test cases Five tests `test1.html` to `test5.html` are attached. Expectations are as follows: `test1.html`: ```java final String[] expected = { "INFO: outer abc = 1.0", "INFO: inner abc = (function abc() { console.log(\"inner abc = \", abc); })", }; ``` `test2.html`: ```java final String[] expected = { "INFO: a", "INFO: b", }; ``` `test3.html`: ```java final String[] expected = { "INFO: a", }; ``` `test4.html`: ```java final String[] expected = { "INFO: (function func() { console.log(func); })", "INFO: outer", }; ``` `test5.html`: ```java final String[] expected = { "INFO: f1", "INFO: f2", "INFO: f3", "INFO: !f4", "INFO: f5", "INFO: !f6", "INFO: !f7", "INFO: !f8", "INFO: f10", "INFO: f11", "INFO: f12", "INFO: f10", // Chrome/FF: !f10 "INFO: f11", "INFO: f12", "INFO: f13", }; ``` ### Possible fix While rhino far surpasses my coding ability, asashour [seems to have](https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/afadfd48770eace84c70f503efef66c5767c9a3b) already added the [necessary building block](https://github.com/HtmlUnit/htmlunit-rhino-fork/blob/e7ce0f761305d876f99a323a27214f064c5fb4f3/src/org/mozilla/javascript/InterpreterData.java#L98) for this. The following is the code I'm using to further this for a fix: ```diff --- a/src/main/java/net/sourceforge/htmlunit/corejs/javascript/CodeGenerator.java +++ b/src/main/java/net/sourceforge/htmlunit/corejs/javascript/CodeGenerator.java @@ -6,12 +6,12 @@ package net.sourceforge.htmlunit.corejs.javascript; -import net.sourceforge.htmlunit.corejs.javascript.ast.AstNode; -import net.sourceforge.htmlunit.corejs.javascript.ast.FunctionCall; +import net.sourceforge.htmlunit.corejs.javascript.ast.AstRoot; +import net.sourceforge.htmlunit.corejs.javascript.ast.Block; import net.sourceforge.htmlunit.corejs.javascript.ast.FunctionNode; import net.sourceforge.htmlunit.corejs.javascript.ast.Jump; +import net.sourceforge.htmlunit.corejs.javascript.ast.Scope; import net.sourceforge.htmlunit.corejs.javascript.ast.ScriptNode; -import net.sourceforge.htmlunit.corejs.javascript.ast.UnaryExpression; import net.sourceforge.htmlunit.corejs.javascript.ast.VariableInitializer; /** @@ -197,11 +197,10 @@ private void generateNestedFunctions() gen.itsData = new InterpreterData(itsData); gen.generateFunctionICode(); array[i] = gen.itsData; - if (fn.getParent() instanceof FunctionCall) { - AstNode grandParent = fn.getParent().getParent(); - if (grandParent instanceof UnaryExpression && grandParent.getType() == Token.NOT) { - gen.itsData.declaredAsFunctionExpression = true; - } + if (!(fn.getParent() instanceof AstRoot || + fn.getParent() instanceof Scope || + fn.getParent() instanceof Block)) { + gen.itsData.declaredAsFunctionExpression = true; } } itsData.itsNestedFunctions = array; ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-10 06:10:33
|
- **status**: accepted --> closed - **Comment**: Many, many thanks for all the details. Have aplied your suggested fix and it seem to work fine. Waiting for more reports (and will try to work on your remaining stuff soon). Again thanks RBRi --- ** [bugs:#1980] [corejs] Quirky handling of named function expression** **Status:** closed **Group:** Latest SVN **Created:** Sun Aug 05, 2018 12:28 PM UTC by Atsushi Nakagawa **Last Updated:** Sun Aug 05, 2018 05:07 PM UTC **Owner:** RBRi **Attachments:** - [test1.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test1.html) (194 Bytes; text/html) - [test2.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test2.html) (275 Bytes; text/html) - [test3.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test3.html) (227 Bytes; text/html) - [test4.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test4.html) (182 Bytes; text/html) - [test5.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test5.html) (1.2 kB; text/html) Attached are five tests for testing various aspects of **[named function expressions](https://stackoverflow.com/questions/15336347)** in htmlunit. As at 2.32, support for them are *quirky*, leading to subtly misinterpreted JS that are hard to debug. For example, the following code from `test1.html` incorrectly throws a `ScriptException: ReferenceError: Assignment to undefined "abc" in strict mode` on the second line. ```javascript 'use strict'; var abc = 1; var foo = function abc() {} ``` This code from `test2.html` should print `a` followed by `b`. Instead `b` is printed twice. (Unfortunatley, code like this is all too common for minimized scripts.) ```javascript var a = function () { var x = (function x () { console.log("a") }) return function () { x() } }() var b = function () { var x = (function x () { console.log("b") }) return function () { x() } }() a() b() ``` ### Test cases Five tests `test1.html` to `test5.html` are attached. Expectations are as follows: `test1.html`: ```java final String[] expected = { "INFO: outer abc = 1.0", "INFO: inner abc = (function abc() { console.log(\"inner abc = \", abc); })", }; ``` `test2.html`: ```java final String[] expected = { "INFO: a", "INFO: b", }; ``` `test3.html`: ```java final String[] expected = { "INFO: a", }; ``` `test4.html`: ```java final String[] expected = { "INFO: (function func() { console.log(func); })", "INFO: outer", }; ``` `test5.html`: ```java final String[] expected = { "INFO: f1", "INFO: f2", "INFO: f3", "INFO: !f4", "INFO: f5", "INFO: !f6", "INFO: !f7", "INFO: !f8", "INFO: f10", "INFO: f11", "INFO: f12", "INFO: f10", // Chrome/FF: !f10 "INFO: f11", "INFO: f12", "INFO: f13", }; ``` ### Possible fix While rhino far surpasses my coding ability, asashour [seems to have](https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/afadfd48770eace84c70f503efef66c5767c9a3b) already added the [necessary building block](https://github.com/HtmlUnit/htmlunit-rhino-fork/blob/e7ce0f761305d876f99a323a27214f064c5fb4f3/src/org/mozilla/javascript/InterpreterData.java#L98) for this. The following is the code I'm using to further this for a fix: ```diff --- a/src/main/java/net/sourceforge/htmlunit/corejs/javascript/CodeGenerator.java +++ b/src/main/java/net/sourceforge/htmlunit/corejs/javascript/CodeGenerator.java @@ -6,12 +6,12 @@ package net.sourceforge.htmlunit.corejs.javascript; -import net.sourceforge.htmlunit.corejs.javascript.ast.AstNode; -import net.sourceforge.htmlunit.corejs.javascript.ast.FunctionCall; +import net.sourceforge.htmlunit.corejs.javascript.ast.AstRoot; +import net.sourceforge.htmlunit.corejs.javascript.ast.Block; import net.sourceforge.htmlunit.corejs.javascript.ast.FunctionNode; import net.sourceforge.htmlunit.corejs.javascript.ast.Jump; +import net.sourceforge.htmlunit.corejs.javascript.ast.Scope; import net.sourceforge.htmlunit.corejs.javascript.ast.ScriptNode; -import net.sourceforge.htmlunit.corejs.javascript.ast.UnaryExpression; import net.sourceforge.htmlunit.corejs.javascript.ast.VariableInitializer; /** @@ -197,11 +197,10 @@ private void generateNestedFunctions() gen.itsData = new InterpreterData(itsData); gen.generateFunctionICode(); array[i] = gen.itsData; - if (fn.getParent() instanceof FunctionCall) { - AstNode grandParent = fn.getParent().getParent(); - if (grandParent instanceof UnaryExpression && grandParent.getType() == Token.NOT) { - gen.itsData.declaredAsFunctionExpression = true; - } + if (!(fn.getParent() instanceof AstRoot || + fn.getParent() instanceof Scope || + fn.getParent() instanceof Block)) { + gen.itsData.declaredAsFunctionExpression = true; } } itsData.itsNestedFunctions = array; ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-09 19:46:34
|
- Description has changed: Diff: ~~~~ --- old +++ new @@ -3,6 +3,7 @@ I have attached an example. in this example i am searching a table from the td id='11' . I suspect the issue is in th DomeNodeIterator.getFirstUncle, i *believe* this + final DomNode parent = node.getParentNode(); if (parent == null) { return null; ~~~~ --- ** [bugs:#1982] DomNodeIterator traverses Uncles of root** **Status:** closed **Group:** 2.32 **Created:** Thu Aug 09, 2018 04:42 AM UTC by Steve Harney **Last Updated:** Thu Aug 09, 2018 07:46 PM UTC **Owner:** RBRi **Attachments:** - [DocumentTraversalBug.java](https://sourceforge.net/p/htmlunit/bugs/1982/attachment/DocumentTraversalBug.java) (2.4 kB; application/octet-stream) I have been working with a wrapper around htmlunit ( 2.32) it appears that the Document traversal is failng to stop at the root node during its back tracking. there appears to be no check to see if the I have attached an example. in this example i am searching a table from the td id='11' . I suspect the issue is in th DomeNodeIterator.getFirstUncle, i *believe* this final DomNode parent = node.getParentNode(); if (parent == null) { return null; } should read final DomNode parent = node.getParentNode(); if (parent == null || parent == root) { return null; } Steve --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-09 19:46:05
|
- **status**: accepted --> closed --- ** [bugs:#1982] DomNodeIterator traverses Uncles of root** **Status:** closed **Group:** 2.32 **Created:** Thu Aug 09, 2018 04:42 AM UTC by Steve Harney **Last Updated:** Thu Aug 09, 2018 07:45 PM UTC **Owner:** RBRi **Attachments:** - [DocumentTraversalBug.java](https://sourceforge.net/p/htmlunit/bugs/1982/attachment/DocumentTraversalBug.java) (2.4 kB; application/octet-stream) I have been working with a wrapper around htmlunit ( 2.32) it appears that the Document traversal is failng to stop at the root node during its back tracking. there appears to be no check to see if the I have attached an example. in this example i am searching a table from the td id='11' . I suspect the issue is in th DomeNodeIterator.getFirstUncle, i *believe* this final DomNode parent = node.getParentNode(); if (parent == null) { return null; } should read final DomNode parent = node.getParentNode(); if (parent == null || parent == root) { return null; } Steve --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-09 19:45:44
|
Fixed in SVN, thanks for the report. --- ** [bugs:#1982] DomNodeIterator traverses Uncles of root** **Status:** accepted **Group:** 2.32 **Created:** Thu Aug 09, 2018 04:42 AM UTC by Steve Harney **Last Updated:** Thu Aug 09, 2018 06:39 PM UTC **Owner:** RBRi **Attachments:** - [DocumentTraversalBug.java](https://sourceforge.net/p/htmlunit/bugs/1982/attachment/DocumentTraversalBug.java) (2.4 kB; application/octet-stream) I have been working with a wrapper around htmlunit ( 2.32) it appears that the Document traversal is failng to stop at the root node during its back tracking. there appears to be no check to see if the I have attached an example. in this example i am searching a table from the td id='11' . I suspect the issue is in th DomeNodeIterator.getFirstUncle, i *believe* this final DomNode parent = node.getParentNode(); if (parent == null) { return null; } should read final DomNode parent = node.getParentNode(); if (parent == null || parent == root) { return null; } Steve --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-08-09 19:39:08
|
Revision: 15512 http://sourceforge.net/p/htmlunit/code/15512 Author: rbri Date: 2018-08-09 19:39:03 +0000 (Thu, 09 Aug 2018) Log Message: ----------- fix DomNodeIterator traverses uncles of (sub)root Issue 1982 Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeIteratorTest.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeIteratorTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java 2018-08-05 17:08:38 UTC (rev 15511) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomNodeIterator.java 2018-08-09 19:39:03 UTC (rev 15512) @@ -191,12 +191,12 @@ * traversal) from the given node. */ private DomNode getFirstUncleNode(final DomNode node) { - if (node == root_ || node == null) { + if (node == null || node == root_) { return null; } final DomNode parent = node.getParentNode(); - if (parent == null) { + if (parent == null || parent == root_) { return null; } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeIteratorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeIteratorTest.java 2018-08-05 17:08:38 UTC (rev 15511) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/DomNodeIteratorTest.java 2018-08-09 19:39:03 UTC (rev 15512) @@ -17,10 +17,12 @@ import static org.hamcrest.CoreMatchers.instanceOf; import static org.junit.Assert.assertThat; +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.openqa.selenium.WebDriver; import org.openqa.selenium.htmlunit.HtmlUnitDriver; +import org.w3c.dom.traversal.NodeFilter; import org.w3c.dom.traversal.NodeIterator; import com.gargoylesoftware.htmlunit.BrowserRunner; @@ -31,6 +33,7 @@ * Tests for {@link DomNodeIterator}. * * @author Ahmed Ashour + * @author Ronald Brill */ @RunWith(BrowserRunner.class) public final class DomNodeIteratorTest extends WebDriverTestCase { @@ -55,10 +58,51 @@ if (driver instanceof HtmlUnitDriver) { final WebWindow webWindow = getWebWindowOf((HtmlUnitDriver) driver); final HtmlPage page = (HtmlPage) webWindow.getEnclosedPage(); - final NodeIterator iterator = page.createNodeIterator(page.getDocumentElement(), - org.w3c.dom.traversal.NodeFilter.SHOW_ALL, null, + final NodeIterator iterator = page.createNodeIterator(page.getDocumentElement(), NodeFilter.SHOW_ALL, null, true); assertThat(iterator.nextNode(), instanceOf(HtmlHtml.class)); } } + + /** + * Test case for issue 1982. + * @throws Exception if the test fails + */ + @Test + public void subroot() throws Exception { + final String html + = "<html>\n" + + "<head>\n" + + "</head>\n" + + "<body>\n" + + "<table>\n" + + " <tr id='1'>\n" + + " <td id='11'>11</td>\n" + + " <td id='12'>12</td>\n" + + " </tr>\n" + + " <tr id='2'>\n" + + " <td id='21'>21</td>\n" + + " <td id='22'>22</td>\n" + + " </tr>\n" + + "</table>\n" + + "</body></html>"; + + final WebDriver driver = loadPage2(html); + final WebWindow webWindow = getWebWindowOf((HtmlUnitDriver) driver); + final HtmlPage page = (HtmlPage) webWindow.getEnclosedPage(); + + final HtmlElement subroot = (HtmlElement) page.getElementById("1"); + final NodeIterator iterator = page.createNodeIterator(subroot, NodeFilter.SHOW_ELEMENT, null, true); + + HtmlElement element = (HtmlElement) iterator.nextNode(); + Assert.assertEquals("1", element.getId()); + + element = (HtmlElement) iterator.nextNode(); + Assert.assertEquals("11", element.getId()); + + element = (HtmlElement) iterator.nextNode(); + Assert.assertEquals("12", element.getId()); + + Assert.assertNull(iterator.nextNode()); + } } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeIteratorTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeIteratorTest.java 2018-08-05 17:08:38 UTC (rev 15511) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/dom/NodeIteratorTest.java 2018-08-09 19:39:03 UTC (rev 15512) @@ -135,4 +135,47 @@ loadPageWithAlerts2(html); } + + /** + * Test case for issue 1982. + * @throws Exception if the test fails + */ + @Test + @Alerts({"1", "11", "12"}) + public void subroot() throws Exception { + final String html + = "<html>\n" + + "<head>\n" + + " <script>\n" + + " function test() {\n" + + " if (document.createNodeIterator) {\n" + + " var nodeIterator = document.createNodeIterator(\n" + + " document.getElementById('1'),\n" + + " NodeFilter.SHOW_ELEMENT );\n" + + + " var currentNode;\n" + + " while (currentNode = nodeIterator.nextNode()) {\n" + + " alert(currentNode.id);\n" + + " }\n" + + " }\n" + + " }\n" + + " </script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "<div id='before'>before</div>\n" + + "<table>\n" + + " <tr id='1'>\n" + + " <td id='11'>11</td>\n" + + " <td id='12'>12</td>\n" + + " </tr>\n" + + " <tr id='2'>\n" + + " <td id='21'>21</td>\n" + + " <td id='22'>22</td>\n" + + " </tr>\n" + + "</table>\n" + + "<div id='after'>after</div>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: rbri <rb...@rb...> - 2018-08-09 18:56:15
|
Branch: refs/heads/master Home: https://github.com/HtmlUnit/htmlunit-rhino-fork Commit: 49c599c6fa0e8026faa25e8f7346131d403455d6 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/49c599c6fa0e8026faa25e8f7346131d403455d6 Author: rbri <rb...@rb...> Date: 2018-08-02 (Thu, 02 Aug 2018) Changed paths: M src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java A testsrc/org/mozilla/javascript/tests/NativeArrayBufferTest.java Log Message: ----------- fix issue 437 Commit: c06fac499d813aaf6d2830045d33612d5033f323 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/c06fac499d813aaf6d2830045d33612d5033f323 Author: rbri <rb...@rb...> Date: 2018-08-02 (Thu, 02 Aug 2018) Changed paths: M toolsrc/org/mozilla/javascript/tools/idswitch/CodePrinter.java Log Message: ----------- use the system line separator for code generation Commit: cc7b77c6cf3bc5ff492bce7a89f662e1d9dd38b9 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/cc7b77c6cf3bc5ff492bce7a89f662e1d9dd38b9 Author: rbri <rb...@rb...> Date: 2018-08-02 (Thu, 02 Aug 2018) Changed paths: M src/org/mozilla/javascript/EqualObjectGraphs.java Log Message: ----------- remove work around for 437 Commit: 2f5b476b345b55d35e11c766add6956b67401285 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/2f5b476b345b55d35e11c766add6956b67401285 Author: rbri <rb...@rb...> Date: 2018-08-02 (Thu, 02 Aug 2018) Changed paths: M src/org/mozilla/javascript/EqualObjectGraphs.java M src/org/mozilla/javascript/typedarrays/NativeArrayBufferView.java M src/org/mozilla/javascript/typedarrays/NativeTypedArrayView.java M testsrc/org/mozilla/javascript/tests/harmony/TypedArrayJavaTest.java Log Message: ----------- fix #449 also and remove the work around from EqualObjectGraphs Commit: a5d9553b50f583e1023220819e584fa63e57d7e7 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/a5d9553b50f583e1023220819e584fa63e57d7e7 Author: RBRi <rb...@rb...> Date: 2018-08-08 (Wed, 08 Aug 2018) Changed paths: M src/org/mozilla/javascript/NativeArray.java M src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java M testsrc/org/mozilla/javascript/tests/NativeArrayTest.java M testsrc/test262.properties Log Message: ----------- Array fixes (#467) Fixes for Array implementation: * fix ctor parameter check * fix argument range checks * some length fixes Commit: a47c25b9c4a411fb3ad5c2776a44f4ce50c71324 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/a47c25b9c4a411fb3ad5c2776a44f4ce50c71324 Author: rbri <rb...@rb...> Date: 2018-08-09 (Thu, 09 Aug 2018) Changed paths: M src/org/mozilla/javascript/NativeArray.java M src/org/mozilla/javascript/typedarrays/NativeArrayBuffer.java M testsrc/org/mozilla/javascript/tests/NativeArrayTest.java M testsrc/test262.properties Log Message: ----------- Merge remote-tracking branch 'upstream/master' Compare: https://github.com/HtmlUnit/htmlunit-rhino-fork/compare/885a9b333172...a47c25b9c4a4 **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019. |
From: rbri <rb...@rb...> - 2018-08-09 18:45:54
|
Branch: refs/heads/master Home: https://github.com/HtmlUnit/htmlunit-rhino-fork Commit: 885a9b333172a215e9852d141a201f1e07847e25 https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/885a9b333172a215e9852d141a201f1e07847e25 Author: rbri <rb...@rb...> Date: 2018-08-09 (Thu, 09 Aug 2018) Changed paths: M src/org/mozilla/javascript/CodeGenerator.java Log Message: ----------- fix HtmlUnit issue 1980 **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/ Functionality will be removed from GitHub.com on January 31st, 2019. |
From: RBRi <rb...@us...> - 2018-08-09 18:39:23
|
- **status**: open --> accepted - **assigned_to**: RBRi --- ** [bugs:#1982] DomNodeIterator traverses Uncles of root** **Status:** accepted **Group:** 2.32 **Created:** Thu Aug 09, 2018 04:42 AM UTC by Steve Harney **Last Updated:** Thu Aug 09, 2018 04:42 AM UTC **Owner:** RBRi **Attachments:** - [DocumentTraversalBug.java](https://sourceforge.net/p/htmlunit/bugs/1982/attachment/DocumentTraversalBug.java) (2.4 kB; application/octet-stream) I have been working with a wrapper around htmlunit ( 2.32) it appears that the Document traversal is failng to stop at the root node during its back tracking. there appears to be no check to see if the I have attached an example. in this example i am searching a table from the td id='11' . I suspect the issue is in th DomeNodeIterator.getFirstUncle, i *believe* this final DomNode parent = node.getParentNode(); if (parent == null) { return null; } should read final DomNode parent = node.getParentNode(); if (parent == null || parent == root) { return null; } Steve --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-08-05 17:08:40
|
Revision: 15511 http://sourceforge.net/p/htmlunit/code/15511 Author: rbri Date: 2018-08-05 17:08:38 +0000 (Sun, 05 Aug 2018) Log Message: ----------- test cases for #1980 Issue 1980 Modified Paths: -------------- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java 2018-08-03 18:37:34 UTC (rev 15510) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine2Test.java 2018-08-05 17:08:38 UTC (rev 15511) @@ -716,4 +716,163 @@ loadPageWithAlerts2(html); } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"outer abc = 1", "inner abc = function abc() { alert('inner abc = ' + abc); }"}) + @NotYetImplemented + public void functionHasNameOfVarStrictMode() throws Exception { + final String html = "<html><head>\n" + + "<script>\n" + + " 'use strict';\n" + + " var abc = 1;\n" + + " var foo = function abc() { alert('inner abc = ' + abc); }\n" + + " alert('outer abc = ' + abc);\n" + + " foo()\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"a", "b"}) + @NotYetImplemented + public void innerFunctionWithSameName() throws Exception { + final String html = "<html><head>\n" + + "<script>\n" + + " var a = function () {\n" + + " var x = (function x () { alert('a') });\n" + + " return function () { x() };\n" + + " }();\n" + + + " var b = function () {\n" + + " var x = (function x () { alert('b') });\n" + + " return function () { x() };\n" + + " }();\n" + + + " a();\n" + + " b();\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts("a") + @NotYetImplemented + public void innerFunctionWithSameNameAsOutsideStrict() throws Exception { + final String html = "<html><head>\n" + + "<script>\n" + + " 'use strict';\n" + + " var a = function () {\n" + + " var x = (function x () { alert('a') });\n" + + " return function () { x() };\n" + + " }();\n" + + + " var x = function () { alert('x') };\n" + + + " a();\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"function func() { alert(func); }", "outer"}) + @NotYetImplemented + public void secondFunctionWithSameNameStrict() throws Exception { + final String html = "<html><head>\n" + + "<script>\n" + + " 'use strict';\n" + + " function func () { alert('outer'); }\n" + + + " var x = function func() { alert(func); }\n" + + + " x();\n" + + " func();\n" + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if the test fails + */ + @Test + @Alerts({"f1", "f2", "f3", "!f4", "f5", "!f6", "!f7", "!f8", "f10", "f11", "f12", "!f10", "f11", "f12", "f13"}) + @NotYetImplemented + public void functioNamesExceptionsStrict() throws Exception { + final String html = "<html><head>\n" + + "<script>\n" + + " 'use strict';\n" + + + " function f1() {" + + " alert('f1');" + + " function f9() { alert('f9'); }" + + " }\n" + + + " var f2 = function () { alert('f2'); }\n" + + " var f3 = function f4() { alert('f3'); }\n" + + " var f5 = function f5() { alert('f5'); }\n" + + + " !function f6() { alert('f6'); };\n" + + " (function f7() { alert('f7'); });\n" + + + " void function f8() { alert('f8'); }\n" + + + " try { f1() } catch (e) { alert('!f1'); }" + + " try { f2() } catch (e) { alert('!f2'); }" + + " try { f3() } catch (e) { alert('!f3'); }" + + " try { f4() } catch (e) { alert('!f4'); }" + + " try { f5() } catch (e) { alert('!f5'); }" + + " try { f6() } catch (e) { alert('!f6'); }" + + " try { f7() } catch (e) { alert('!f7'); }" + + " try { f8() } catch (e) { alert('!f8'); }" + + + " {\n" + + " function f10() { alert('f10'); }\n" + + " var f11 = function () { alert('f11'); }\n" + + " var f12 = function f12() { alert('f12'); }\n" + + " f10();\n" + + " f11();\n" + + " f12();\n" + + " }\n" + + + " try { f10() } catch (e) { alert('!f10'); }" + + " try { f11() } catch (e) { alert('!f11'); }" + + " try { f12() } catch (e) { alert('!f12'); }" + + + " function f13() { alert('f13') } + 1;" + + " try { f13() } catch (e) { alert('!f13'); }" + + + "</script>\n" + + "</head>\n" + + "<body onload='test()'>\n" + + "</body></html>"; + + loadPageWithAlerts2(html); + } } |
From: RBRi <rb...@us...> - 2018-08-05 17:07:18
|
- **status**: open --> accepted - **assigned_to**: RBRi - **Comment**: Looks promising, will work on this.... --- ** [bugs:#1980] [corejs] Quirky handling of named function expression** **Status:** accepted **Group:** Latest SVN **Created:** Sun Aug 05, 2018 12:28 PM UTC by Atsushi Nakagawa **Last Updated:** Sun Aug 05, 2018 12:28 PM UTC **Owner:** RBRi **Attachments:** - [test1.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test1.html) (194 Bytes; text/html) - [test2.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test2.html) (275 Bytes; text/html) - [test3.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test3.html) (227 Bytes; text/html) - [test4.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test4.html) (182 Bytes; text/html) - [test5.html](https://sourceforge.net/p/htmlunit/bugs/1980/attachment/test5.html) (1.2 kB; text/html) Attached are five tests for testing various aspects of **[named function expressions](https://stackoverflow.com/questions/15336347)** in htmlunit. As at 2.32, support for them are *quirky*, leading to subtly misinterpreted JS that are hard to debug. For example, the following code from `test1.html` incorrectly throws a `ScriptException: ReferenceError: Assignment to undefined "abc" in strict mode` on the second line. ```javascript 'use strict'; var abc = 1; var foo = function abc() {} ``` This code from `test2.html` should print `a` followed by `b`. Instead `b` is printed twice. (Unfortunatley, code like this is all too common for minimized scripts.) ```javascript var a = function () { var x = (function x () { console.log("a") }) return function () { x() } }() var b = function () { var x = (function x () { console.log("b") }) return function () { x() } }() a() b() ``` ### Test cases Five tests `test1.html` to `test5.html` are attached. Expectations are as follows: `test1.html`: ```java final String[] expected = { "INFO: outer abc = 1.0", "INFO: inner abc = (function abc() { console.log(\"inner abc = \", abc); })", }; ``` `test2.html`: ```java final String[] expected = { "INFO: a", "INFO: b", }; ``` `test3.html`: ```java final String[] expected = { "INFO: a", }; ``` `test4.html`: ```java final String[] expected = { "INFO: (function func() { console.log(func); })", "INFO: outer", }; ``` `test5.html`: ```java final String[] expected = { "INFO: f1", "INFO: f2", "INFO: f3", "INFO: !f4", "INFO: f5", "INFO: !f6", "INFO: !f7", "INFO: !f8", "INFO: f10", "INFO: f11", "INFO: f12", "INFO: f10", // Chrome/FF: !f10 "INFO: f11", "INFO: f12", "INFO: f13", }; ``` ### Possible fix While rhino far surpasses my coding ability, asashour [seems to have](https://github.com/HtmlUnit/htmlunit-rhino-fork/commit/afadfd48770eace84c70f503efef66c5767c9a3b) already added the [necessary building block](https://github.com/HtmlUnit/htmlunit-rhino-fork/blob/e7ce0f761305d876f99a323a27214f064c5fb4f3/src/org/mozilla/javascript/InterpreterData.java#L98) for this. The following is the code I'm using to further this for a fix: ```diff --- a/src/main/java/net/sourceforge/htmlunit/corejs/javascript/CodeGenerator.java +++ b/src/main/java/net/sourceforge/htmlunit/corejs/javascript/CodeGenerator.java @@ -6,12 +6,12 @@ package net.sourceforge.htmlunit.corejs.javascript; -import net.sourceforge.htmlunit.corejs.javascript.ast.AstNode; -import net.sourceforge.htmlunit.corejs.javascript.ast.FunctionCall; +import net.sourceforge.htmlunit.corejs.javascript.ast.AstRoot; +import net.sourceforge.htmlunit.corejs.javascript.ast.Block; import net.sourceforge.htmlunit.corejs.javascript.ast.FunctionNode; import net.sourceforge.htmlunit.corejs.javascript.ast.Jump; +import net.sourceforge.htmlunit.corejs.javascript.ast.Scope; import net.sourceforge.htmlunit.corejs.javascript.ast.ScriptNode; -import net.sourceforge.htmlunit.corejs.javascript.ast.UnaryExpression; import net.sourceforge.htmlunit.corejs.javascript.ast.VariableInitializer; /** @@ -197,11 +197,10 @@ private void generateNestedFunctions() gen.itsData = new InterpreterData(itsData); gen.generateFunctionICode(); array[i] = gen.itsData; - if (fn.getParent() instanceof FunctionCall) { - AstNode grandParent = fn.getParent().getParent(); - if (grandParent instanceof UnaryExpression && grandParent.getType() == Token.NOT) { - gen.itsData.declaredAsFunctionExpression = true; - } + if (!(fn.getParent() instanceof AstRoot || + fn.getParent() instanceof Scope || + fn.getParent() instanceof Block)) { + gen.itsData.declaredAsFunctionExpression = true; } } itsData.itsNestedFunctions = array; ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-08-03 18:37:39
|
Revision: 15510 http://sourceforge.net/p/htmlunit/code/15510 Author: rbri Date: 2018-08-03 18:37:34 +0000 (Fri, 03 Aug 2018) Log Message: ----------- some experiments Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2018-08-02 19:25:49 UTC (rev 15509) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2018-08-03 18:37:34 UTC (rev 15510) @@ -197,6 +197,34 @@ i.remove(); } } + + // maybe this is a better solution but i have to think a bit more about this + // + // if (computedStyles_.isEmpty()) { + // return; + // } + // + // // remove all siblings + // DomNode parent = changed.getParentNode(); + // if (parent != null) { + // for (DomNode sibling : parent.getChildNodes()) { + // computedStyles_.remove(sibling.getScriptableObject()); + // } + // + // if (clearParents) { + // // remove all parents + // while (parent != null) { + // computedStyles_.remove(parent.getScriptableObject()); + // parent = parent.getParentNode(); + // } + // } + // } + // + // // remove changed itself and all descendants + // computedStyles_.remove(changed.getScriptableObject()); + // for (DomNode descendant : changed.getDescendants()) { + // computedStyles_.remove(descendant.getScriptableObject()); + // } } public synchronized void clear() { |
From: <rb...@us...> - 2018-08-02 19:25:52
|
Revision: 15509 http://sourceforge.net/p/htmlunit/code/15509 Author: rbri Date: 2018-08-02 19:25:49 +0000 (Thu, 02 Aug 2018) Log Message: ----------- work on the next snapshot Modified Paths: -------------- trunk/htmlunit/pom.xml Modified: trunk/htmlunit/pom.xml =================================================================== --- trunk/htmlunit/pom.xml 2018-08-02 18:30:12 UTC (rev 15508) +++ trunk/htmlunit/pom.xml 2018-08-02 19:25:49 UTC (rev 15509) @@ -4,7 +4,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>net.sourceforge.htmlunit</groupId> <artifactId>htmlunit</artifactId> - <version>2.32</version> + <version>2.33-SNAPSHOT</version> <name>HtmlUnit</name> <organization> <name>Gargoyle Software Inc.</name> |
From: RBRi <rb...@us...> - 2018-08-02 18:31:03
|
- **status**: accepted --> closed --- ** [bugs:#1978] WebResponseWrapper missing cleanUp / defaultCharsetUtf8 / ...** **Status:** closed **Group:** Latest SVN **Created:** Thu Aug 02, 2018 05:48 AM UTC by Atsushi Nakagawa **Last Updated:** Thu Aug 02, 2018 06:30 PM UTC **Owner:** RBRi ### Problem in brief `WebResponseWrapper` is quite useful but it got left sometime between 2.28 and 2.32 is currently missing delegate calls to these following methods: * `getContentLength()` * `cleanUp()` * `defaultCharsetUtf8()` Since we use it extensively, the side effect of this is `XMLHttpRequest.responseText` outputting garbled text as `UTF-8` is being treated as `ISO-8859-1`. ### Possible fix ```diff --- a/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java +++ b/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java @@ -50,6 +50,11 @@ public WebResponseWrapper(final WebResponse webResponse) throws IllegalArgumentE wrappedWebResponse_ = webResponse; } + @Override + public long getContentLength() { + return wrappedWebResponse_.getContentLength(); + } + /** * {@inheritDoc} * The default behavior of this method is to return getContentAsStream() on the wrapped webResponse object. @@ -123,6 +128,16 @@ public long getLoadTime() { return wrappedWebResponse_.getLoadTime(); } + @Override + public void cleanUp() { + wrappedWebResponse_.cleanUp(); + } + + @Override + public void defaultCharsetUtf8() { + wrappedWebResponse_.defaultCharsetUtf8(); + } + /** * {@inheritDoc} * The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object. ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-02 18:30:50
|
Fixed in SVN, as always will inform via twitter if a new snapshot is availalbe. Again thanks for the report. --- ** [bugs:#1978] WebResponseWrapper missing cleanUp / defaultCharsetUtf8 / ...** **Status:** accepted **Group:** Latest SVN **Created:** Thu Aug 02, 2018 05:48 AM UTC by Atsushi Nakagawa **Last Updated:** Thu Aug 02, 2018 10:16 AM UTC **Owner:** RBRi ### Problem in brief `WebResponseWrapper` is quite useful but it got left sometime between 2.28 and 2.32 is currently missing delegate calls to these following methods: * `getContentLength()` * `cleanUp()` * `defaultCharsetUtf8()` Since we use it extensively, the side effect of this is `XMLHttpRequest.responseText` outputting garbled text as `UTF-8` is being treated as `ISO-8859-1`. ### Possible fix ```diff --- a/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java +++ b/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java @@ -50,6 +50,11 @@ public WebResponseWrapper(final WebResponse webResponse) throws IllegalArgumentE wrappedWebResponse_ = webResponse; } + @Override + public long getContentLength() { + return wrappedWebResponse_.getContentLength(); + } + /** * {@inheritDoc} * The default behavior of this method is to return getContentAsStream() on the wrapped webResponse object. @@ -123,6 +128,16 @@ public long getLoadTime() { return wrappedWebResponse_.getLoadTime(); } + @Override + public void cleanUp() { + wrappedWebResponse_.cleanUp(); + } + + @Override + public void defaultCharsetUtf8() { + wrappedWebResponse_.defaultCharsetUtf8(); + } + /** * {@inheritDoc} * The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object. ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-08-02 18:30:15
|
Revision: 15508 http://sourceforge.net/p/htmlunit/code/15508 Author: rbri Date: 2018-08-02 18:30:12 +0000 (Thu, 02 Aug 2018) Log Message: ----------- Add missing default delegating methods getContentLength(), cleanUp(), and defaultCharsetUtf8() to WebResponseWrapper Issue 1978 Modified Paths: -------------- trunk/htmlunit/src/changes/changes.xml trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java Modified: trunk/htmlunit/src/changes/changes.xml =================================================================== --- trunk/htmlunit/src/changes/changes.xml 2018-08-02 17:53:13 UTC (rev 15507) +++ trunk/htmlunit/src/changes/changes.xml 2018-08-02 18:30:12 UTC (rev 15508) @@ -8,6 +8,10 @@ <body> <release version="2.33" date="xxxx, 2018" description="Bugfixes"> + <action type="fix" dev="rbri" issue="1978" due-to="Atsushi Nakagawa"> + Add missing default delegating methods getContentLength(), cleanUp(), and defaultCharsetUtf8() + to WebResponseWrapper. + </action> <action type="update" dev="rbri"> Major cleanup for neko and switch to xerces 2.12.0 </action> Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java 2018-08-02 17:53:13 UTC (rev 15507) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java 2018-08-02 18:30:12 UTC (rev 15508) @@ -31,6 +31,7 @@ * @author Marc Guillemot * @author Ahmed Ashour * @author Ronald Brill + * @author Atsushi Nakagawa */ public class WebResponseWrapper extends WebResponse { @@ -51,6 +52,15 @@ /** * {@inheritDoc} + * The default behavior of this method is to return getContentLength() on the wrapped webResponse object. + */ + @Override + public long getContentLength() { + return wrappedWebResponse_.getContentLength(); + } + + /** + * {@inheritDoc} * The default behavior of this method is to return getContentAsStream() on the wrapped webResponse object. */ @Override @@ -166,4 +176,22 @@ public WebRequest getWebRequest() { return wrappedWebResponse_.getWebRequest(); } + + /** + * {@inheritDoc} + * The default behavior of this method is to call cleanUp() on the wrapped webResponse object. + */ + @Override + public void cleanUp() { + wrappedWebResponse_.cleanUp(); + } + + /** + * {@inheritDoc} + * The default behavior of this method is to call defaultCharsetUtf8() on the wrapped webResponse object. + */ + @Override + public void defaultCharsetUtf8() { + wrappedWebResponse_.defaultCharsetUtf8(); + } } |
From: <rb...@us...> - 2018-08-02 17:53:16
|
Revision: 15507 http://sourceforge.net/p/htmlunit/code/15507 Author: rbri Date: 2018-08-02 17:53:13 +0000 (Thu, 02 Aug 2018) Log Message: ----------- revert last change i have to think about this a bit more Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2018-08-01 20:20:01 UTC (rev 15506) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2018-08-02 17:53:13 UTC (rev 15507) @@ -168,10 +168,6 @@ private static final class CSSPropertiesCache implements Serializable { private transient WeakHashMap<Element, Map<String, CSS2Properties>> computedStyles_ = new WeakHashMap<>(); - // Dummy value to associate with an Object in the backing Map - private static final Object PRESENT = new Object(); - private transient WeakHashMap<DomNode, Object> cleanedNodes_ = new WeakHashMap<>(); - public synchronized CSS2Properties get(final Element element, final String normalizedPseudo) { final Map<String, CSS2Properties> elementMap = computedStyles_.get(element); if (elementMap != null) { @@ -185,18 +181,13 @@ if (elementMap == null) { elementMap = new WeakHashMap<>(); computedStyles_.put(element, elementMap); - cleanedNodes_.remove(element.getDomNodeOrDie()); } elementMap.put(normalizedPseudo, style); } public synchronized void nodeChanged(final DomNode changed, final boolean clearParents) { - if (cleanedNodes_.containsKey(changed)) { - return; - } - - for (final Iterator<Map.Entry<Element, Map<String, CSS2Properties>>> i - = computedStyles_.entrySet().iterator(); i.hasNext();) { + final Iterator<Map.Entry<Element, Map<String, CSS2Properties>>> i = computedStyles_.entrySet().iterator(); + while (i.hasNext()) { final Map.Entry<Element, Map<String, CSS2Properties>> entry = i.next(); final DomNode node = entry.getKey().getDomNodeOrDie(); if (changed == node @@ -203,7 +194,6 @@ || changed.getParentNode() == node.getParentNode() || changed.isAncestorOf(node) || clearParents && node.isAncestorOf(changed)) { - cleanedNodes_.put(node, PRESENT); i.remove(); } } |
From: RBRi <rb...@us...> - 2018-08-02 10:18:07
|
- **status**: open --> accepted - **assigned_to**: RBRi --- ** [bugs:#1979] WebClient.getTopLevelWindows() wrongly ordered, probably** **Status:** accepted **Group:** Latest SVN **Created:** Thu Aug 02, 2018 07:17 AM UTC by Atsushi Nakagawa **Last Updated:** Thu Aug 02, 2018 07:17 AM UTC **Owner:** RBRi ### Problem in brief Prior to around 2.30, `WebClient.getTopLevelWindows()` was FIFO (i.e. oldest window first), and was in line with `WebClient.getWebWindows()` which is also FIFO. Now, `WebClient.getTopLevelWindows()` is reversed and is the opposite of `WebClient.getWebWindows()`. This change is probably an inadvertent resulting from [r15202](https://sourceforge.net/p/htmlunit/code/15202/#diff-2). ### Possible fix Below is the code we're using locally since changing the spec will break code compatibility. N.B.: r15202 [also changed the order of window close in `WebClient.close()`](https://sourceforge.net/p/htmlunit/code/15202/tree/trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java#l1880) but I think that might've been for the better so I've left that one as is. ```diff --- a/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java +++ b/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java @@ -1535,7 +1535,9 @@ public boolean containsWebWindow(final WebWindow webWindow) { * @see #getWebWindows() */ public List<TopLevelWindow> getTopLevelWindows() { - return Collections.unmodifiableList(new ArrayList<>(topLevelWindows_)); + List<TopLevelWindow> l = new ArrayList<>(topLevelWindows_.size()); + topLevelWindows_.descendingIterator().forEachRemaining(l::add); + return Collections.unmodifiableList(l); } /** ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: RBRi <rb...@us...> - 2018-08-02 10:16:33
|
- **status**: open --> accepted - **assigned_to**: RBRi - **Comment**: Will fix this soon, thanks --- ** [bugs:#1978] WebResponseWrapper missing cleanUp / defaultCharsetUtf8 / ...** **Status:** accepted **Group:** Latest SVN **Created:** Thu Aug 02, 2018 05:48 AM UTC by Atsushi Nakagawa **Last Updated:** Thu Aug 02, 2018 05:48 AM UTC **Owner:** RBRi ### Problem in brief `WebResponseWrapper` is quite useful but it got left sometime between 2.28 and 2.32 is currently missing delegate calls to these following methods: * `getContentLength()` * `cleanUp()` * `defaultCharsetUtf8()` Since we use it extensively, the side effect of this is `XMLHttpRequest.responseText` outputting garbled text as `UTF-8` is being treated as `ISO-8859-1`. ### Possible fix ```diff --- a/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java +++ b/src/main/java/com/gargoylesoftware/htmlunit/util/WebResponseWrapper.java @@ -50,6 +50,11 @@ public WebResponseWrapper(final WebResponse webResponse) throws IllegalArgumentE wrappedWebResponse_ = webResponse; } + @Override + public long getContentLength() { + return wrappedWebResponse_.getContentLength(); + } + /** * {@inheritDoc} * The default behavior of this method is to return getContentAsStream() on the wrapped webResponse object. @@ -123,6 +128,16 @@ public long getLoadTime() { return wrappedWebResponse_.getLoadTime(); } + @Override + public void cleanUp() { + wrappedWebResponse_.cleanUp(); + } + + @Override + public void defaultCharsetUtf8() { + wrappedWebResponse_.defaultCharsetUtf8(); + } + /** * {@inheritDoc} * The default behavior of this method is to return getResponseHeaders() on the wrapped webResponse object. ``` --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-08-01 20:20:04
|
Revision: 15506 http://sourceforge.net/p/htmlunit/code/15506 Author: rbri Date: 2018-08-01 20:20:01 +0000 (Wed, 01 Aug 2018) Log Message: ----------- try to do a bit more houskeeping to make hopefully the processing of large style sheets faster Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2018-07-31 18:07:46 UTC (rev 15505) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Window.java 2018-08-01 20:20:01 UTC (rev 15506) @@ -168,6 +168,10 @@ private static final class CSSPropertiesCache implements Serializable { private transient WeakHashMap<Element, Map<String, CSS2Properties>> computedStyles_ = new WeakHashMap<>(); + // Dummy value to associate with an Object in the backing Map + private static final Object PRESENT = new Object(); + private transient WeakHashMap<DomNode, Object> cleanedNodes_ = new WeakHashMap<>(); + public synchronized CSS2Properties get(final Element element, final String normalizedPseudo) { final Map<String, CSS2Properties> elementMap = computedStyles_.get(element); if (elementMap != null) { @@ -181,11 +185,16 @@ if (elementMap == null) { elementMap = new WeakHashMap<>(); computedStyles_.put(element, elementMap); + cleanedNodes_.remove(element.getDomNodeOrDie()); } elementMap.put(normalizedPseudo, style); } public synchronized void nodeChanged(final DomNode changed, final boolean clearParents) { + if (cleanedNodes_.containsKey(changed)) { + return; + } + for (final Iterator<Map.Entry<Element, Map<String, CSS2Properties>>> i = computedStyles_.entrySet().iterator(); i.hasNext();) { final Map.Entry<Element, Map<String, CSS2Properties>> entry = i.next(); @@ -194,6 +203,7 @@ || changed.getParentNode() == node.getParentNode() || changed.isAncestorOf(node) || clearParents && node.isAncestorOf(changed)) { + cleanedNodes_.put(node, PRESENT); i.remove(); } } |
From: RBRi <rb...@us...> - 2018-08-01 15:49:28
|
Hi Martin, can you please contact me by private mail. I fear i have do do some debugging and i need some hints from you to get your cookie magic working. --- ** [bugs:#1967] Clicking button has stopped working and returns same web page** **Status:** accepted **Group:** 2.31 **Created:** Mon Jun 11, 2018 09:45 AM UTC by Martin Strange **Last Updated:** Tue Jul 31, 2018 04:59 AM UTC **Owner:** RBRi Until recently, I have been running HtmlUnit 2.25. It was throwing up rhino errors but still allowed my code to click the edit button in a Google Sites web page to bring up the editable version of the page. My code has recently stopped working. Now when I call click() to click the edit button, the same web page is returned (easy to verify since the returned web page still contains the edit button and not the save button of the editable web page). I have switched to HmtlUnit 2.31. The good news is the rhino errors have gone. But click() is still not advancing to the editable web page. The problem doesn't seem likely to be a Javascript error, since once the right element is obtained I don't think Javascript is involved in the actual click() process. Here is my code: ~~~ :::java // Set up the web client. WebClient webClient = new WebClient(BrowserVersion.CHROME); // Read in cookies file so that the Google Sites server will recognise // me as logged in and return the logged in web page in the following // getPage call (code not shown here as this all works fine). // Get logged in web page. HtmlPage loggedInPage= webClient.getPage("https://sites.google.com/site/[my-web-page-at-google-sites]"); // Wait 2 secs just in case time is needed to execute Javascript. webClient.waitForBackgroundJavaScriptStartingBefore(2000); // Get the element (edit button) to click. HtmlElement element loggedInPage.getElementById("edit-start-btn"); // Check that element obtained is the correct edit button and all is // looking good for clicking it. System.out.println("Element about to be clicked is: + element); // Click the edit button to get the editable web page. HtmlPage editablePage = element.click(); // Have a look at the returned web page to see if it is the editable page. System.out.println(editablePage.asXml()); ~~~ Here is the web page code snippet containing the button I want to click: ~~~html <div role="button" id="edit-start-btn" class="goog-inline-block jfk-button jfk-button-standard jfk-button-disabled" aria-disabled="true"> <span id="sites-collaborator-bar-edit-page-icon" class="sites-camelot-icon"> </span> </div> ~~~ My code finds the element on the web page OK since the println that outputs details about the element about to be clicked corresponds correctly with the edit button shown in this web page code snippet above: ~~~ Element about to be clicked is: HtmlDivision[<div role="button" id="edit-start-btn" class="goog-inline-block jfk-button jfk-button-standard jfk-button-collapse-right collaborator-btn-collapse-right" aria-disabled="false" aria-label="Edit page" tabindex="0">] ~~~ Why does my code fail, and why should it have previously worked OK in HtmlUnit 2.25 and then suddenly stopped working? I notice that the time now taken to perform the click() is at most a second or apparently instantaneous. When the code was working, it took a second or two. Could this indicate that HtmlUnit is not even going to the Google Sites server, perhaps returning the cached version of the same page instead? One thought I had but probably not relevant: could it be a focus issue? I know HtmlUnit has changed for text input in forms, now requiring the focus to be shifted to the form which wasn't the case before. Does the focus have to be shifted to a button before clicking it will work? Many thanks if you can help. I find HtmlUnit really useful in the work I do. It's an awesome tool and you guys do a fantastic job in developing and supporting it. --- Sent from sourceforge.net because htm...@li... is subscribed to https://sourceforge.net/p/htmlunit/bugs/ To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/htmlunit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list. |
From: <rb...@us...> - 2018-07-31 18:07:49
|
Revision: 15505 http://sourceforge.net/p/htmlunit/code/15505 Author: rbri Date: 2018-07-31 18:07:46 +0000 (Tue, 31 Jul 2018) Log Message: ----------- dep updates Modified Paths: -------------- trunk/htmlunit/pom.xml Modified: trunk/htmlunit/pom.xml =================================================================== --- trunk/htmlunit/pom.xml 2018-07-30 15:13:23 UTC (rev 15504) +++ trunk/htmlunit/pom.xml 2018-07-31 18:07:46 UTC (rev 15505) @@ -29,7 +29,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.7.0</version> + <version>3.8.0</version> <configuration> <!-- Update the links reference in PDM and clover plugins when this changes --> <source>1.8</source> @@ -908,7 +908,7 @@ <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> - <version>2.11.0</version> + <version>2.11.1</version> <scope>test</scope> </dependency> <dependency> |