Closed
Bug 679031
Opened 13 years ago
Closed 13 years ago
Expose jsdbg2 Debugger object as an XPCOM component
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: jorendorff, Assigned: jorendorff)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 3 obsolete files)
23.65 KB,
patch
|
ted
:
review+
jorendorff
:
superreview+
|
Details | Diff | Splinter Review |
Dave Camp wrote code to do this. It works like so: var xpcDebugger = Cc["@mozilla.org/jsdebugger;1"].getService(Ci.nsIJSDebugger); xpcDebugger.addClass(); The addClass() method modifies the current global, adding a Debugger constructor. Then you can do stuff like: var dbg = new Debugger(anyContentWindow); dbg.onDebuggerStatement = function (frame) { alert("this is your debugger speaking"); }; anyContentWindow.setTimeout("debugger;", 0); We have the code, with some tests even. We can expose this stuff to extension developers for FF8.
Assignee | ||
Comment 1•13 years ago
|
||
This is what Dave Camp hacked together. I got several useful comments on IRC about the approach, so I'm going to rearrange it completely and post a new patch. :)
Assignee: general → jorendorff
Comment 2•13 years ago
|
||
Note that I've updated these tests to work with the new Debugger API (onDebuggerStatement, etc.) in bug 676605. The fixes are still a WIP, but you can find them in my patch queue: https://hg.mozilla.org/users/pastithas_mozilla.com/remote-debug-patches
Assignee | ||
Comment 4•13 years ago
|
||
This one passes tests. The new .jsm was one of the IRC recommendations I got. The other is to move the whole thing under the js/ directory. I think maybe js/components/{ctypes,debugger,reflect}, though I'll do the other two separately.
Attachment #553224 -
Attachment is obsolete: true
Assignee | ||
Comment 5•13 years ago
|
||
I don't know who likes to give reviews and super-reviews on new components like this. Feel free to dodge, as long as there's someone standing behind you.
Attachment #553305 -
Attachment is obsolete: true
Attachment #553992 -
Flags: superreview?(benjamin)
Attachment #553992 -
Flags: review?(ted.mielczarek)
Comment 6•13 years ago
|
||
Comment on attachment 553992 [details] [diff] [review] v3 Please use straight js/debugger. components/ is an unfortunate artifact of directory history we should avoid.
Attachment #553992 -
Flags: superreview?(benjamin) → superreview+
Assignee | ||
Comment 7•13 years ago
|
||
I don't want to use js/debugger because that directory name looks like there might be something interesting in there, which would be totally untrue--it's just unloved glue code. So following tense negotiations on IRC, bsmedberg and I have settled on js/ductwork/debugger. Seriously. Later I'll move toolkit/ctypes and toolkit/reflect under js/ductwork, and we can then happily forget about them until the revolution comes.
Assignee | ||
Comment 8•13 years ago
|
||
Carrying forward bsmedberg's sr+.
Attachment #553992 -
Attachment is obsolete: true
Attachment #553992 -
Flags: review?(ted.mielczarek)
Attachment #554366 -
Flags: superreview+
Attachment #554366 -
Flags: review?(ted.mielczarek)
Assignee | ||
Comment 9•13 years ago
|
||
Actually it's not quite the same. v4 removes enter/exitNestedEventLoop and eventLoopNestLevel, at dcamp's encouragement.
Comment 10•13 years ago
|
||
Comment on attachment 554366 [details] [diff] [review] v4 - same as v3 but rename js/components to js/ductwork Review of attachment 554366 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/ductwork/Makefile.in @@ +19,5 @@ > +# the Initial Developer. All Rights Reserved. > +# > +# Contributor(s): > +# Brian Ryner <bryner@brianryner.com> > +# Benjamin Smedberg <benjamin@smedbergs.us> I'm sure you copy-pasted these from somewhere, but you can probably remove the contributors from these new files you're adding, since they're pretty much all yours. Also, change copyright dates to 2011 while you're copy-pasting? ::: js/ductwork/debugger/Makefile.in @@ +55,5 @@ > +IS_COMPONENT = 1 > + > +CPPSRCS = \ > + nsJSDebugger.cpp \ > + $(NULL) Two-space indent after line continuations, please. @@ +64,5 @@ > + $(NULL) > + > +EXTRA_JS_MODULES = \ > + jsdebugger.jsm \ > + $(NULL) Two-space, as above, and please don't use actual tabs in Makefiles except before rule commands where they're required. @@ +72,5 @@ > + $(NULL) > + > +ifdef ENABLE_TESTS > + DIRS += tests > +endif It's not really typical to indent inside conditionals in Makefiles, but I don't have strong feelings against it if you like it. ::: toolkit/components/ctypes/ctypes.jsm @@ +52,5 @@ > > +// Initialize the Debugger object. You do not need to do this yourself. > +const init = Components.classes["@mozilla.org/jsdebugger;1"].createInstance(Components.interfaces.nsIJSDebugger); > +init.addClass(); > +Debugger.util = init; Is there a reason this has a two-step init? I assume addClass adds Debugger, but why can't it setup its own .util? Not super-worried about this, this is all awful ductwork that we really ought to rip out and replace with something better. ::: js/ductwork/debugger/nsJSDebugger.cpp @@ +1,1 @@ > +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */ Dare to dream and leave off the ns prefix? ::: js/ductwork/debugger/tests/Makefile.in @@ +44,5 @@ > +include $(DEPTH)/config/autoconf.mk > + > +MODULE = test_debugger > + > +XPCSHELL_TESTS = unit You could feasibly move this up a level and just have XPCSHELL_TESTS = tests in js/ductwork/debugger/Makefile.in, which would save us a make invocation.
Attachment #554366 -
Flags: review?(ted.mielczarek) → review+
Assignee | ||
Comment 11•13 years ago
|
||
OK, I made all those changes, except that (In reply to Ted Mielczarek [:ted, :luser] from comment #10) > Is there a reason this has a two-step init? I assume addClass adds Debugger, > but why can't it setup its own .util? I ripped this out in v4. I'll land this tonight.
Assignee | ||
Comment 12•13 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/28dd46b9ee31
Whiteboard: [inbound]
Assignee | ||
Comment 13•13 years ago
|
||
I backed it out. The test fails! Which is pretty annoying--it doesn't fail here. I'll look at it tomorrow morning.
Whiteboard: [inbound]
Assignee | ||
Comment 14•13 years ago
|
||
Ted figured it out for me. It was failing only after 'make package', due to a missing manifest entry for an xpt file. So I added that, confirmed with Try server, and pushed. http://hg.mozilla.org/integration/mozilla-inbound/rev/a0fb16f50677
Whiteboard: [inbound]
Comment 15•13 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/a0fb16f50677
Status: NEW → RESOLVED
Closed: 13 years ago
OS: Mac OS X → All
Hardware: x86 → All
Resolution: --- → FIXED
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
Version: Other Branch → Trunk
Updated•13 years ago
|
Keywords: dev-doc-needed
Comment 16•13 years ago
|
||
Added a doc for the IJSDebugger interface, which strongly recommends not using it. https://developer.mozilla.org/en/XPCOM_Interface_Reference/IJSDebugger
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•