Closed
Bug 583099
Opened 14 years ago
Closed 14 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)
(deleted),
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•14 years ago
|
||
If jst says so! jorendorff, does this look right to you?
Comment 2•14 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•14 years ago
|
||
Comment on attachment 462527 [details] [diff] [review]
patch
Will do. Simple correctness fix; requesting approval.
Attachment #462527 -
Flags: approval2.0?
Updated•14 years ago
|
blocking2.0: --- → beta4+
Updated•14 years ago
|
Attachment #462527 -
Flags: approval2.0?
Assignee | ||
Comment 4•14 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 5•14 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•