Giter Site home page Giter Site logo

Support of remote debugger about slimerjs HOT 10 OPEN

laurentj avatar laurentj commented on May 15, 2024
Support of remote debugger

from slimerjs.

Comments (10)

simonweil avatar simonweil commented on May 15, 2024

👍

from slimerjs.

awinizki avatar awinizki commented on May 15, 2024

Since slimerjs is basically a xulrunner application, it should be easy to remotely debug it. I have tried to do it according to the instructions under https://developer.mozilla.org/en-US/docs/Mozilla/Projects/XULRunner/Debugging_XULRunner_applications

I have tried it under Windows 7. To do this, I first unzipped the omni.ja file into the slimerjs installation directory. Then, following the abovementioned instructions, I added the code to start the DebuggerServer to the file chrome\slimerjs\content\slimerjs.js and the debugging preferences to the file defaults\preferences\prefs.js. This always enables remote debugging, so no additional startup parameters are needed.

When I start slimerjs from the command line, I can see with netstat, that the xulrunner process indeed listens on port 6000. When I then try to connect to port 6000 from the firefox debugger, it loads and loads and eventually it gets a timeout.

As a counter- test I created a trivial "Hello World"- like xul application and was able to remotely debug it on port 6000, so I can exclude any network misconfiguration problems. When I try to connect to the "Hello World"- application, it shows a popup box saying "do you want to allow remote debugging of this program?". When I confirm, the program appears in the debugger.

On the other hand, such a popup box does not appear when I try to connect to the abovementioned slimerjs application modified for remote debugging. So, my question is: does anything in slimerjs prevent such popup boxes from appearing? Or any other ideas?

from slimerjs.

laurentj avatar laurentj commented on May 15, 2024

Probably because Slimerjs catch all popup for webpage callbacks.

Try by setting this pref to false: devtools.debugger.prompt-connection.

Even it works, it will not be enough. It will be ok to debug SlimerJS itself, but not the script (let's say example.js) given to SlimerJS. First because it is external to SlimerJS code, so it will not be listed into the debugger. Second because the example.js is executed immediately, so we won't have time to set a break point for example.

For the first issue, I guess we have to "configure" the debugger server, by developping an "actor" which will give a list of scripts containing example.js and all others JS/CoffeeScript that are in the same directory (and probably sub-directory).

For the second issue, when there is the --remote-debugger parameter, we could display a button to launch the execution of example.js instead of executing it directly.

I see also an other issue : if we execute step by step a script, and we want to "enter" in a script loaded by require(), if we do nothing, the debugger will enter in the code of require() first. This will not be very friendly as the code may be complex. We should be able to enter directly into the loaded script. So we should find a way to tell to the debugger "do not enter into native function of slimerjs" and "if the function is require, enter directly into the script xxxx.js".

However, I don't know enough how the debugger and its actors work to tell how to fix all of these issues.

from slimerjs.

awinizki avatar awinizki commented on May 15, 2024

I just tried to set devtools.debugger.prompt-connection to false and it solves my problem!

My script is listed in the debugger and I can debug it normally. In my script I start the webserver and I want to debug the callbacks that process the requests. Of course, I am unable to debug the code that is executed before the server is started, but the callbacks are perfectly debuggable and that is all I want.

Thank you for the advice!

from slimerjs.

awinizki avatar awinizki commented on May 15, 2024

Btw., to address your two issues:

to solve the first one, the developer has to write, only for development purposes, a script that displays a window with a button that on click starts the "real" script. Then it should be all debuggable. In production environment only the "real" script will be started.

As for the second one: this is a general xulrunner problem and is not specific to slimerjs, so we do not need to solve it here.

from slimerjs.

laurentj avatar laurentj commented on May 15, 2024

it solves my problem!

Cool!

My script is listed in the debugger and I can debug it normally.

I think it is listed because it has been loaded and executed.

this is a general xulrunner problem

Are you sure? perhaps we could specify some things to the debugger server object, could we?

from slimerjs.

simonzack avatar simonzack commented on May 15, 2024

👍

from slimerjs.

xolve avatar xolve commented on May 15, 2024

I followed instructions provided by @awinizki to enable remote debugging for SlimerJS. I can see a port open on my machine. But when I try to connect from Firefox debugger I get the error message "Unexpected error." I am using Firefox Developer Edition 45.

How can I proceed to look into the issue? My aim is to inspect DOM objects in page using web developer tools' inspector.

from slimerjs.

Jip-Hop avatar Jip-Hop commented on May 15, 2024

@xolve This seems to be a limitation of Gecko 44 and up. See issue #510.

from slimerjs.

laurentj avatar laurentj commented on May 15, 2024

Debugger server cannot be used anymore in XUL app :-/ https://bugzilla.mozilla.org/show_bug.cgi?id=1244163

from slimerjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.