Changeset 111611 in webkit
- Timestamp:
- Mar 21, 2012 3:34:29 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r111610 r111611 1 2012-03-21 Adam Klein <adamk@chromium.org> 2 3 "this" argument for MutationCallbacks should be the MutationObserver 4 https://bugs.webkit.org/show_bug.cgi?id=81712 5 6 Reviewed by Adam Barth. 7 8 Merged new test with existing second-argument test. 9 10 * fast/mutation/callback-arguments-expected.txt: Added. 11 * fast/mutation/callback-arguments.html: Added. 12 * fast/mutation/callback-second-argument-expected.txt: Removed. 13 * fast/mutation/callback-second-argument.html: Removed. 14 1 15 2012-03-21 Alexandru Chiculita <achicu@adobe.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r111610 r111611 1 2012-03-21 Adam Klein <adamk@chromium.org> 2 3 "this" argument for MutationCallbacks should be the MutationObserver 4 https://bugs.webkit.org/show_bug.cgi?id=81712 5 6 Reviewed by Adam Barth. 7 8 Test: fast/mutation/callback-arguments.html 9 10 * bindings/js/JSCallbackData.cpp: 11 (WebCore::JSCallbackData::invokeCallback): Add an overload that takes 12 an explicit this argument and have the old method call the new one. 13 * bindings/js/JSCallbackData.h: 14 (JSCallbackData): 15 * bindings/js/JSMutationCallbackCustom.cpp: 16 (WebCore::JSMutationCallback::handleEvent): Call the new overload. 17 * bindings/v8/custom/V8CustomVoidCallback.cpp: 18 (WebCore::invokeCallback): Add an overload that takes an explicit this 19 argument and have the old method call the new one. 20 * bindings/v8/custom/V8CustomVoidCallback.h: 21 (WebCore): 22 * bindings/v8/custom/V8MutationCallbackCustom.cpp: 23 (WebCore::V8MutationCallback::handleEvent): Call the new overload. 24 1 25 2012-03-21 Alexandru Chiculita <achicu@adobe.com> 2 26 -
trunk/Source/WebCore/bindings/js/JSCallbackData.cpp
r109568 r111611 46 46 { 47 47 ASSERT(callback()); 48 return invokeCallback(callback(), args, raisedException); 49 } 50 51 JSValue JSCallbackData::invokeCallback(JSValue thisValue, MarkedArgumentBuffer& args, bool* raisedException) 52 { 53 ASSERT(callback()); 48 54 ASSERT(globalObject()); 49 55 … … 59 65 return JSValue(); 60 66 } 61 67 62 68 ScriptExecutionContext* context = globalObject()->scriptExecutionContext(); 63 69 // We will fail to get the context if the frame has been detached. … … 70 76 bool contextIsDocument = context->isDocument(); 71 77 JSValue result = contextIsDocument 72 ? JSMainThreadExecState::call(exec, function, callType, callData, callback(), args)73 : JSC::call(exec, function, callType, callData, callback(), args);78 ? JSMainThreadExecState::call(exec, function, callType, callData, thisValue, args) 79 : JSC::call(exec, function, callType, callData, thisValue, args); 74 80 75 81 InspectorInstrumentation::didCallFunction(cookie); … … 85 91 return result; 86 92 } 87 93 88 94 return result; 89 95 } 90 96 91 97 } // namespace WebCore -
trunk/Source/WebCore/bindings/js/JSCallbackData.h
r96465 r111611 66 66 67 67 JSC::JSValue invokeCallback(JSC::MarkedArgumentBuffer&, bool* raisedException = 0); 68 JSC::JSValue invokeCallback(JSC::JSValue thisValue, JSC::MarkedArgumentBuffer&, bool* raisedException = 0); 68 69 69 70 private: -
trunk/Source/WebCore/bindings/js/JSMutationCallbackCustom.cpp
r97159 r111611 59 59 mutationList.append(toJS(exec, m_data->globalObject(), mutations->at(i).get())); 60 60 61 JSValue jsObserver = toJS(exec, m_data->globalObject(), observer); 62 61 63 MarkedArgumentBuffer args; 62 64 args.append(constructArray(exec, m_data->globalObject(), mutationList)); 63 args.append( toJS(exec, m_data->globalObject(), observer));65 args.append(jsObserver); 64 66 65 67 bool raisedException = false; 66 m_data->invokeCallback( args, &raisedException);68 m_data->invokeCallback(jsObserver, args, &raisedException); 67 69 return !raisedException; 68 70 } -
trunk/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.cpp
r107170 r111611 66 66 bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext) 67 67 { 68 return invokeCallback(callback, v8::Context::GetCurrent()->Global(), argc, argv, callbackReturnValue, scriptExecutionContext); 69 } 70 71 bool invokeCallback(v8::Persistent<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext) 72 { 68 73 v8::TryCatch exceptionCatcher; 69 74 exceptionCatcher.SetVerbose(true); … … 82 87 return false; 83 88 84 v8::Handle<v8::Object> thisObject = v8::Context::GetCurrent()->Global();85 86 89 Frame* frame = scriptExecutionContext && scriptExecutionContext->isDocument() ? static_cast<Document*>(scriptExecutionContext)->frame() : 0; 87 90 v8::Handle<v8::Value> result = V8Proxy::instrumentedCallFunction(frame, callbackFunction, thisObject, argc, argv); -
trunk/Source/WebCore/bindings/v8/custom/V8CustomVoidCallback.h
r95901 r111611 62 62 63 63 // Returns false if callback failed (null, wrong type, or threw exception). 64 bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext* scriptExecutionContext); 64 bool invokeCallback(v8::Persistent<v8::Object> callback, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*); 65 bool invokeCallback(v8::Persistent<v8::Object> callback, v8::Handle<v8::Object> thisObject, int argc, v8::Handle<v8::Value> argv[], bool& callbackReturnValue, ScriptExecutionContext*); 65 66 66 67 } // namespace WebCore -
trunk/Source/WebCore/bindings/v8/custom/V8MutationCallbackCustom.cpp
r110131 r111611 76 76 } 77 77 78 if (!observerHandle->IsObject()) 79 return true; 80 78 81 v8::Handle<v8::Value> argv[] = { 79 82 mutationsArray, … … 82 85 83 86 bool callbackReturnValue = false; 84 return !invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext());87 return !invokeCallback(m_callback, v8::Handle<v8::Object>::Cast(observerHandle), 2, argv, callbackReturnValue, scriptExecutionContext()); 85 88 } 86 89
Note: See TracChangeset
for help on using the changeset viewer.