Closed Bug 966262 Opened 11 years ago Closed 5 years ago

Code execution when the page is paused should happen in the current scope

Categories

(DevTools Graveyard :: Scratchpad, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: past, Unassigned)

References

Details

(Whiteboard: [lang=js])

The web console gets this right: when debugging a page and execution is paused, expressions in the web console get evaluated in the current scope. Scratchpad should do this, too. See also bug 966254 comment 3 for an appealing use case.
Scratchpad only needs to check if the debugger is open, then get the selected stack frame actor ID, to include it in the eval request sent to the console actor. The console actor handles the rest.
Whiteboard: [mentor=msucan][lang=js]
Mentor: mihai.sucan
Whiteboard: [mentor=msucan][lang=js] → [lang=js]
Hi Mihai, A newbie here. I'd like to work on this bug. I've read the hacking page[1]. Can I get a pointer to programming information on Scratchpad? [1] https://wiki.mozilla.org/DevTools/Hacking
Thanks for the offer to help with this bug! You can find the code that evaluates the selected scratchpad contents in the SP_evaluate method: http://dxr.mozilla.org/mozilla-central/source/browser/devtools/scratchpad/scratchpad.js#451 It uses the web console client method WCC_evaluateJS: http://dxr.mozilla.org/mozilla-central/source/toolkit/devtools/webconsole/client.js#113 As comment 1 suggests, we should make sure that scratchpad checks for an enabled debugger and in that case, retrieve the stack frame and pass it on to that method. JST_execute and ultimately JST_requestEvaluation is where the web console invokes the method with stack frame information: http://dxr.mozilla.org/mozilla-central/source/browser/devtools/webconsole/webconsole.js#3290 http://dxr.mozilla.org/mozilla-central/source/browser/devtools/webconsole/webconsole.js#3352 Take a look at the above links and see if you can make the same changes for the scratchpad code. Let me know if you need any further help here or in #devtools.
Mentor: mihai.sucan → past
(In reply to Panos Astithas [:past] from comment #3) Thanks for the hint Panos - I'll look into these methods soon. Minor nitpick: IMHO referring to the URI of a specific revision of a file is better than referring to a URI on if/when you want to refer to a specific line/object/statement, because line numbers often change between revisions. For example: * http://hg.mozilla.org/mozilla-central/file/6b8da5940f74/browser/devtools/scratchpad/scratchpad.js#l451 * http://hg.mozilla.org/mozilla-central/file/6b8da5940f74/toolkit/devtools/webconsole/client.js#l113 * http://hg.mozilla.org/mozilla-central/file/6b8da5940f74/browser/devtools/webconsole/webconsole.js#l3290 * http://hg.mozilla.org/mozilla-central/file/6b8da5940f74/browser/devtools/webconsole/webconsole.js#l3352 Sorry for the noise.
Sorry for the long delay. I've been looking for learning materials for XUL, XPCOM and Web Console remoting. For the debugging protocol, I found some up-to-date information. But for XUL and XPCOM, I only found a few very old tutorials. Can anyone point me in the right direction? (I'd like to work on the Mozilla codebase in general, including DevTools.) BTW, I saw that promise.defer() was used many times in those files. Perhaps the `new Promise()` constructor is better.
Scratchpad triage, filter on "ghostbusterzzz"
Priority: -- → P3
Mentor: past
Product: Firefox → DevTools

Scratchpad was removed in Bug 1519103 (Firefox 72). You can check the alternative in https://wiki.developer.mozilla.org/en-US/docs/Tools/Deprecated_tools#Scratchpad .

The Scratchpad bug list was reviewed and I think this bug can be safely closed.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WONTFIX
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.