Changeset 15224 in webkit for trunk/JavaScriptCore/API/JSContextRef.h
- Timestamp:
- Jul 7, 2006, 7:02:47 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSContextRef.h
r15212 r15224 35 35 #endif 36 36 37 JSContextRef JSContextCreate(JSClassRef globalObjectClass, JSObjectRef globalObjectPrototype); 37 /*! 38 @function 39 @abstract Creates a JavaScript execution context. 40 @discussion JSContextCreate allocates a global object and populates it with all the 41 built-in JavaScript objects, such as Object, Function, String, and Array. 42 @param globalObjectClass The class to use when creating the JSContext's global object. 43 Pass NULL to use the default object class. 44 @result A JSContext with a global object of class globalObjectClass. 45 */ 46 JSContextRef JSContextCreate(JSClassRef globalObjectClass); 47 48 /*! 49 @function 50 @abstract Destroys a JavaScript execution context, freeing its resources. 51 @param context The JSContext to destroy. 52 */ 38 53 void JSContextDestroy(JSContextRef context); 39 54 55 /*! 56 @function 57 @abstract Returns the global object of a JavaScript execution context. 58 @param context The JSContext whose global object you want to retrieve. 59 @result context's global object. 60 */ 40 61 JSObjectRef JSContextGetGlobalObject(JSContextRef context); 41 62 42 JSValueRef JSContextGetException(JSContextRef context); // NULL if there is no exception 63 /*! 64 @function 65 @abstract Returns the current exception in a JavaScript execution context. 66 @param context The JSContext whose exception you want to retrieve. 67 @result A JSValue representing context's exception, or NULL if no exception has been set. 68 */ 69 JSValueRef JSContextGetException(JSContextRef context); 70 /*! 71 @function 72 @abstract Sets an exception in a JavaScript execution context. 73 @param context The JSContext whose exception you want to set. 74 @param value The exception you want to set. 75 */ 43 76 void JSContextSetException(JSContextRef context, JSValueRef value); 77 /*! 78 @function 79 @abstract Clears the exception in a JavaScript execution context. 80 @param context The JSContext whose exception you want to clear. 81 */ 44 82 void JSContextClearException(JSContextRef context); 45 83 46 84 // Evaluation 47 85 /*! 48 @function JSEvaluate 49 Evaluates a string of JavaScript 50 @param context execution context to use 51 @param script a character buffer containing the JavaScript to evaluate 52 @param thisObject the object to use as "this," or NULL to use the global object as "this."53 @param sourceURL URL to the file containing the JavaScript, or NULL - this is only used for error reporting 54 @param startingLineNumber the JavaScript's starting line number in the file located at sourceURL - this is only used for error reporting 55 @param exception pointer to a JSValueRef in which to store an uncaught exception, if any; can be NULL 56 @result result of evaluation, or NULL if an uncaught exception was thrown 86 @function 87 @abstract Evaluates a string of JavaScript. 88 @param context The execution context to use. 89 @param script A JSStringBuffer containing the script to evaluate. 90 @param thisObject The object to use as "this," or NULL to use the global object as "this." 91 @param sourceURL A JSStringBuffer containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. 92 @param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. 93 @param exception A pointer to a JSValueRef in which to store an uncaught exception, if any. Pass NULL if you do not care to store an uncaught exception. 94 @result The JSValue that results from evaluating script, or NULL if an uncaught exception is thrown. 57 95 */ 58 96 JSValueRef JSEvaluate(JSContextRef context, JSStringBufferRef script, JSObjectRef thisObject, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception); 59 97 60 98 /*! 61 @function JSCheckSyntax 62 Check for syntax errors in a string of JavaScript 63 @param context execution context to use 64 @param script a character buffer containing the JavaScript to evaluate 65 @param sourceURL URL to the file containing the JavaScript, or NULL - this is only used for error reporting 66 @param startingLineNumber the JavaScript's starting line number in the file located at sourceURL - this is only used for error reporting 67 @param exception pointer to a JSValueRef in which to store a syntax error, if any; can be NULL 68 @result true if the script is syntactically correct, false otherwise 69 99 @function JSCheckSyntax 100 @abstract Checks for syntax errors in a string of JavaScript. 101 @param context The execution context to use. 102 @param script A JSStringBuffer containing the JavaScript to check for syntax errors. 103 @param sourceURL A JSStringBuffer containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions. 104 @param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions. 105 @param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception. 106 @result true if the script is syntactically correct, otherwise false. 70 107 */ 71 108 bool JSCheckSyntax(JSContextRef context, JSStringBufferRef script, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception);
Note:
See TracChangeset
for help on using the changeset viewer.