⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsapi.h

📁 java script test programing source code
💻 H
📖 第 1 页 / 共 5 页
字号:
                                     JSPropertyOp *getterp,                                     JSPropertyOp *setterp);/* * Set the attributes of a property on a given object. * * If the object does not have a property by that name, *foundp will be * JS_FALSE and nothing will be altered. */extern JS_PUBLIC_API(JSBool)JS_SetUCPropertyAttributes(JSContext *cx, JSObject *obj,                           const jschar *name, size_t namelen,                           uintN attrs, JSBool *foundp);extern JS_PUBLIC_API(JSBool)JS_DefineUCPropertyWithTinyId(JSContext *cx, JSObject *obj,                              const jschar *name, size_t namelen,                              int8 tinyid, jsval value,                              JSPropertyOp getter, JSPropertyOp setter,                              uintN attrs);extern JS_PUBLIC_API(JSBool)JS_HasUCProperty(JSContext *cx, JSObject *obj,                 const jschar *name, size_t namelen,                 JSBool *vp);extern JS_PUBLIC_API(JSBool)JS_LookupUCProperty(JSContext *cx, JSObject *obj,                    const jschar *name, size_t namelen,                    jsval *vp);extern JS_PUBLIC_API(JSBool)JS_GetUCProperty(JSContext *cx, JSObject *obj,                 const jschar *name, size_t namelen,                 jsval *vp);extern JS_PUBLIC_API(JSBool)JS_SetUCProperty(JSContext *cx, JSObject *obj,                 const jschar *name, size_t namelen,                 jsval *vp);extern JS_PUBLIC_API(JSBool)JS_DeleteUCProperty2(JSContext *cx, JSObject *obj,                     const jschar *name, size_t namelen,                     jsval *rval);extern JS_PUBLIC_API(JSObject *)JS_NewArrayObject(JSContext *cx, jsint length, jsval *vector);extern JS_PUBLIC_API(JSBool)JS_IsArrayObject(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSBool)JS_GetArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp);extern JS_PUBLIC_API(JSBool)JS_SetArrayLength(JSContext *cx, JSObject *obj, jsuint length);extern JS_PUBLIC_API(JSBool)JS_HasArrayLength(JSContext *cx, JSObject *obj, jsuint *lengthp);extern JS_PUBLIC_API(JSBool)JS_DefineElement(JSContext *cx, JSObject *obj, jsint index, jsval value,                 JSPropertyOp getter, JSPropertyOp setter, uintN attrs);extern JS_PUBLIC_API(JSBool)JS_AliasElement(JSContext *cx, JSObject *obj, const char *name, jsint alias);extern JS_PUBLIC_API(JSBool)JS_HasElement(JSContext *cx, JSObject *obj, jsint index, JSBool *foundp);extern JS_PUBLIC_API(JSBool)JS_LookupElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_GetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_SetElement(JSContext *cx, JSObject *obj, jsint index, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_DeleteElement(JSContext *cx, JSObject *obj, jsint index);extern JS_PUBLIC_API(JSBool)JS_DeleteElement2(JSContext *cx, JSObject *obj, jsint index, jsval *rval);extern JS_PUBLIC_API(void)JS_ClearScope(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSIdArray *)JS_Enumerate(JSContext *cx, JSObject *obj);/* * Create an object to iterate over enumerable properties of obj, in arbitrary * property definition order.  NB: This differs from longstanding for..in loop * order, which uses order of property definition in obj. */extern JS_PUBLIC_API(JSObject *)JS_NewPropertyIterator(JSContext *cx, JSObject *obj);/* * Return true on success with *idp containing the id of the next enumerable * property to visit using iterobj, or JSVAL_VOID if there is no such property * left to visit.  Return false on error. */extern JS_PUBLIC_API(JSBool)JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp);extern JS_PUBLIC_API(JSBool)JS_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode,               jsval *vp, uintN *attrsp);extern JS_PUBLIC_API(JSCheckAccessOp)JS_SetCheckObjectAccessCallback(JSRuntime *rt, JSCheckAccessOp acb);extern JS_PUBLIC_API(JSBool)JS_GetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval *vp);extern JS_PUBLIC_API(JSBool)JS_SetReservedSlot(JSContext *cx, JSObject *obj, uint32 index, jsval v);/************************************************************************//* * Security protocol. */struct JSPrincipals {    char *codebase;    /* XXX unspecified and unused by Mozilla code -- can we remove these? */    void * (* JS_DLL_CALLBACK getPrincipalArray)(JSContext *cx, JSPrincipals *);    JSBool (* JS_DLL_CALLBACK globalPrivilegesEnabled)(JSContext *cx, JSPrincipals *);    /* Don't call "destroy"; use reference counting macros below. */    jsrefcount refcount;    void   (* JS_DLL_CALLBACK destroy)(JSContext *cx, JSPrincipals *);    JSBool (* JS_DLL_CALLBACK subsume)(JSPrincipals *, JSPrincipals *);};#ifdef JS_THREADSAFE#define JSPRINCIPALS_HOLD(cx, principals)   JS_HoldPrincipals(cx,principals)#define JSPRINCIPALS_DROP(cx, principals)   JS_DropPrincipals(cx,principals)extern JS_PUBLIC_API(jsrefcount)JS_HoldPrincipals(JSContext *cx, JSPrincipals *principals);extern JS_PUBLIC_API(jsrefcount)JS_DropPrincipals(JSContext *cx, JSPrincipals *principals);#else#define JSPRINCIPALS_HOLD(cx, principals)   (++(principals)->refcount)#define JSPRINCIPALS_DROP(cx, principals)                                     \    ((--(principals)->refcount == 0)                                          \     ? ((*(principals)->destroy)((cx), (principals)), 0)                      \     : (principals)->refcount)#endifextern JS_PUBLIC_API(JSPrincipalsTranscoder)JS_SetPrincipalsTranscoder(JSRuntime *rt, JSPrincipalsTranscoder px);extern JS_PUBLIC_API(JSObjectPrincipalsFinder)JS_SetObjectPrincipalsFinder(JSRuntime *rt, JSObjectPrincipalsFinder fop);/************************************************************************//* * Functions and scripts. */extern JS_PUBLIC_API(JSFunction *)JS_NewFunction(JSContext *cx, JSNative call, uintN nargs, uintN flags,               JSObject *parent, const char *name);extern JS_PUBLIC_API(JSObject *)JS_GetFunctionObject(JSFunction *fun);/* * Deprecated, useful only for diagnostics.  Use JS_GetFunctionId instead for * anonymous vs. "anonymous" disambiguation and Unicode fidelity. */extern JS_PUBLIC_API(const char *)JS_GetFunctionName(JSFunction *fun);/* * Return the function's identifier as a JSString, or null if fun is unnamed. * The returned string lives as long as fun, so you don't need to root a saved * reference to it if fun is well-connected or rooted, and provided you bound * the use of the saved reference by fun's lifetime. * * Prefer JS_GetFunctionId over JS_GetFunctionName because it returns null for * truly anonymous functions, and because it doesn't chop to ISO-Latin-1 chars * from UTF-16-ish jschars. */extern JS_PUBLIC_API(JSString *)JS_GetFunctionId(JSFunction *fun);/* * Return JSFUN_* flags for fun. */extern JS_PUBLIC_API(uintN)JS_GetFunctionFlags(JSFunction *fun);/* * Return the arity (length) of fun. */extern JS_PUBLIC_API(uint16)JS_GetFunctionArity(JSFunction *fun);/* * Infallible predicate to test whether obj is a function object (faster than * comparing obj's class name to "Function", but equivalent unless someone has * overwritten the "Function" identifier with a different constructor and then * created instances using that constructor that might be passed in as obj). */extern JS_PUBLIC_API(JSBool)JS_ObjectIsFunction(JSContext *cx, JSObject *obj);extern JS_PUBLIC_API(JSBool)JS_DefineFunctions(JSContext *cx, JSObject *obj, JSFunctionSpec *fs);extern JS_PUBLIC_API(JSFunction *)JS_DefineFunction(JSContext *cx, JSObject *obj, const char *name, JSNative call,                  uintN nargs, uintN attrs);extern JS_PUBLIC_API(JSFunction *)JS_DefineUCFunction(JSContext *cx, JSObject *obj,                    const jschar *name, size_t namelen, JSNative call,                    uintN nargs, uintN attrs);extern JS_PUBLIC_API(JSObject *)JS_CloneFunctionObject(JSContext *cx, JSObject *funobj, JSObject *parent);/* * Given a buffer, return JS_FALSE if the buffer might become a valid * javascript statement with the addition of more lines.  Otherwise return * JS_TRUE.  The intent is to support interactive compilation - accumulate * lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to * the compiler. */extern JS_PUBLIC_API(JSBool)JS_BufferIsCompilableUnit(JSContext *cx, JSObject *obj,                          const char *bytes, size_t length);/* * The JSScript objects returned by the following functions refer to string and * other kinds of literals, including doubles and RegExp objects.  These * literals are vulnerable to garbage collection; to root script objects and * prevent literals from being collected, create a rootable object using * JS_NewScriptObject, and root the resulting object using JS_Add[Named]Root. */extern JS_PUBLIC_API(JSScript *)JS_CompileScript(JSContext *cx, JSObject *obj,                 const char *bytes, size_t length,                 const char *filename, uintN lineno);extern JS_PUBLIC_API(JSScript *)JS_CompileScriptForPrincipals(JSContext *cx, JSObject *obj,                              JSPrincipals *principals,                              const char *bytes, size_t length,                              const char *filename, uintN lineno);extern JS_PUBLIC_API(JSScript *)JS_CompileUCScript(JSContext *cx, JSObject *obj,                   const jschar *chars, size_t length,                   const char *filename, uintN lineno);extern JS_PUBLIC_API(JSScript *)JS_CompileUCScriptForPrincipals(JSContext *cx, JSObject *obj,                                JSPrincipals *principals,                                const jschar *chars, size_t length,                                const char *filename, uintN lineno);extern JS_PUBLIC_API(JSScript *)JS_CompileFile(JSContext *cx, JSObject *obj, const char *filename);extern JS_PUBLIC_API(JSScript *)JS_CompileFileHandle(JSContext *cx, JSObject *obj, const char *filename,                     FILE *fh);extern JS_PUBLIC_API(JSScript *)JS_CompileFileHandleForPrincipals(JSContext *cx, JSObject *obj,                                  const char *filename, FILE *fh,                                  JSPrincipals *principals);/* * NB: you must use JS_NewScriptObject and root a pointer to its return value * in order to keep a JSScript and its atoms safe from garbage collection after * creating the script via JS_Compile* and before a JS_ExecuteScript* call. * E.g., and without error checks: * *    JSScript *script = JS_CompileFile(cx, global, filename); *    JSObject *scrobj = JS_NewScriptObject(cx, script); *    JS_AddNamedRoot(cx, &scrobj, "scrobj"); *    do { *        jsval result; *        JS_ExecuteScript(cx, global, script, &result); *        JS_GC(); *    } while (!JSVAL_IS_BOOLEAN(result) || JSVAL_TO_BOOLEAN(result)); *    JS_RemoveRoot(cx, &scrobj); */extern JS_PUBLIC_API(JSObject *)JS_NewScriptObject(JSContext *cx, JSScript *script);/* * Infallible getter for a script's object.  If JS_NewScriptObject has not been * called on script yet, the return value will be null. */extern JS_PUBLIC_API(JSObject *)JS_GetScriptObject(JSScript *script);extern JS_PUBLIC_API(void)JS_DestroyScript(JSContext *cx, JSScript *script);extern JS_PUBLIC_API(JSFunction *)JS_CompileFunction(JSContext *cx, JSObject *obj, const char *name,                   uintN nargs, const char **argnames,                   const char *bytes, size_t length,                   const char *filename, uintN lineno);extern JS_PUBLIC_API(JSFunction *)JS_CompileFunctionForPrincipals(JSContext *cx, JSObject *obj,                                JSPrincipals *principals, const char *name,                                uintN nargs, const char **argnames,                                const char *bytes, size_t length,                                const char *filename, uintN lineno);extern JS_PUBLIC_API(JSFunction *)JS_CompileUCFunction(JSContext *cx, JSObject *obj, const char *name,                     uintN nargs, const char **argnames,                     const jschar *chars, size_t length,                     const char *filename, uintN lineno);extern JS_PUBLIC_API(JSFunction *)JS_CompileUCFunctionForPrincipals(JSContext *cx, JSObject *obj,                                  JSPrincipals *principals, const char *name,                                  uintN nargs, const char **argnames,                                  const jschar *chars, size_t length,                       

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -