If you need a JSContext and don't have one, use AutoJSContext (defined in
nsContentUtils.h). It'll do the right thing.

Cheers,
bholley

On Sat, Mar 16, 2013 at 9:08 PM, Jonas Sicking <[email protected]> wrote:

>
> On Mar 13, 2013 7:30 PM, "Patrick Wang" <[email protected]> wrote:
> >
> > On 03/13/2013 01:41 AM, Josh Matthews wrote:
> >>
> >> On 03/12/2013 08:43 AM, Gene Lian wrote:
> >>>
> >>> Hi guys,
> >>>
> >>> Supposing we've already had an IDL implemented by JS codes, and then
> >>> we need to let another C++ class inherit that IDL header. However, in
> >>> the C++ implementation, we need to get a context to unwrap some JS
> >>> values. As my best understanding, adding a [implicit_jscontext] tag
> >>> can let us do so, but that will conflict with the original JS
> >>> implementation.
> >>>
> >>> Does anyone know how to deal with this kind of dilemma? Any quick
> >>> thought is highly appreciated! Thanks!
> >>>
> >>> Gene
> >>>
> >>
> >> Is there some reason you can't add the implicit context to the original
> >> IDL?
> >>
> >> Cheers,
> >> Josh
> >
> >
> > implicit_jscontext makes the IDL cannot be implemented in JS, while we
> > hope to keep the original JS implementation.
> >
> > We got an error message looks like: "IDL methods marked with
> [implicit_jscontext] or [optional_argc] may not be implemented in JS" when
> we try to create a JS implemented instance after adding implicit_jscontext.
> >
> > BTW, is nsContentUtils::GetSafeJSContext suitable for this situation?
>
> I don't think it is. But I think there's something like
> nsContentUtils::GetCallerContext that you might be able to use. Bobby
> Holley or Blake Kaplan are good people to ask.
>
> / Jonas
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to