Changeset 27885 in webkit for trunk/JavaScriptCore/API/JSContextRef.cpp
- Timestamp:
- Nov 18, 2007, 1:09:27 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/JSContextRef.cpp
r27730 r27885 32 32 33 33 #include "JSCallbackObject.h" 34 #include "JSClassRef.h" 34 35 #include "JSGlobalObject.h" 35 36 #include "completion.h" … … 43 44 JSLock lock; 44 45 45 JSGlobalObject* globalObject; 46 if (globalObjectClass) 47 // Specify jsNull() as the prototype. Interpreter will fix it up to point at builtinObjectPrototype() in its constructor 48 globalObject = new JSCallbackObject<JSGlobalObject>(0, globalObjectClass, jsNull(), 0); 49 else 50 globalObject = new JSGlobalObject(); 46 Interpreter* interpreter = new Interpreter(); 47 ExecState* globalExec = interpreter->globalExec(); 48 JSGlobalContextRef ctx = toGlobalRef(globalExec); 51 49 52 Interpreter* interpreter = new Interpreter(globalObject); // adds the built-in object prototype to the global object 53 if (globalObjectClass) 54 static_cast<JSCallbackObject<JSGlobalObject>*>(globalObject)->initializeIfNeeded(interpreter->globalExec()); 55 JSGlobalContextRef ctx = reinterpret_cast<JSGlobalContextRef>(interpreter->globalExec()); 50 if (globalObjectClass) { 51 JSObject* prototype = globalObjectClass->prototype(ctx); 52 JSCallbackObject<JSGlobalObject>* globalObject = new JSCallbackObject<JSGlobalObject>(globalObjectClass, prototype ? prototype : jsNull(), 0); 53 interpreter->setGlobalObject(globalObject); 54 globalObject->init(globalExec); 55 } else 56 interpreter->setGlobalObject(new JSGlobalObject()); 57 56 58 return JSGlobalContextRetain(ctx); 57 59 }
Note:
See TracChangeset
for help on using the changeset viewer.