Closed
Bug 560643
Opened 14 years ago
Closed 14 years ago
Add a special jsval type to XPIDL
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jorendorff, Assigned: jorendorff)
References
Details
Attachments
(4 files, 7 obsolete files)
25.88 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
2.36 KB,
patch
|
jst
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
79.06 KB,
patch
|
jst
:
review+
|
Details | Diff | Splinter Review |
27.59 KB,
patch
|
jorendorff
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
WebIDL has the special "any" type meaning "any JavaScript value". We could use the proposed jsval type for that. It would also be handy in places where we're currently using XPCCallContext::GetArgv() or even nsIVariant. jsvals would be subject to some rules regarding GC: - When a jsval is passed to an in parameter or setter, the caller must ensure that the value passed is GC-reachable (rooted) for the duration of the call. - When calling a method that returns a jsval, a getter that returns a jsval, or a method with a jsval out parameter, the caller must provide a pointer to a GC-root. As always with jsval roots, the caller must initialize it to a non-garbage value, and the callee must not put arbitrary garbage into that variable, even temporarily, because the GC requires a valid jsval there. One missing piece I need in order to start implementing this is an existing interface, preferably a DOM interface, that could use it. That way I can test as I go.
Assignee | ||
Updated•14 years ago
|
Assignee: general → nobody
Component: JavaScript Engine → XPCOM
QA Contact: general → xpcom
Comment 1•14 years ago
|
||
as discussed on IRC, we have a bunch of code that actually returns jsvals using http://mxr.mozilla.org/mozilla-central/ident?i=SetReturnValueWasSet so that would be a good place to start.
Assignee | ||
Comment 2•14 years ago
|
||
Assignee: nobody → jorendorff
Assignee | ||
Comment 3•14 years ago
|
||
Assignee | ||
Comment 4•14 years ago
|
||
The qsgen.py support in here is, as far as I know, completely untested.
Assignee | ||
Comment 5•14 years ago
|
||
Assignee | ||
Comment 6•14 years ago
|
||
This is how far I got before having to switch to other stuff. Parts 1 and 2 just set the stage a little bit. Part 1 just renames JSVal to jsval. It's strictly mindless string substitution, courtesy of perl. Part 2 contains the few manual fixups to put the jsval type in nsrootidl.idl along with astring and the rest. Part 3 adds support for a special jsval type to XPT, XPConnect, xpidl, and qsgen. This part is not sufficiently tested. jsval return values are somewhat tested. The changes to support jsval arguments are not. The changes to qsgen are also untested. Are there any methods that we would like to quickstub, but currently can't because they use SetReturnValueWasSet or GetArgv or nSIVariant? Part 4 changes some interfaces to use jsval instead of SetReturnValueWasSet. My hope is that we can get rid of SetReturnValueWasSet.
Assignee | ||
Comment 7•14 years ago
|
||
Attachment #443491 -
Attachment is obsolete: true
Assignee | ||
Comment 8•14 years ago
|
||
(Part 1 and part 2 are unchanged from WIP v1, but some line numbers changed in the meantime.)
Attachment #443492 -
Attachment is obsolete: true
Assignee | ||
Comment 9•14 years ago
|
||
This fixes some significant bugs in v1 and adds traceable quick stub support.
Assignee | ||
Comment 10•14 years ago
|
||
This adds some more examples that weren't in v1. I ran these through the try server, but unfortunately the tracemonkey tree is a mess right now, so the results were kind of inconclusive. :-P
Attachment #443493 -
Attachment is obsolete: true
Attachment #443494 -
Attachment is obsolete: true
Assignee | ||
Updated•14 years ago
|
Attachment #444773 -
Flags: superreview?(jst)
Attachment #444773 -
Flags: review?(jst)
Assignee | ||
Comment 11•14 years ago
|
||
Comment on attachment 444774 [details] [diff] [review] part 2, manual IDL cleanup - v2 These are the easy parts. As soon as I get a clean try server run, I'll ask for review on parts 3 and 4. (If I should break part 4 down for reviews from individual module owners, please let me know.)
Attachment #444774 -
Flags: superreview?(jst)
Attachment #444774 -
Flags: review?(jst)
Updated•14 years ago
|
Attachment #444773 -
Flags: superreview?(jst)
Attachment #444773 -
Flags: superreview+
Attachment #444773 -
Flags: review?(jst)
Attachment #444773 -
Flags: review+
Updated•14 years ago
|
Attachment #444774 -
Flags: superreview?(jst)
Attachment #444774 -
Flags: superreview+
Attachment #444774 -
Flags: review?(jst)
Attachment #444774 -
Flags: review+
Assignee | ||
Comment 12•14 years ago
|
||
Whoops - For security reasons, we need to tighten up one of the wrapper classes before part 3 goes in.
Depends on: 565735
Assignee | ||
Comment 13•14 years ago
|
||
Part 1: http://hg.mozilla.org/tracemonkey/rev/bff36a551ab7 Part 2: http://hg.mozilla.org/tracemonkey/rev/ccf4b3b2317c
Comment 14•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/bff36a551ab7
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Wait... this isn't really fixed yet.
Assignee | ||
Updated•14 years ago
|
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 16•14 years ago
|
||
Actually -- I think bug 565735 is completely independent of this because the new jsval type is no better or worse than using SetReturnValueWasSet or GetArgv or nsIVariant.
No longer depends on: 565735
Assignee | ||
Comment 17•14 years ago
|
||
Attachment #444775 -
Attachment is obsolete: true
Attachment #449382 -
Flags: review?(jst)
Assignee | ||
Comment 18•14 years ago
|
||
Attachment #444778 -
Attachment is obsolete: true
Attachment #449383 -
Flags: review?(jst)
Comment 19•14 years ago
|
||
Comment on attachment 449382 [details] [diff] [review] part 3, support for [jsval] - v3 Looks good, r=jst. Couple of whitespace nits noted below... - In CallMethodHelper::~CallMethodHelper() else if(dp->IsValCString()) delete (nsCString*) p; - } + else if(dp->IsValJSRoot()) + JS_RemoveRoot(mCallContext, dp->ptr); + } } + Remove the extra whitespace after the replaced '}' here. - In xpcom/base/nsrootidl.idl: [ref, astring] native AString(ignored); [ref, astring] native AStringRef(ignored); [ptr, astring] native AStringPtr(ignored); -native jsval(jsval); +[jsval] native jsval(jsval); Add one more space so the 'native' keywords line up.
Attachment #449382 -
Flags: review?(jst) → review+
Comment 20•14 years ago
|
||
Comment on attachment 449383 [details] [diff] [review] part 4, some examples - v3 Looks good! But this will conflict with dwitte's landing of bug 568059, but you should simply be able to remove the navigator.preference() related changes in this patch before landing.
Attachment #449383 -
Flags: review?(jst) → review+
Assignee | ||
Comment 21•14 years ago
|
||
Carrying forward jst's r+, requesting sr. This is the same as v3 but rebased to tip. (The JS_AddRoot API was changed to JS_AddValueRoot.)
Attachment #449382 -
Attachment is obsolete: true
Attachment #452149 -
Flags: superreview?(jst)
Attachment #452149 -
Flags: review+
Updated•14 years ago
|
Attachment #452149 -
Flags: superreview?(jst) → superreview+
Assignee | ||
Comment 22•14 years ago
|
||
Part 3 landed Friday: http://hg.mozilla.org/tracemonkey/rev/500e65f68068
Blocks: 572522
Comment 23•14 years ago
|
||
Pushed to mozilla-central as well: http://hg.mozilla.org/mozilla-central/rev/699c59338e5c
Comment 24•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/500e65f68068
Status: REOPENED → RESOLVED
Closed: 14 years ago → 14 years ago
Resolution: --- → FIXED
Depends on: 610721
You need to log in
before you can comment on or make changes to this bug.
Description
•