Changeset 76277 in webkit
- Timestamp:
- Jan 20, 2011 1:39:52 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76276 r76277 1 2011-01-20 James Robinson <jamesr@chromium.org> 2 3 Reviewed by Nate Chapin. 4 5 [v8] CodeGeneratorV8 generates incorrect code for callbacks with no parameters 6 https://bugs.webkit.org/show_bug.cgi?id=52837 7 8 When generating code to invoke a callback with no parameters CodeGeneratorV8.pm was generating the following: 9 v8::Handle<v8::Value> argv[] = {}; which does not compile in visual studio. Instead, if the argument count 10 is 0, we can just pass a NULL pointer for the argv parameter. 11 12 Test added to bindings/scripts/test/TestCallback.idl and covered by run-bindings-tests. This 13 patch also includes some spurious changes to the bindings tests golden files (mostly GObject) 14 because the old golden files were out of date. 15 16 * bindings/scripts/CodeGeneratorV8.pm: 17 * bindings/scripts/test/CPP/WebDOMTestCallback.cpp: 18 (WebDOMTestCallback::callbackWithNoParam): 19 * bindings/scripts/test/CPP/WebDOMTestCallback.h: 20 * bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp: 21 (webkit_dom_test_callback_callback_with_no_param): 22 * bindings/scripts/test/GObject/WebKitDOMTestCallback.h: 23 * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: 24 * bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp: 25 * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: 26 * bindings/scripts/test/JS/JSTestCallback.cpp: 27 (WebCore::JSTestCallback::callbackWithNoParam): 28 * bindings/scripts/test/JS/JSTestCallback.h: 29 * bindings/scripts/test/JS/JSTestInterface.cpp: 30 * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: 31 * bindings/scripts/test/JS/JSTestObj.cpp: 32 * bindings/scripts/test/ObjC/DOMTestCallback.h: 33 * bindings/scripts/test/ObjC/DOMTestCallback.mm: 34 (-[DOMTestCallback callbackWithNoParam]): 35 * bindings/scripts/test/TestCallback.idl: 36 * bindings/scripts/test/V8/V8TestCallback.cpp: 37 (WebCore::V8TestCallback::callbackWithNoParam): 38 * bindings/scripts/test/V8/V8TestCallback.h: 39 * bindings/scripts/test/V8/V8TestObj.cpp: 40 (WebCore::TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter): 41 1 42 2011-01-20 James Robinson <jamesr@chromium.org> 2 43 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r76216 r76277 2402 2402 } 2403 2403 2404 push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); 2405 push(@implContent, join(",\n", @args)); 2406 push(@implContent, "\n };\n\n"); 2404 if (scalar(@args) > 0) { 2405 push(@implContent, "\n v8::Handle<v8::Value> argv[] = {\n"); 2406 push(@implContent, join(",\n", @args)); 2407 push(@implContent, "\n };\n\n"); 2408 } else { 2409 push(@implContent, "\n v8::Handle<v8::Value> *argv = 0;\n\n"); 2410 } 2407 2411 push(@implContent, " bool callbackReturnValue = false;\n"); 2408 2412 push(@implContent, " return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n"); -
trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.cpp
r65180 r76277 84 84 } 85 85 86 bool WebDOMTestCallback::callbackWithNoParam() 87 { 88 if (!impl()) 89 return false; 90 91 return impl()->callbackWithNoParam(); 92 } 93 86 94 bool WebDOMTestCallback::callbackWithClass1Param(const WebDOMClass1& class1Param) 87 95 { -
trunk/Source/WebCore/bindings/scripts/test/CPP/WebDOMTestCallback.h
r66327 r76277 47 47 virtual ~WebDOMTestCallback(); 48 48 49 bool callbackWithNoParam(); 49 50 bool callbackWithClass1Param(const WebDOMClass1& class1Param); 50 51 bool callbackWithClass2Param(const WebDOMClass2& class2Param, const WebDOMString& strArg); -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.cpp
r73238 r76277 40 40 #include "webkit/WebKitDOMTestCallback.h" 41 41 #include "webkit/WebKitDOMTestCallbackPrivate.h" 42 #include "webkitdefines.h" 43 #include "webkitglobalsprivate.h" 42 44 #include "webkitmarshal.h" 43 #include "webkitprivate.h"44 45 45 46 namespace WebKit { … … 56 57 57 58 } // namespace WebKit // 59 60 gboolean 61 webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self) 62 { 63 g_return_val_if_fail(self, 0); 64 WebCore::JSMainThreadNullState state; 65 WebCore::TestCallback * item = WebKit::core(self); 66 gboolean res = item->callbackWithNoParam(); 67 return res; 68 } 58 69 59 70 gboolean -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestCallback.h
r65333 r76277 48 48 49 49 WEBKIT_API gboolean 50 webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self); 51 52 WEBKIT_API gboolean 50 53 webkit_dom_test_callback_callback_with_class1param(WebKitDOMTestCallback* self, WebKitDOMClass1* class1param); 51 54 -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
r73238 r76277 34 34 #include "webkit/WebKitDOMTestInterface.h" 35 35 #include "webkit/WebKitDOMTestInterfacePrivate.h" 36 #include "webkitdefines.h" 37 #include "webkitglobalsprivate.h" 36 38 #include "webkitmarshal.h" 37 #include "webkitprivate.h"38 39 39 40 namespace WebKit { -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestMediaQueryListListener.cpp
r73238 r76277 32 32 #include "webkit/WebKitDOMTestMediaQueryListListener.h" 33 33 #include "webkit/WebKitDOMTestMediaQueryListListenerPrivate.h" 34 #include "webkitdefines.h" 35 #include "webkitglobalsprivate.h" 34 36 #include "webkitmarshal.h" 35 #include "webkitprivate.h"36 37 37 38 namespace WebKit { -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r73564 r76277 39 39 #include "webkit/WebKitDOMTestObj.h" 40 40 #include "webkit/WebKitDOMTestObjPrivate.h" 41 #include "webkitdefines.h" 42 #include "webkitglobalsprivate.h" 41 43 #include "webkitmarshal.h" 42 #include "webkitprivate.h"43 44 44 45 namespace WebKit { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
r65005 r76277 57 57 // Functions 58 58 59 bool JSTestCallback::callbackWithNoParam() 60 { 61 if (!canInvokeCallback()) 62 return true; 63 64 RefPtr<JSTestCallback> protect(this); 65 66 JSLock lock(SilenceAssertionsOnly); 67 68 ExecState* exec = m_data->globalObject()->globalExec(); 69 MarkedArgumentBuffer args; 70 71 bool raisedException = false; 72 m_data->invokeCallback(args, &raisedException); 73 return !raisedException; 74 } 75 59 76 bool JSTestCallback::callbackWithClass1Param(Class1* class1Param) 60 77 { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h
r64537 r76277 41 41 42 42 // Functions 43 virtual bool callbackWithNoParam(); 43 44 virtual bool callbackWithClass1Param(Class1* class1Param); 44 45 virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r61131 r76277 167 167 return JSTestInterface::getConstructor(exec, domObject->globalObject()); 168 168 } 169 169 170 JSValue JSTestInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject) 170 171 { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
r72552 r76277 163 163 return JSTestMediaQueryListListener::getConstructor(exec, domObject->globalObject()); 164 164 } 165 165 166 JSValue JSTestMediaQueryListListener::getConstructor(ExecState* exec, JSGlobalObject* globalObject) 166 167 { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r73564 r76277 608 608 return JSTestObj::getConstructor(exec, domObject->globalObject()); 609 609 } 610 610 611 void JSTestObj::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) 611 612 { -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.h
r58808 r76277 37 37 38 38 @interface DOMTestCallback : DOMObject 39 - (BOOL)callbackWithNoParam; 39 40 - (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param; 40 41 - (BOOL)callbackWithClass2Param:(DOMClass2 *)class2Param strArg:(NSString *)strArg; -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestCallback.mm
r59866 r76277 80 80 } 81 81 82 - (BOOL)callbackWithNoParam 83 { 84 WebCore::JSMainThreadNullState state; 85 return IMPL->callbackWithNoParam(); 86 } 87 82 88 - (BOOL)callbackWithClass1Param:(DOMClass1 *)class1Param 83 89 { -
trunk/Source/WebCore/bindings/scripts/test/TestCallback.idl
r58710 r76277 34 34 Callback 35 35 ] TestCallback { 36 boolean callbackWithNoParam(); 36 37 boolean callbackWithClass1Param(in Class1 class1Param); 37 38 boolean callbackWithClass2Param(in Class2 class2Param, in DOMString strArg); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
r64537 r76277 48 48 49 49 // Functions 50 51 bool V8TestCallback::callbackWithNoParam() 52 { 53 if (!canInvokeCallback()) 54 return true; 55 56 v8::HandleScope handleScope; 57 58 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext); 59 if (v8Context.IsEmpty()) 60 return true; 61 62 v8::Context::Scope scope(v8Context); 63 64 65 v8::Handle<v8::Value> *argv = 0; 66 67 bool callbackReturnValue = false; 68 return !invokeCallback(m_callback, 0, argv, callbackReturnValue, scriptExecutionContext()); 69 } 50 70 51 71 bool V8TestCallback::callbackWithClass1Param(Class1* class1Param) -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestCallback.h
r64537 r76277 46 46 47 47 // Functions 48 virtual bool callbackWithNoParam(); 48 49 virtual bool callbackWithClass1Param(Class1* class1Param); 49 50 virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r73564 r76277 261 261 INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get"); 262 262 TestObj* imp = V8TestObj::toNative(info.Holder()); 263 return v8::Integer::NewFromUnsigned( imp->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr));263 return v8::Integer::NewFromUnsigned(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr))); 264 264 } 265 265
Note: See TracChangeset
for help on using the changeset viewer.