JavaScript-1.5 Reference

JS_NewContext Function

Summary

Creates a new JavaScript context.

Syntax

JSContext * JS_NewContext(JSRuntime *rt, size_t stacksize);
NameTypeDescription
*rtJSRuntimePointer to a previously established JS run-time environment with which to associate this context.
stacksizesize_tThe size, in bytes, of the execution stack space to allocate for the context.

Description

JS_NewContext creates a new JavaScript context for an executing script or thread. Each script or thread is associated with its own context, and each context must be associated with a specified JSRuntime, rt. A context specifies a stack size for the script, the amount, in bytes, of private memory to allocate to the execution stack for the script.

Generally you use JS_NewContext to generate a context for each separate script in a HTML page or frame.

If a call to JS_NewContext is successful, it returns a pointer to the new context. Otherwise it returns NULL.

Notes

Once established, a context can be used any number of times for different scripts or threads so long as it's associated via JS_SetContextThread with only one thread at a time.

See Also

Groups [ Function ]
Documents [ LXR ID Search ]
Entries [ JS_ContextIterator | JS_DestroyContext | JS_SetContextThread ]

This page was generated by APIDOC