Closed
Bug 956455
Opened 12 years ago
Closed 12 years ago
de-holder WrapNative and friends
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: mccr8, Assigned: mccr8)
References
Details
Attachments
(3 files, 2 obsolete files)
|
11.04 KB,
patch
|
gkrizsanits
:
review+
|
Details | Diff | Splinter Review |
|
21.84 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
|
13.35 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
In the modern handle-ified world, holders are often redundant. One particularly ugly instance of this is nsContentUtils::WrapNative. A similar de-holdering can be done for the WrapNative methods in nsDOMClassInfo. With those converted, nsXPConnect::WrapNativeToJSVal can be de-holdered, assuming the comment "Passing a holder here inhibits slim wrappers under WrapNativeToJSVal" is bogus.
By hoisting holder creation into nsXPConnect::WrapNative, maybe I could remove the holders from XPCConvert::NativeInterface2JSObject, but that's more than I want to face at the moment.
| Assignee | ||
Comment 1•12 years ago
|
||
| Assignee | ||
Comment 2•12 years ago
|
||
| Assignee | ||
Comment 3•12 years ago
|
||
Comment 4•12 years ago
|
||
Comment on attachment 8355715 [details] [diff] [review]
part 1 - WrapNative's holder argument is unnecessary.
Review of attachment 8355715 [details] [diff] [review]:
-----------------------------------------------------------------
::: content/base/src/nsFrameMessageManager.cpp
@@ +925,5 @@
> NS_ENSURE_TRUE(param, NS_ERROR_OUT_OF_MEMORY);
>
> JS::Rooted<JS::Value> targetv(ctx);
> JS::Rooted<JSObject*> global(ctx, JS_GetGlobalForObject(ctx, object));
> + nsContentUtils::WrapNative(ctx, global, aTarget, &targetv, true);
Hrm, it's probably no good that we ignore the return value here
| Assignee | ||
Comment 5•12 years ago
|
||
> Hrm, it's probably no good that we ignore the return value here
Good catch.
try run is green: https://tbpl.mozilla.org/?tree=Try&rev=5cfa8f3f1177
| Assignee | ||
Comment 6•12 years ago
|
||
> Hrm, it's probably no good that we ignore the return value here
Filed bug 956569 for that.
| Assignee | ||
Updated•12 years ago
|
Attachment #8355715 -
Flags: review?(Ms2ger)
| Assignee | ||
Updated•12 years ago
|
Attachment #8355716 -
Flags: review?(Ms2ger)
| Assignee | ||
Updated•12 years ago
|
Attachment #8355717 -
Flags: review?(bobbyholley+bmo)
Comment 7•12 years ago
|
||
Comment on attachment 8355717 [details] [diff] [review]
part 3 - Remove the holder argument to nsXPConnect::WrapNativeToJSVal.
Review of attachment 8355717 [details] [diff] [review]:
-----------------------------------------------------------------
Delegating to gabor.
Attachment #8355717 -
Flags: review?(bobbyholley+bmo) → review?(gkrizsanits)
Comment 8•12 years ago
|
||
Comment on attachment 8355717 [details] [diff] [review]
part 3 - Remove the holder argument to nsXPConnect::WrapNativeToJSVal.
Review of attachment 8355717 [details] [diff] [review]:
-----------------------------------------------------------------
/**
* Same as wrapNative, but also returns the JSObject in aVal. C++ callers
- * can pass in null for the aHolder argument, but in that case they must
- * ensure that aVal is rooted.
+ * must ensure that aVal is rooted.
I think you can get rid of the 'also' as well here. Otherwise it looks all good!
Attachment #8355717 -
Flags: review?(gkrizsanits) → review+
| Assignee | ||
Comment 9•12 years ago
|
||
Attachment #8355715 -
Attachment is obsolete: true
Attachment #8355715 -
Flags: review?(Ms2ger)
Attachment #8356163 -
Flags: review?(bugs)
| Assignee | ||
Comment 10•12 years ago
|
||
Attachment #8355716 -
Attachment is obsolete: true
Attachment #8355716 -
Flags: review?(Ms2ger)
Attachment #8356164 -
Flags: review?(bugs)
Updated•12 years ago
|
Attachment #8356163 -
Flags: review?(bugs) → review+
Updated•12 years ago
|
Attachment #8356164 -
Flags: review?(bugs) → review+
| Assignee | ||
Comment 11•12 years ago
|
||
Comment 12•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2b139d0427aa
https://hg.mozilla.org/mozilla-central/rev/5d406909e132
https://hg.mozilla.org/mozilla-central/rev/b997d2cce0eb
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in
before you can comment on or make changes to this bug.
Description
•