Changeset 15149 in webkit for trunk/JavaScriptCore/API/JSContextRef.cpp
- Timestamp:
- Jul 3, 2006, 7:35:09 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSContextRef.cpp
r15133 r15149 72 72 } 73 73 74 bool JSEvaluate(JSContextRef context, JSValueRef thisValue, JSCharBufferRef script, JSCharBufferRef sourceURL, int startingLineNumber, JSValueRef* returnValue)74 JSValueRef JSEvaluate(JSContextRef context, JSCharBufferRef script, JSValueRef thisValue, JSCharBufferRef sourceURL, int startingLineNumber, JSValueRef* exception) 75 75 { 76 76 JSLock lock; … … 79 79 UString::Rep* scriptRep = toJS(script); 80 80 UString::Rep* sourceURLRep = toJS(sourceURL); 81 // Interpreter::evaluate sets thisValue to the global object if it is NULL 81 82 Completion completion = exec->dynamicInterpreter()->evaluate(UString(sourceURLRep), startingLineNumber, UString(scriptRep), jsThisValue); 82 83 83 if (returnValue) 84 *returnValue = completion.value() ? toRef(completion.value()) : toRef(jsUndefined()); 85 86 return completion.complType() != Throw; 84 if (completion.complType() == Throw) { 85 if (exception) 86 *exception = completion.value(); 87 return NULL; 88 } 89 90 if (completion.value()) 91 return toRef(completion.value()); 92 93 // happens, for example, when the only statement is an empty (';') statement 94 return toRef(jsUndefined()); 87 95 } 88 96 … … 93 101 UString::Rep* rep = toJS(script); 94 102 return exec->dynamicInterpreter()->checkSyntax(UString(rep)); 95 }96 97 bool JSContextHasException(JSContextRef context)98 {99 ExecState* exec = toJS(context);100 return exec->hadException();101 103 } 102 104
Note:
See TracChangeset
for help on using the changeset viewer.