How to disable Javascript debugging in NetBeans when using ScriptEngine? - debugging

Development environment is netbeans, java application, which runs javascript thru ScriptEngine in GraalVM.
When using debug mode, it automatically force a debug session with Chrome when scriptengine starts.
console shows: Debugger listening on ws://127.0.0.1:9229/xxxxxxxxxx
For help, see: https://www.graalvm.org/tools/chrome-debugger
E.g. in Chrome open: devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9229/xxxxxxxxxx
But the address xxxxx keep changing whenever I restart the debug session. I have to open chrome with the new address, because the javascript by default is paused and have to click continue in chrome for the program to continue.
Since I am not interested to debug the javascript side most of the time, is it possible to configure netbeans to avoid this chrome debugging session started ?

Problem fixed when removed this VMoption -Dpolyglot.inspect.Secure=false

Related

How to stop Firefox debugger server without restarting Firefox

I have a VSCode config that will start the Firefox debugger server with -start-debugger-server, so that I can run an npm script and launch a website in my existing firefox windows without having to run a special firefox window with the debug server enabled.
Is there a way to turn the debugger server off short of re-starting Firefox? Something like a -stop-debugger-server CLI argument would be nice but there doesn't appear to be such a flag.
I've tried -stop-debugger-server, tried looking in the firefox CLI wiki, tried a web search. Stopped short of trying to re-start Firefox from the command line

Connecting an external debugger for browser extension development

I'm trying to figure out how to properly attach an external debugger from, say WebStorm or vs-code to debug a browser extension.
How my ideal workflow would look like:
I launch an extension in dev-mode with https://github.com/mozilla/web-ext and then can attach debugger to that browser instance, see break-points/etc.
What I've tried
Configure https://www.jetbrains.com/help/webstorm/configuring-javascript-debugger.html specifying a URL on which my extension operates.
Add a break-point to a content-script
After browser is started by debug process - load my extension from disk & reload the page
Expected: debugger stops at a break point
Actual: page loads without interruption (or sometimes debugger stops at a random code not from my extension 😅 )
I've also tried setting the breakpoint for a background script, which didn't seem to have any effect either.
Misc
For content-script WebStorm seems to indicate that break-points are not in a valid state
Background script breakpoint is, not that it helps
Code is bundled with Parcel with source-maps enabled
Browser is Chrome 99.0.4844.51 (FF debugging does not seem to be supported)
System: macOS 12.2

Why does UiPath robot runs in Debug mode on Chrome in a Test Automation project?

I have created a new project in UiPath Studio Community Edition v.2021.10.4, and created a new 'Test Automation' project. And created the steps to open a browser, go to specified address and type in login/password and click OK button.
The issue is when I try to run the script that I created not debug, it runs on debug mode in Chrome, and this navbar pops up in Chrome which says : UiPath Web Automation 21.10 has started debugging this browser. , and when it ends the browser closes automatically :
What I want is to execute this script normally, not in a debug mode, and the browser stays open, so I can implement the next steps in my developments.
I managed to solve this by changing the input method of the Activity "Use Application/Browser" from Chromium API to Hardware Events.

How to debug Firefox's XUL startup (on Windows)

I have a problem that causes Firefox to behave strangely during startup.
(Specifically, it displays the "Firefox seems slow... to... start" message, even though I didn't install any new extensions or anything like that.)
The function that displays that message is _showSlowStartupNotification in browser/components/nsBrowserGlue.js which is called from _trackSlowStartup which in turn is called by _onFirstWindowLoaded.
I want to debug that. How can I do that?
I can debug the Firefox binaries easily with WinDbg and Mozilla's symbol server. But that's not what I want. I want to debug the XUL, not the C++.
I can debug the XUL if I enable the Browser Toolbox, but only after the startup. Even if I set devtools.debugger.prompt-connection to false and run firefox.exe -jsdebugger to immediately open the Browser Toolbox, I get access to it only after the startup code has already been executed. Setting a breakpoint on the interesting function doesn't help as they are not persistent; restarting Firefox doesn't cause the internal XUL debugger to break on them.
So, any suggestions? Is there a way to debug Firefox's XUL from the early start?

How to shutdown local tomcat server when closing browser window?

I hava a web app running on a local tomcat server.
When the user starts the app (via desktop shortcut) the server starts and the app is opened in a browser window.
But when the user just clicks on the close button to stop the application the server is still running in the background - that's annoying.
I tried to utilize the "unonload" and "onbeforeunload" events from javascript but unfortunately these events are also fired on some other requests in the app.
So I can't use them, except I do a lot of refactoring.
Does anyone have an idea for a possible solution?
Btw, what I find interesting is the behaviour of Visual Studio when debugging a web application. When I close the browser window Visual Studio also gets a trigger to stop debug mode. So it seems it somehow notices the close event of the browser window, which would be exactly what I need. But I don't know how they do it...
Can you wrap the starting of Tomcat and launching your app in a batch file or shell script? (Not sure what your target OS is...)
The script/batch file would start Tomcat and then launch your application. When the user exits your application, the script/batch file would then shut down Tomcat.
You can setup a short session timeout, and use a HttpSessionListener. On sessionDestroyed(..) you can stop tomcat (using catalina.bat for example) .
Otherwise you can try to detect browser close, and send a shutdown message to the server using ajax (before the browser is closed).

Resources