Changeset 15133 in webkit for trunk/JavaScriptCore/API/JSContextRef.cpp
- Timestamp:
- Jul 1, 2006, 9:06:07 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSContextRef.cpp
r14951 r15133 35 35 using namespace KJS; 36 36 37 JSContextRef JSContextCreate( const JSObjectCallbacks* globalObjectCallbacks, JSObjectRef globalObjectPrototype)37 JSContextRef JSContextCreate(JSClassRef globalObjectClass, JSObjectRef globalObjectPrototype) 38 38 { 39 39 JSLock lock; … … 42 42 43 43 JSObject* globalObject; 44 if (globalObjectCallbacks == &kJSObjectCallbacksNone) // slightly more efficient 44 if (globalObjectClass) { 45 if (jsPrototype) 46 globalObject = new JSCallbackObject(globalObjectClass, jsPrototype); 47 else 48 globalObject = new JSCallbackObject(globalObjectClass); 49 } else { 50 // creates a slightly more efficient object 45 51 if (jsPrototype) 46 52 globalObject = new JSObject(jsPrototype); 47 53 else 48 54 globalObject = new JSObject(); 49 else if (jsPrototype) 50 globalObject = new JSCallbackObject(globalObjectCallbacks, jsPrototype); 51 else 52 globalObject = new JSCallbackObject(globalObjectCallbacks); 55 } 53 56 54 57 Interpreter* interpreter = new Interpreter(globalObject); // adds the built-in object prototype to the global object … … 78 81 Completion completion = exec->dynamicInterpreter()->evaluate(UString(sourceURLRep), startingLineNumber, UString(scriptRep), jsThisValue); 79 82 80 *returnValue = toRef(completion.value()); 83 if (returnValue) 84 *returnValue = completion.value() ? toRef(completion.value()) : toRef(jsUndefined()); 85 81 86 return completion.complType() != Throw; 82 87 }
Note:
See TracChangeset
for help on using the changeset viewer.