Error in JavaScript integration

Hi everybody,

Im using RaphaelJS to draw a square, and thats the function that I`m calling:

shape.click(function(){onShapeSelected(element)});

I`m trying to add the onShapeSelected function like the following:

JavaScript.getCurrent().addFunction("onShapeSelected", new JavaScriptFunction() {

                

                @Override

                public void call(JSONArray arguments) throws JSONException {

                    notificationManager.showInformationNotification("selected shape: " + arguments.getString(0));

                }

            });

But when I click at the shape, the following error is ocurring. Any ideas?

 Tue Feb 11 20:00:33 GMT-200 2014 com.vaadin.client.ApplicationConfiguration
SEVERE: (RangeError)
stack: RangeError: Maximum call stack size exceeded
at String.replace (native)
at Gn (0.js:6482:29)
at Object.BI (0.js:7093:27487)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at GH (0.js:6034:99)
at Object.NH (0.js:7093:26609)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at GH (0.js:6034:99)
at Object.NH (0.js:7093:26609)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at GH (0.js:6034:99)
at Object.NH (0.js:7093:26609)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)
at qq (0.js:2567:22)
at wfg (0.js:3771:19)
at Object.BI (0.js:7093:27506)
at Object._.toString (0.js:7093:6698)

When you get an error in the actual Javascript you should be able to see it in the Browsers Debugger (f.e. Firebug or standard ones).
This on the other hand looks like a client side error. You can maybe get more information out of it if you enable detailied stack traces. To do that have a look at the client-side part of
this wiki article
.

Same here. Primitive type parameters work just as they should, but when a more complex parameter
(a Javascript Object or a DOM element for example
) is being used the whole app collapses with the same error message you mentioned:

SEVERE: (RangeError) : Maximum call stack size exceeded com.google.gwt.core.client.JavaScriptException: (RangeError) : Maximum call stack size exceeded Debugging is problematic too, sadly. GWT devmode/superdevmode hangs with an error (
java.lang.NoSuchFieldError: warningThreshold
). Setting Javascript style to Pretty does nothing in eclipse, after a sucessful widgetset compilation everything is still obfuscated.

Using Vaadin v7.2.0

Hi Zsolt,

do you build your widget set with maven?

The parameter for pretty JavaScript is

<style>PRETTY</style>

or even

<style>DETAILED</style>

Hi Wolfgang,

Thanks for the the fast response!

To tell you the truth, I did not want to hijack this topic with other debugging problems, but I had to make clear why I can’t step any further to solve the problem explained in the first post. I was hoping that someone would come up a potential resolution and I won’t have to spend more time to make JS debugging to work.

[i]
To answer you question: I use only eclipse, it does everything for me, or it should be :). It uses Apache Ivy as far as I know. Maybe I’ll try to compile it manually and tell you the results. Thanks for the tip!


UPDATE

[/i]: It seems the error is in the DefaultWidgetset and that’s why the JS erorr stacktrace is still obfuscated. I believe that setting style to pretty only effects my widgetset.

I was able to reproduce this error in Vaadin 7.1.12-7.4.0.alpha1 too :(.


UPDATE2:
I think I know what is the problem here. JS object can be passed simply to the server side IF they did not contain DOM elements. Serializing a DOM element gives hard time to Vaadin. I have to admit, that there’s no information about passing DomElements to server side in the documentation. It’s simply not supported currently, I guess.