How to let IntelliJ connect to the Jetbrains chrome and firefox extension programmatically

Hell there,

In the Randori plugin ( we are actually embedding a Jetty instance which is used to serve a Randori application locally. (This is necessary because when running it directly from the filesystem will cause XMLHttpRequests to fail).
So, when a Randori app is run, we start our Jetty instance on a random available port and open a browser to this URL: http://localhost:<port-nr>/index.html

Now, we'd like to be able to use the IntelliJ JavaScript debugger ( for debugging the Randori output. Yet, since Randori already uses its own RunConfiguration we can't use the described JavaScript RunConfig.

How does this particular run config connect with the browser extension? Is there some kind of API we need to invoke prior to opening our URL?

Any kind of insight into this would be greatly appreciated :)

Thanks in advance,

Roland Zwaga

Comment actions Permalink

Hello Roland,

Unfortunately, sources under com.intellij.javascript.debugger.* aren't open.
But you can take a look at our opensourced example that also needs to debug JavaScript in a webpage with given url:;a=blob_plain;f=JsTestDriver/src/com/google/jstestdriver/idea/debug/;h=bdab8d606e837e8758e86ea0b111aa0f988c5c07;hb=HEAD

Feel free to ask further questions.


Comment actions Permalink

Hi Sergey,

thank you very much for that info and the link, I'll be taking a look at this for sure. It would be awesome if I can get Randori apps to be debugged in this way.



Comment actions Permalink

1) About web server:
You don't need to use Jetty. Idea contains internal any purpose server (you can implement any protocol — htttp, xmlrpc, protobuf, custom).  But in case of HTTP you don't need to use this low-level API (I need to say, that actually there is no public API, but will be created by request), you can use "org.jetbrains.ide.HttpRequestHandler.httpRequestHandler" extension point. For example, built-in web server ( uses this extension point (see abstract class org.jetbrains.ide.HttpRequestHandler (community repository)).

One limitation: your app will be available on not-root location (localhost/your_sub_folder).

It seems, you don't need your own web server, just use the built-in web server (it is not available in IDEA, but priority of this task will be increased if it will be required for you, right now you can just extends/copy com.jetbrains.javascript.debugger.BuiltInWebServer (ultimate repository, source code is not available)).

2) About run configuration.
You don't need to open debugging page, it is debugger engine responsibility (Firefox differs from Google Chrome, I recommend you to use Google Chrome instead of Firefox). You can see example (contrib reposiry,;a=blob_plain;f=JsTestDriver/src/com/google/jstestdriver/idea/debug/;hb=e50af47c4600ddbc21ce9a519a51159053cc983b)

Comment actions Permalink

Hi Vladimir,

thank you for your pointers as well, all the info is very much appreciated.
Currently we're already using Jetty, which is working fine for the moment. So, there isn't an immediate need for us to switch to the built-in webserver.
Eventually it might be better though if we do. But I'd first have to make sure if its not a problem that the application will run in a non-root location.

I will definitely take a close look at the JstdDebugProgramRunner class (as pointed to by Sergey as well), thank you very much for that too.




Please sign in to leave a comment.