How to debug RAP 2.x custom widgets and client listener

August 2, 2013 | 1 min Read

RAP 2.0 introduced the JavaScriptLoader service to allow custom widgets to load their scripts dynamically. However, because this is based on an “eval”-like JavaScript feature, the scripts did not appear like all other in the browser developer tools, and setting break points was not possible. The same exact same issue always existed for ClientListener. For the JavaScriptLoader this will be fixed in RAP 2.2M1, but ClientListener can not be changed in the way they are parsed.

For Google Chrome there is an easy workaround. Simply add the following comment to your JavaScript:

//@ sourceURL=NameOfYourScript.js

And now it shows up in the “Sources” tab:

Firebug will support this, and the alternative syntax “//# sourceURL=foo.js” from version 1.11.5 on. Come on Microsoft, what about IE11?