Closed
Bug 896540
Opened 12 years ago
Closed 12 years ago
GC: Convert JS_SetProperty* to take MutableHandleValue
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: jonco, Assigned: jonco)
References
Details
(Keywords: dev-doc-complete)
Attachments
(2 files)
11.77 KB,
patch
|
terrence
:
review+
|
Details | Diff | Splinter Review |
22.76 KB,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
To fix rooting analysis warnings about unsafe references, JS_SetProperty and JS_SetPropertyById can be converted to take a MutableHandleValue for their out parameter rather than a JS::Value*.
There are whole bunch of references to these functions in the browser, and most of them already root the value.
Comment 1•12 years ago
|
||
Why is this a MutableHandleValue, not a HandleValue?
Summary: GC: Convert JS_SetPrototype* to take MutableHandleValue → GC: Convert JS_SetProperty* to take MutableHandleValue
Assignee | ||
Comment 3•12 years ago
|
||
Changes in the rest of the browser
Assignee | ||
Comment 4•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #1)
I don't know why this is, but it's mutable all the way through the system, so I'm preserving the existing behaviour.
Comment 5•12 years ago
|
||
It's a Value* because of 1) rooting concerns and 2) To give get and set ops the same signature, iirc.
I suspect that in practice there is no need for it to be mutable at the API level, and would be very interested in us moving away from that.
Followup is probably fine for that, but we should do that followup.
Comment 6•12 years ago
|
||
Comment on attachment 779253 [details] [diff] [review]
convert-set-property
Review of attachment 779253 [details] [diff] [review]:
-----------------------------------------------------------------
r=me
Attachment #779253 -
Flags: review?(terrence) → review+
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #5)
Right, that sounds like good idea. I've raised bug 896949 for this.
Assignee | ||
Updated•12 years ago
|
Attachment #779254 -
Flags: review?(bzbarsky)
Comment 8•12 years ago
|
||
Comment on attachment 779254 [details] [diff] [review]
convert-set-property-browser
> +++ b/dom/bluetooth/BluetoothUtils.cpp
Ugh. Clearly we're not running the static analysis on this file. :( Want to just fix the aObj hazard too by making it a handle and using a Rooted in the callers? Also, maybe move the decl of jsData into the block where it's actually used (you'll need to add curlies for that case of the switch) so it's clearly not a rooting hazard? Followup is ok for this part.
> +++ b/dom/camera/CameraRecorderProfiles.h
>- JSObject* video;
>+ JS::Rooted<JSObject*> object(aCx);
I'd prefer we keep the existing naming (and the separate stack variables for "video" and "audio").
r=me with those nits
Attachment #779254 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 9•12 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #8)
Cheers, I'll just go ahead and fix the BluetoothUtils.cpp rooting in this bug.
Assignee | ||
Updated•12 years ago
|
Blocks: ExactRootingBrowser
Assignee | ||
Comment 10•12 years ago
|
||
Comment 11•12 years ago
|
||
For what it's worth, it's better to fold patches like this together, since the browser doesn't build with just one of them pushed and that makes bisecting suck....
Comment 12•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/60f09edcad4f
https://hg.mozilla.org/mozilla-central/rev/8de6a56d2797
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Assignee | ||
Updated•11 years ago
|
Blocks: 773686
Keywords: dev-doc-needed
Comment 13•10 years ago
|
||
The docs look updated to me (thanks, :arai!)
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/JSAPI_reference/JS_SetProperty
Technical review appreciated.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•