Closed Bug 82845 Opened 23 years ago Closed 23 years ago

Add private data type flags for JSContext

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla0.9.4

People

(Reporter: jst, Assigned: brendan)

Details

(Keywords: js1.5)

Attachments

(1 file)

Currently there's no way to know anything about the type of private data held in
a JSContext, all you get is a void*. This makes it unsafe to call
JS_GetContextPrivate() and cast the void* to something like a nsISupports* and
then calling QuertyInterface() on that pointer. We need something like the
JSClass->flags and a set of flags (one of which should be equvalent of
JSCLASS_PRIVATE_IS_NSISUPPORTS) to bullet proof code that accesses the private
data in JSContext's.

Maybe something like:

extern JS_PUBLIC_API(uint32)
JS_GetContextFlags(JSContext *cx);
Status: NEW → ASSIGNED
Keywords: js1.5, mozilla0.9.2
Priority: -- → P3
Target Milestone: --- → mozilla0.9.2
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Too easy not to do soon.  Hey, maybe I'll sneak this into the FastLoad branch.

/be
Target Milestone: mozilla0.9.3 → mozilla0.9.4
Attached patch proposed fixSplinter Review
I don't feel the need to bloat JSContext with yet another word when so many bits
remain unallocated from cx->options.  Thus, JSOPTION_PRIVATE_IS_NSISUPPORTS and
code to test and set it in dom/src/base and js/src/xpconnect/src.  The changes
to nsGlobalWindow.cpp are :: madness before JS_Foo() and a needed initializer
for a cx variable that could be used before set (in the unlikely event that the
xpconnect per-thread context stack is unavailable).

Cc'ing review pals.

/be
cool. r/sr=waterson
sr=jst, I like it!
Fixed.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Marking Verified -
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: