Changeset 31267 in webkit
- Timestamp:
- Mar 24, 2008 7:26:24 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/API/testapi.c
r30795 r31267 870 870 v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL); 871 871 ASSERT(JSValueIsEqual(context, v, o, NULL)); 872 872 873 functionBody = JSStringCreateWithUTF8CString("return eval(\"this\");"); 874 function = JSObjectMakeFunction(context, NULL, 0, NULL, functionBody, NULL, 1, NULL); 875 JSStringRelease(functionBody); 876 v = JSObjectCallAsFunction(context, function, NULL, 0, NULL, NULL); 877 ASSERT(JSValueIsEqual(context, v, globalObject, NULL)); 878 v = JSObjectCallAsFunction(context, function, o, 0, NULL, NULL); 879 ASSERT(JSValueIsEqual(context, v, o, NULL)); 880 881 JSStringRef script = JSStringCreateWithUTF8CString("this;"); 882 v = JSEvaluateScript(context, script, NULL, NULL, 0, NULL); 883 ASSERT(JSValueIsEqual(context, v, globalObject, NULL)); 884 v = JSEvaluateScript(context, script, o, NULL, 0, NULL); 885 ASSERT(JSValueIsEqual(context, v, o, NULL)); 886 JSStringRelease(script); 887 888 script = JSStringCreateWithUTF8CString("eval(this);"); 889 v = JSEvaluateScript(context, script, NULL, NULL, 0, NULL); 890 ASSERT(JSValueIsEqual(context, v, globalObject, NULL)); 891 v = JSEvaluateScript(context, script, o, NULL, 0, NULL); 892 ASSERT(JSValueIsEqual(context, v, o, NULL)); 893 JSStringRelease(script); 894 873 895 char* scriptUTF8 = createStringWithContentsOfFile(scriptPath); 874 896 if (!scriptUTF8) 875 897 printf("FAIL: Test script could not be loaded.\n"); 876 898 else { 877 JSStringRefscript = JSStringCreateWithUTF8CString(scriptUTF8);899 script = JSStringCreateWithUTF8CString(scriptUTF8); 878 900 result = JSEvaluateScript(context, script, NULL, NULL, 1, &exception); 879 901 if (JSValueIsUndefined(context, result)) -
trunk/JavaScriptCore/ChangeLog
r31229 r31267 1 2008-03-23 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Fix http://bugs.webkit.org/show_bug.cgi?id=18048 6 The "thisObject" parameter to JSEvaluateScript is not used properly 7 8 Making passing a thisObject to JSEvaluateScript actually set the thisObject of the created 9 ExecState. 10 11 * API/testapi.c: 12 (main): Add tests for setting the thisObject when calling JSEvaluateScript. 13 14 * kjs/ExecState.cpp: 15 (KJS::ExecState::ExecState): Assign the thisObject to m_thisValue and remove the comment. 16 1 17 2008-03-22 Jesse Ruderman <jruderman@gmail.com> 2 18 -
trunk/JavaScriptCore/kjs/ExecState.cpp
r31173 r31267 64 64 } 65 65 66 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* /*thisObject*/, ProgramNode* programNode)66 inline ExecState::ExecState(JSGlobalObject* globalObject, JSObject* thisObject, ProgramNode* programNode) 67 67 : m_globalObject(globalObject) 68 68 , m_exception(0) … … 77 77 , m_inlineScopeChainNode(0, 0) 78 78 , m_variableObject(globalObject) 79 , m_thisValue( globalObject)79 , m_thisValue(thisObject) 80 80 , m_iterationDepth(0) 81 81 , m_switchDepth(0) 82 82 , m_codeType(GlobalCode) 83 83 { 84 // FIXME: This function ignores the "thisObject" parameter, which means that the API for evaluating85 // a script with a this object that's not the same as the global object is broken, and probably86 // has been for some time.87 84 ASSERT(m_scopeNode); 88 85 m_scopeChain.push(globalObject); -
trunk/WebCore/ChangeLog
r31258 r31267 1 2008-03-24 Sam Weinig <sam@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Fix http://bugs.webkit.org/show_bug.cgi?id=18048 6 The "thisObject" parameter to JSEvaluateScript is not used properly 7 8 * bindings/js/kjs_proxy.cpp: 9 (WebCore::KJSProxy::evaluate): No need to pass a thisObject since we want the global object to be used. 10 * bridge/jni/jni_jsobject.mm: 11 (JavaJSObject::eval): To avoid any change to this function, don't pass a thisObject to keep the same 12 behavior. 13 1 14 2008-03-24 Brady Eidson <beidson@apple.com> 2 15 -
trunk/WebCore/bindings/js/kjs_proxy.cpp
r31197 r31267 83 83 m_frame->keepAlive(); 84 84 85 // FIXME: Can this call to toJSDOMWindow be replaced by using m_globalObject.86 JSValue* thisNode = toJSDOMWindow(m_frame);87 88 85 m_globalObject->startTimeoutCheck(); 89 Completion comp = Interpreter::evaluate(exec, filename, baseLine, str.characters(), str.length() , thisNode);86 Completion comp = Interpreter::evaluate(exec, filename, baseLine, str.characters(), str.length()); 90 87 m_globalObject->stopTimeoutCheck(); 91 88 -
trunk/WebCore/bridge/jni/jni_jsobject.mm
r31076 r31267 311 311 JS_LOG ("script = %s\n", JavaString(script).UTF8String()); 312 312 313 JSObject *thisObj = const_cast<JSObject*>(_imp); 314 JSValue *result; 315 313 JSValue* result; 314 316 315 JSLock lock; 317 316 … … 321 320 322 321 rootObject->globalObject()->startTimeoutCheck(); 323 Completion completion = Interpreter::evaluate(rootObject->globalObject()->globalExec(), UString(), 0, JavaString(script).ustring() ,thisObj);322 Completion completion = Interpreter::evaluate(rootObject->globalObject()->globalExec(), UString(), 0, JavaString(script).ustring()); 324 323 rootObject->globalObject()->stopTimeoutCheck(); 325 324 ComplType type = completion.complType();
Note: See TracChangeset
for help on using the changeset viewer.