Last Comment Bug 708754 - Use IDL for jsdIDebuggerService::WrapValue and remove WrapJSValue
: Use IDL for jsdIDebuggerService::WrapValue and remove WrapJSValue
Status: RESOLVED FIXED
: dev-doc-needed
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: Trunk
: All All
: -- normal (vote)
: mozilla11
Assigned To: :Ms2ger (⌚ UTC+1/+2)
:
: Jason Orendorff [:jorendorff]
Mentors:
Depends on: 709747
Blocks:
  Show dependency treegraph
 
Reported: 2011-12-08 11:30 PST by :Ms2ger (⌚ UTC+1/+2)
Modified: 2011-12-18 07:22 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch v1 (3.98 KB, patch)
2011-12-08 11:30 PST, :Ms2ger (⌚ UTC+1/+2)
bobbyholley: review+
Details | Diff | Splinter Review

Description :Ms2ger (⌚ UTC+1/+2) 2011-12-08 11:30:24 PST
Created attachment 580119 [details] [diff] [review]
Patch v1

We can get rid of the nsAXPCNativeCallContext stuff, and WrapJSValue becomes rather redundant after that.
Comment 1 Bobby Holley (:bholley) (busy with Stylo) 2011-12-09 18:09:08 PST
Comment on attachment 580119 [details] [diff] [review]
Patch v1


>-          nsCOMPtr<jsdIValue> jsdValue;
>-          jsd->WrapJSValue(v, getter_AddRefs(jsdValue));
>-          *aRetVal = jsdValue.forget().get();
>+          nsRefPtr<jsdIValue> jsdValue;
>+          rv = jsd->WrapValue(v, getter_AddRefs(jsdValue));
>+          NS_ENSURE_SUCCESS(rv, rv);
>+          jsdValue.forget(aRetVal);

Why the switch from nsCOMPtr to nsRefPtr here?
Comment 2 :Ms2ger (⌚ UTC+1/+2) 2011-12-10 04:11:51 PST
Because nsCOMPtr::forget can only be called with T**, while nsRefPtr's version is happy with superclasses. (Yes, silly, I know; that's Gecko for you.)
Comment 3 Bobby Holley (:bholley) (busy with Stylo) 2011-12-11 18:19:49 PST
Comment on attachment 580119 [details] [diff] [review]
Patch v1

(In reply to Ms2ger from comment #2)
> Because nsCOMPtr::forget can only be called with T**, while nsRefPtr's
> version is happy with superclasses. (Yes, silly, I know; that's Gecko for
> you.)

Hm, in that case I'd rather fix nsCOMPtr (looks like it just needs a template<typename I>), or failing that use the slightly more awkward syntax we had here before. We might as well use COM pointers for COM objects.

r+ once that's taken care of.
Comment 4 :Ms2ger (⌚ UTC+1/+2) 2011-12-18 07:22:39 PST
https://hg.mozilla.org/mozilla-central/rev/21fbcd2f27a8

d-d-n in case anybody used WrapJSValue.

Note You need to log in before you can comment on or make changes to this bug.