Closed
Bug 223536
Opened 21 years ago
Closed 21 years ago
Exposing XPConnect jsval <-> nsIVariant to conversion functionality
Categories
(Core :: XPConnect, enhancement)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
People
(Reporter: stef, Assigned: dbradley)
Details
Attachments
(2 files, 3 obsolete files)
6.92 KB,
patch
|
dbradley
:
review+
jst
:
superreview+
|
Details | Diff | Splinter Review |
6.91 KB,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030728 Mozilla Firebird/0.6.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6a) Gecko/20031016 Firebird/0.7+
While adding scripting to a mozilla based application I need to be able to
convert between nsIVariant's and jsvals. The code for this exists in XPConnect
but is not exposed.
Instead of reinventing the wheel in app, I'd like to suggest exposing this
functionality. I'd imagine it would be beneficial to other developers as well.
Included is a patch which exposes the conversions as a service.
Reproducible: Always
Steps to Reproduce:
Reporter | ||
Comment 1•21 years ago
|
||
![]() |
||
Updated•21 years ago
|
Attachment #134031 -
Flags: review?(BradleyJunk)
Reporter | ||
Comment 2•21 years ago
|
||
Attached the wrong patch. Currently on a trip, so my brain's a bit scattered :)
Attachment #134031 -
Attachment is obsolete: true
Reporter | ||
Updated•21 years ago
|
Attachment #134093 -
Flags: review?(BradleyJunk)
Updated•21 years ago
|
Attachment #134031 -
Flags: review?(BradleyJunk)
Assignee | ||
Comment 3•21 years ago
|
||
Do we really need a new interface for this? I'm thinking exposing it on one of
the existing xpconnect interfaces might be better. Was thinking of nsIXPConnect.
It would seem in line with the other js to native and native to js operations.
Reporter | ||
Comment 4•21 years ago
|
||
True. Good point. The service added by the patch doesn't contain any state
information, so adding it to another service would be trivial. OTOH,
nsIXPConnect is already a massive interface.
Regardless, I'll prepare a patch incorporating this change when I get a chance
Reporter | ||
Comment 5•21 years ago
|
||
As suggested by Bradley this patch adds the converter functionality to the
nsIXPConnect interface rather than creating a whole new interface/service.
Reporter | ||
Updated•21 years ago
|
Attachment #135045 -
Flags: review?(BradleyJunk)
Reporter | ||
Comment 6•21 years ago
|
||
Brad, any chance of getting this reviewed?
Assignee | ||
Comment 7•21 years ago
|
||
Comment on attachment 134093 [details] [diff] [review]
The right patch
Cleanup, comments on other patch to follow
Attachment #134093 -
Flags: review?(BradleyJunk) → review-
Assignee | ||
Comment 8•21 years ago
|
||
Comment on attachment 135045 [details] [diff] [review]
Patch to add feature (on nsIXPConnect)
r=dbradley with the following addressed
I don't believe you need the NS_ADDREF in VariantFromJS. XPCVariant::newVariant
has already incremented the ref count.
I'd include the nsIVariant interface idl file in nsXPConnect.idl rather than
forward declaring it.
nits, your comments stated variantToJs and variantFromJs but the S should be
uppercase
You have several "return" statements after if's that are indented only by two,
should be four
Attachment #135045 -
Flags: review?(BradleyJunk) → review+
Reporter | ||
Comment 9•21 years ago
|
||
Thanks. I've updated the patch.
Do I need to get superreview on it from someone else?
Reporter | ||
Updated•21 years ago
|
Attachment #134093 -
Attachment is obsolete: true
Attachment #135045 -
Attachment is obsolete: true
Assignee | ||
Comment 10•21 years ago
|
||
Comment on attachment 143433 [details] [diff] [review]
Updated patch
Yes, seeing if jst has time.
Attachment #143433 -
Flags: superreview?(jst)
Attachment #143433 -
Flags: review+
Comment 11•21 years ago
|
||
Comment on attachment 143433 [details] [diff] [review]
Updated patch
+ JSVal variantToJS(in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant
value);
+ nsIVariant variantFromJS(in JSContextPtr ctx, in JSVal value);
I would make that variantToJS() and JStoVariant, but I can deal either way.
sr=jst
Attachment #143433 -
Flags: superreview?(jst) → superreview+
Reporter | ||
Comment 12•21 years ago
|
||
Bradley, do you have time to check this in?
Assignee | ||
Comment 13•21 years ago
|
||
Sure I can get it checked in. There's no need to get this in before 1.7 final is
there?
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Reporter | ||
Comment 14•21 years ago
|
||
Nope, later is fine. Thanks.
Assignee | ||
Comment 15•21 years ago
|
||
I'll get this in within the next few days. I was hoping to get to it tonight,
but my tree was in a strange state and I had to create a new one.
Comment 16•21 years ago
|
||
Comment on attachment 145027 [details] [diff] [review]
Alternative patch with jst's suggestion
>+ JSVal variantToJS(in JSContextPtr ctx, in JSObjectPtr scope, in nsIVariant
value);
>+ nsIVariant JSToVariant(in JSContextPtr ctx, in JSVal value);
Shouldn't these be marked [noscript]?
Reporter | ||
Comment 17•21 years ago
|
||
(In reply to comment #16)
> Shouldn't these be marked [noscript]?
The entire nsIXPConnect interface is not marked scriptable, so I don't think
that's necessary.
Comment 18•21 years ago
|
||
(In reply to comment #17)
>(In reply to comment #16)
>> Shouldn't these be marked [noscript]?
>The entire nsIXPConnect interface is not marked scriptable, so I don't think
>that's necessary.
D'oh! :-[
Assignee | ||
Comment 19•21 years ago
|
||
Patch checked in
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•