From: Rural H. <rur...@gm...> - 2016-08-26 06:55:10
|
Hi Ronald, I raised the request: https://sourceforge.net/p/htmlunit/bugs/1818/ Thanks. 2016-08-26 2:00 GMT+08:00 Ronald Brill <rb...@rb...>: > On Thu, 25 Aug 2016 18:16:36 +0800 Rural Hunter wrote: > Line number should be not a real problem, i'm sure you able to calculate > the line number if you have access to the whole response. > Regarding the element you are right. But you sample does not use the > element at all and if you are looking for bad js code, i thing > the element will be of minor help. Having the request url at hand is from > my point of view a benefit here. > > If you still miss something, please open an enhancement request, we can > discuss this with all developers than. > > RBRi > > > > >Hi Ronald, > > > >Yes, it can solve our problem in some cases(We actually use that in some > >cases). But it lacks the feature provided in ScriptPreProcessor such as > the > >calling line number, and the element it bounds to etc. I think they serve > >different purposes. > > > >2016-08-25 17:13 GMT+08:00 Ronald Brill <rb...@rb...>: > > > >> Hi Rural, > >> > >> have a look at http://htmlunit.sourceforge.net/faq.html# > >> HowToModifyRequestOrResponse > >> I think this approach can solve your problem. > >> > >> RBRi > >> > >> On Thu, 25 Aug 2016 17:02:38 +0800 Rural Hunter wrote: > >> > > >> >Hi Ronald, > >> > > >> >We do need a similar solution. We usually supply a overridden > >> pre-processor > >> >to WebClient and do things like this in the pre-processor: > >> > @Override > >> > public String preProcess(HtmlPage hp, String sourceCode, String > >> >sourceName, int lineNumber, HtmlElement he) > >> > { > >> > //qq zone temp fix > >> > if(sourceName.indexOf("/qzone/")>0&&sourceCode.indexOf("if( > >> >QZFL.userAgent.ie)")>0) > >> > { > >> > //System.out.println("Found ua code at > >> >"+sourceName+"#"+lineNumber); > >> > return sourceCode.replace("if(QZFL.userAgent.ie)", > >> "if(false)"); > >> > } > >> > **/ > >> > > >> > return sourceCode; > >> > } > >> > > >> >Sometimes it's not a bug and sometimes it's not practicable to wait > for a > >> >fix. > >> > > >> >2016-08-25 14:07 GMT+08:00 Ronald Brill <rb...@rb...>: > >> > > >> >> >We usually use this to diagnose js errors and filter/replace > >> problematic > >> >> js if we can not fix it. > >> >> > >> >> But this was not done by the original ScriptPreProcessor? How have > you > >> >> done this. > >> >> Do you need a similar solution? > >> >> > >> >> Regarding problematic js - if HtmlUnit differs from real browsers > this > >> is > >> >> a bug. Please report all this situations and we will try (sooner or > >> later > >> >> ;-) to fix this. > >> >> > >> >> RBRi > >> >> > >> >> On Thu, 25 Aug 2016 10:00:14 +0800 Rural Hunter wrote: > >> >> > > >> >> >Hi Ronald, > >> >> > > >> >> >We don't use a customized version. We were using 2.14 and I just > try to > >> >> >upgraded to 2.23. We usually use this to diagnose js errors and > >> >> >filter/replace problematic js if we can not fix it. > >> >> > > >> >> >2016-08-24 23:20 GMT+08:00 Ronald Brill <rb...@rb...>: > >> >> > > >> >> >> On Wed, 24 Aug 2016 11:01:48 +0800 Rural Hunter wrote: > >> >> >> > > >> >> >> >I just tried to upgrade my htmlunit dependency from 2.14 to 2.23 > and > >> >> found > >> >> >> >the ScriptPreProcessor is removed. I searched the javadoc and > change > >> >> >> >history but didn't find anything about the function deprecation. > Why > >> >> is it > >> >> >> >removed and anything else I can use to replace it? > >> >> >> > > >> >> >> > >> >> >> ScriptPreProcessor was removed as part of the removal of IE8 > support. > >> >> >> Do you have a customized version in use and if yes what problem do > >> you > >> >> >> solve with this? > >> >> >> > >> >> >> RBRI > >> >> >> > >> >> > > >> >> > > >> >> > >> >> > >> > > >> > > >> > >> > > > > > > |