Closed Bug 583099 Opened 14 years ago Closed 14 years ago

toolkit/components/ctypes uses the wrong global object

Categories

(Core :: js-ctypes, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- beta4+

People

(Reporter: zwol, Assigned: dwitte)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

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; }
Attached patch patch (deleted) — Splinter Review
If jst says so! jorendorff, does this look right to you?
Assignee: nobody → dwitte
Status: NEW → ASSIGNED
Attachment #462527 - Flags: review?(jorendorff)
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+
Comment on attachment 462527 [details] [diff] [review] patch Will do. Simple correctness fix; requesting approval.
Attachment #462527 - Flags: approval2.0?
blocking2.0: --- → beta4+
Attachment #462527 - Flags: approval2.0?
Whiteboard: fixed-in-tracemonkey
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.

Attachment

General

Created:
Updated:
Size: