Closed Bug 785174 Opened 12 years ago Closed 12 years ago

Implement Debugger.Object.prototype.evalInGlobalWithBindings

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: espadrine, Assigned: jimb)

References

Details

(Whiteboard: [js:t])

Attachments

(2 files, 1 obsolete file)

As seen on MDN [1], Debugger.Object instances have a method called evalInGlobalWithBindings() that would be very useful for evaluating WebConsole statements, thereby fixing bug 774753. [1]: https://developer.mozilla.org/en-US/docs/SpiderMonkey/JS_Debugger_API_Reference/Debugger.Object#evalInGlobalWithBindings()
Assignee: general → jimb
Status: NEW → ASSIGNED
Work in progress. Currently trips cross-compartment assertions.
I'm not sure whether this addresses bug 529474 as well or not.
My understanding is that it would, but Firebug isn't using jsd2 yet. They're making the switch, though, so they'll benefit from it as well!
Blocks: 774753
(In reply to Thaddee Tyl [:espadrine] from comment #4) > My understanding is that it would, but Firebug isn't using jsd2 yet. They're > making the switch, though, so they'll benefit from it as well! Okay, with the caveat that, where bug 529474 talks about a XPCSafeJSObjectWrapper, we're handing back a Debugger.Object. Seems legit.
I'd love suggestions for more tests.
Attachment #658551 - Attachment is obsolete: true
Attachment #658835 - Flags: review?(jorendorff)
Attachment #658547 - Flags: review?(jorendorff)
Comment on attachment 658547 [details] [diff] [review] Refactor DebuggerFrameEval to be useful for Debugger.Object.prototype.evalInGlobal{,WithBindings} Review of attachment 658547 [details] [diff] [review]: ----------------------------------------------------------------- Very nice. ::: js/src/vm/Debugger.cpp @@ +3427,3 @@ > static JSBool > +DebuggerGenericEval(JSContext *cx, const char *fullMethodName, > + Value *code, Value *bindings, Value *vp, Why does `code` have to be a pointer? const Value & should work, or ValueHandle (but that's more bother for callers).
Attachment #658547 - Flags: review?(jorendorff) → review+
(In reply to Jason Orendorff [:jorendorff] from comment #9) > Why does `code` have to be a pointer? const Value & should work, or > ValueHandle (but that's more bother for callers). There's no good reason. I just consistently forget that const Value & isn't just as relocating-GC-friendly as a handle.
Test comment.
Attachment #658835 - Flags: review?(jorendorff) → review+
I changed DebuggerGenericEval's 'code' argument to be a const Value &, and changed RequireGlobalObject to take a const Value &dbgobj, instead of taking args and calling args.thisv(), because, jeez.
Whiteboard: [js:t]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: