I use Scratchpad in Firefox to run scripts against web pages and it works fine.
Is there any way to debug and watch variables during execution?
I use Scratchpad in Firefox to run scripts against web pages and it works fine.
Is there any way to debug and watch variables during execution?
The issue mentioned in Alex's reply was fixed in Firefox 47 (see bug 1252077), you can now use debugger;
statements in your Scratchpad code or set breakpoints directly in the Debugger. The Scratchpad script's source should appear there after you have run the script at least once. Make sure you have Dev Tools open.
It's a bit awkward though since Scratchpad scripts don't update in the Debugger window after they were modified in the Scratchpad, you need to refresh the page you're on first or use Execute
→ Reload and Run
in the Scratchpad.
Right now it's not possible to view code entered into the Scratchpad using the Debugger pane of the Firefox Developer Tools. It just shows up in the sources like Scratchpad/1 with content:
This will be fixed in bugs 816988 and 813087 so go and vote for those.
What you can do is:
Add a
debugger;
statement to the line in your Scratchpad code where you want to break. It will still be possible to view variable values, scope, etc...Interact with the Debugger object directly. Here is a video that explains getting started with that (note you can now set the option "Enable chrome and add-on debugging" in Developer Tool settings instead of going to
about:config
). You will also want to review the API.