Closed
Bug 583099
Opened 15 years ago
Closed 15 years ago
toolkit/components/ctypes uses the wrong global object
Categories
(Core :: js-ctypes, defect)
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| blocking2.0 | --- | beta4+ |
People
(Reporter: zwol, Assigned: dwitte)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
|
802 bytes,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
http://mxr.mozilla.org/mozilla-central/source/toolkit/components/ctypes/Module.cpp#107 reads:
107 NS_IMETHODIMP
108 Module::Call(nsIXPConnectWrappedNative* wrapper,
109 JSContext* cx,
110 JSObject* obj,
111 PRUint32 argc,
112 jsval* argv,
113 jsval* vp,
114 PRBool* _retval)
115 {
116 JSObject* global = JS_GetGlobalObject(cx);
117 *_retval = InitAndSealCTypesClass(cx, global);
118 return NS_OK;
119 }
Per jst, this is not the correct global object to use here: it should instead look something like this:
{
JSObject* scope = JS_GetScopeChain(cx);
if (!scope)
return NS_ERROR_NOT_AVAILABLE;
JSObject* global = JS_GetGlobalForObject(cx, scope);
if (!global)
return NS_ERROR_NOT_AVAILABLE;
*_retval = InitAndSealCTypesClass(cx, global);
return NS_OK;
}
| Assignee | ||
Comment 1•15 years ago
|
||
If jst says so! jorendorff, does this look right to you?
Comment 2•15 years ago
|
||
Comment on attachment 462527 [details] [diff] [review]
patch
Right ...but you might as well use JS_GetGlobalForScopeChain(cx), which does the same thing in a single call.
Attachment #462527 -
Flags: review?(jorendorff) → review+
| Assignee | ||
Comment 3•15 years ago
|
||
Comment on attachment 462527 [details] [diff] [review]
patch
Will do. Simple correctness fix; requesting approval.
Attachment #462527 -
Flags: approval2.0?
Updated•15 years ago
|
blocking2.0: --- → beta4+
Updated•15 years ago
|
Attachment #462527 -
Flags: approval2.0?
| Assignee | ||
Comment 4•15 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 5•15 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•