Friday, June 28, 2013

Re: GWTTestCase and CORS

I added htmlunit 2.12 to the run configuration's classpath, but my test still fails on an origin error.

Jun 28, 2013 1:57:03 PM com.gargoylesoftware.htmlunit.javascript.StrictErrorReporter runtimeError
SEVERE: runtimeError: message=[Access to restricted URI denied] sourceName=[injected script] line=[85] lineSource=[null] lineOffset=[0]

So now I'm wondering if htmlunit is configured to emulate a non-CORS browser.  I'll look more into that;  If there are any htmlunit gurus out there that know exactly how to do that, it would be great.  Thanks.

Ed


On Friday, June 28, 2013 12:45:15 PM UTC-7, emurmur wrote:
Thank you Thomas.  It looks like htmlunit 2.11 is the first version with CORS support.  It should also have the GWT patches so I'll try your suggestion with that.  I'll also take a look at phantomjs.  Thanks again.

Ed

On Friday, June 28, 2013 1:12:18 AM UTC-7, Thomas Broyer wrote:

On Friday, June 28, 2013 2:22:36 AM UTC+2, emurmur wrote:
I'm writing a test case that involves a cross-origin call and htmlunit chokes on it.  The code works in real browsers.  Recent versions of htmlunit seem to support CORS (based on commit comments).  How do I find what version of htmlunit is bundled with GWT and is there a way to upgrade it?  Thanks.

All the dependencies can be found in http://google-web-toolkit.googlecode.com/svn/tools/ (see http://www.gwtproject.org/makinggwtbetter.html#compiling), and as you can see in https://gwt.googlesource.com/gwt/+/master/dev/build.xml, GWT currently depends on HtmlUnit 2.9 (and as you can see in http://google-web-toolkit.googlecode.com/svn/tools/lib/htmlunit/htmlunit-2.9/ it's actually a patched version).
Apparently, we could update to 2.10 with no breakage (and 2.10 includes all patches applied to the 2.9 for GWT), at least GWT compiles against 2.10 but I haven't heavily tested it (yet). I haven't tried with more recent versions.
I think you can try it out by putting HtmlUnit 2.10 (and its dependencies) before gwt-dev.jar in your classpath (i.e. without rebuilding gwt-dev).
You could also try using PhantomJS instead of HtmlUnit: https://github.com/neothemachine/gwt-phantomjs-junit-runstyle

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment