jlgrock / ClosureJavascriptFramework

A group of plug-ins that can be used in conjunction with maven to execute the Google Closure Compiler on JavaScript code. This Framework allows for scaling and modularity.
MIT License
16 stars 7 forks source link

Upgrade selenium version to get support of CORS in HtmlUnit #42

Closed lukas-vlcek closed 10 years ago

lukas-vlcek commented 10 years ago

Currently used version of selenium is dated. We need to upgrade to new version which has a lot better support of CORS.

I am hitting a use case where I want to call external http rest service from the integration test. This service is started as a part of integration test and runs on localhost. Currently, when I do something like this:

var xhr = new goog.net.XhrManager();
xhr.send(
    "id",
    "http://localhost:9200",
    undefined,
    undefined,
    undefined,
    undefined,
    function(event) {
        assertNotNull(event);
    }
);

I get:

[ERROR] (StrictErrorReporter.java:79) runtimeError: message=[Access to restricted URI denied] sourceName=[file:/.../target/javascriptFramework/closure-library/closure/goog//net/xhrio.js] line=[481] lineSource=[null] lineOffset=[0]

It turns out that this is problem of HtmlUnit version 2.9 (which is used by selenium 2.24.1) as it does not support CORS. Better CORS support is available in HtmlUnit version 2.11 and higher. See HtmlUnit changes report.

lukas-vlcek commented 10 years ago

Oops, not sure what I did but it seems the ticket is duplicated and without complete description. Please see #43