Log Message
objc_msgSend and IMP should be cast appropriately before using https://bugs.webkit.org/show_bug.cgi?id=95242
Reviewed by Benjamin Poulain. Source/WebCore: Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts to a function pointer with right types when calling objc_msgSend and an IMP method directly. No new tests because no functional changes. * page/mac/EventHandlerMac.mm: (WebCore::selfRetainingNSScrollViewScrollWheel): * platform/mac/WebCoreObjCExtras.mm: (deallocCallback): Source/WebKit/mac: Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts to a function pointer with right types when calling objc_msgSend and an IMP method directly. * WebCoreSupport/WebCachedFramePlatformData.h: (WebCachedFramePlatformData::clear): * WebCoreSupport/WebDeviceOrientationClient.mm: (WebDeviceOrientationClient::getProvider): * WebView/WebDelegateImplementationCaching.mm: (CallDelegate): (CallDelegateReturningBoolean): (CallResourceLoadDelegateReturningBoolean): (CallFormDelegate): (CallFormDelegateReturningBoolean): * WebView/WebHTMLView.mm: (setCursor): (setNeedsDisplayInRect): Source/WebKit2: Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts to a function pointer with right types when calling objc_msgSend and an IMP method directly. * UIProcess/API/mac/PDFViewController.mm: (WebKit::PDFViewScrollView_scrollWheel): Source/WTF: Add new templates wtfObjcMsgSend and wtfCallIMP that do the appropriate casts to correctly typed function pointers before calling objc_msgSend and IMP methods directly. * wtf/Functional.h: (WTF::R): Use wtfObjcMsgSend. * wtf/ObjcRuntimeExtras.h: Added. (wtfObjcMsgSend): (wtfCallIMP): Tools: Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts to a function pointer with right types when calling objc_msgSend and an IMP method directly. * DumpRenderTree/mac/DumpRenderTree.mm: (drt_NSFontManager_availableFontFamilies): * WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm: (WTR::wtr_NSFontManager_availableFontFamilies):
Modified Paths
- trunk/Source/WTF/ChangeLog
- trunk/Source/WTF/wtf/Functional.h
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/page/mac/EventHandlerMac.mm
- trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm
- trunk/Source/WebKit/mac/ChangeLog
- trunk/Source/WebKit/mac/WebCoreSupport/WebCachedFramePlatformData.h
- trunk/Source/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm
- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
- trunk/Source/WebKit2/ChangeLog
- trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
- trunk/Tools/ChangeLog
- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm
Added Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (127192 => 127193)
--- trunk/Source/WTF/ChangeLog 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WTF/ChangeLog 2012-08-30 21:40:39 UTC (rev 127193)
@@ -1,3 +1,20 @@
+2012-08-30 Pratik Solanki <[email protected]>
+
+ objc_msgSend and IMP should be cast appropriately before using
+ https://bugs.webkit.org/show_bug.cgi?id=95242
+
+ Reviewed by Benjamin Poulain.
+
+ Add new templates wtfObjcMsgSend and wtfCallIMP that do the appropriate
+ casts to correctly typed function pointers before calling objc_msgSend
+ and IMP methods directly.
+
+ * wtf/Functional.h:
+ (WTF::R): Use wtfObjcMsgSend.
+ * wtf/ObjcRuntimeExtras.h: Added.
+ (wtfObjcMsgSend):
+ (wtfCallIMP):
+
2012-08-30 Benjamin Poulain <[email protected]>
Replace JSC::UString by WTF::String
Modified: trunk/Source/WTF/wtf/Functional.h (127192 => 127193)
--- trunk/Source/WTF/wtf/Functional.h 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WTF/wtf/Functional.h 2012-08-30 21:40:39 UTC (rev 127193)
@@ -34,6 +34,7 @@
#if PLATFORM(MAC) && COMPILER_SUPPORTS(BLOCKS)
#include <Block.h>
#include <objc/objc-runtime.h>
+#include <wtf/ObjcRuntimeExtras.h>
#endif
namespace WTF {
@@ -634,8 +635,8 @@
//
// dispatch_async(queue, bind(...));
//
- id copiedBlock = objc_msgSend((id)block, sel_registerName("copy"));
- id autoreleasedBlock = objc_msgSend(copiedBlock, sel_registerName("autorelease"));
+ id copiedBlock = wtfObjcMsgSend((id)block, sel_registerName("copy"));
+ id autoreleasedBlock = wtfObjcMsgSend(copiedBlock, sel_registerName("autorelease"));
return (BlockType)autoreleasedBlock;
}
#endif
Added: trunk/Source/WTF/wtf/ObjcRuntimeExtras.h (0 => 127193)
--- trunk/Source/WTF/wtf/ObjcRuntimeExtras.h (rev 0)
+++ trunk/Source/WTF/wtf/ObjcRuntimeExtras.h 2012-08-30 21:40:39 UTC (rev 127193)
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WTF_ObjcRuntimeExtras_h
+#define WTF_ObjcRuntimeExtras_h
+
+template<typename RetType = id>
+RetType wtfObjcMsgSend(id target, SEL selector)
+{
+ return reinterpret_cast<RetType (*)(id, SEL)>(objc_msgSend)(target, selector);
+}
+
+template<typename RetType = id, typename Arg1Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type)>(objc_msgSend)(target, selector, arg1);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type)>(objc_msgSend)(target, selector, arg1, arg2);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type)>(objc_msgSend)(target, selector, arg1, arg2, arg3);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type)>(objc_msgSend)(target, selector, arg1, arg2, arg3, arg4);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type, typename Arg5Type>
+RetType wtfObjcMsgSend(id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4, Arg5Type arg5)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type, Arg5Type)>(objc_msgSend)(target, selector, arg1, arg2, arg3, arg4, arg5);
+}
+
+template<typename RetType = id>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector)
+{
+ return reinterpret_cast<RetType (*)(id, SEL)>(implementation)(target, selector);
+}
+
+template<typename RetType = id, typename Arg1Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type)>(implementation)(target, selector, arg1);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type)>(implementation)(target, selector, arg1, arg2);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type)>(implementation)(target, selector, arg1, arg2, arg3);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type)>(implementation)(target, selector, arg1, arg2, arg3, arg4);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type, typename Arg5Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4, Arg5Type arg5)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type, Arg5Type)>(implementation)(target, selector, arg1, arg2, arg3, arg4, arg5);
+}
+
+template<typename RetType = id, typename Arg1Type, typename Arg2Type, typename Arg3Type, typename Arg4Type, typename Arg5Type, typename Arg6Type>
+RetType wtfCallIMP(IMP implementation, id target, SEL selector, Arg1Type arg1, Arg2Type arg2, Arg3Type arg3, Arg4Type arg4, Arg5Type arg5, Arg6Type arg6)
+{
+ return reinterpret_cast<RetType (*)(id, SEL, Arg1Type, Arg2Type, Arg3Type, Arg4Type, Arg5Type, Arg6Type)>(implementation)(target, selector, arg1, arg2, arg3, arg4, arg5, arg6);
+}
+
+#endif
Modified: trunk/Source/WebCore/ChangeLog (127192 => 127193)
--- trunk/Source/WebCore/ChangeLog 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebCore/ChangeLog 2012-08-30 21:40:39 UTC (rev 127193)
@@ -1,3 +1,21 @@
+2012-08-30 Pratik Solanki <[email protected]>
+
+ objc_msgSend and IMP should be cast appropriately before using
+ https://bugs.webkit.org/show_bug.cgi?id=95242
+
+ Reviewed by Benjamin Poulain.
+
+ Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts
+ to a function pointer with right types when calling objc_msgSend and an
+ IMP method directly.
+
+ No new tests because no functional changes.
+
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::selfRetainingNSScrollViewScrollWheel):
+ * platform/mac/WebCoreObjCExtras.mm:
+ (deallocCallback):
+
2012-08-30 Benjamin Poulain <[email protected]>
Replace JSC::UString by WTF::String
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (127192 => 127193)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -50,6 +50,7 @@
#include "WebCoreSystemInterface.h"
#include <objc/objc-runtime.h>
#include <wtf/MainThread.h>
+#include <wtf/ObjcRuntimeExtras.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
@@ -412,7 +413,7 @@
if (shouldRetainSelf)
[self retain];
- originalNSScrollViewScrollWheel(self, selector, event);
+ wtfCallIMP<void>(originalNSScrollViewScrollWheel, self, selector, event);
if (shouldRetainSelf)
[self release];
}
Modified: trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm (127192 => 127193)
--- trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebCore/platform/mac/WebCoreObjCExtras.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -39,6 +39,7 @@
#include <utility>
#include <wtf/Assertions.h>
#include <wtf/MainThread.h>
+#include <wtf/ObjcRuntimeExtras.h>
#include <wtf/Threading.h>
#include <wtf/UnusedParam.h>
@@ -63,7 +64,7 @@
Method method = class_getInstanceMethod(pair->first, @selector(dealloc));
IMP imp = method_getImplementation(method);
- imp(pair->second, @selector(dealloc));
+ wtfCallIMP<void>(imp, pair->second, @selector(dealloc));
delete pair;
}
Modified: trunk/Source/WebKit/mac/ChangeLog (127192 => 127193)
--- trunk/Source/WebKit/mac/ChangeLog 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit/mac/ChangeLog 2012-08-30 21:40:39 UTC (rev 127193)
@@ -1,3 +1,28 @@
+2012-08-30 Pratik Solanki <[email protected]>
+
+ objc_msgSend and IMP should be cast appropriately before using
+ https://bugs.webkit.org/show_bug.cgi?id=95242
+
+ Reviewed by Benjamin Poulain.
+
+ Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts
+ to a function pointer with right types when calling objc_msgSend and an
+ IMP method directly.
+
+ * WebCoreSupport/WebCachedFramePlatformData.h:
+ (WebCachedFramePlatformData::clear):
+ * WebCoreSupport/WebDeviceOrientationClient.mm:
+ (WebDeviceOrientationClient::getProvider):
+ * WebView/WebDelegateImplementationCaching.mm:
+ (CallDelegate):
+ (CallDelegateReturningBoolean):
+ (CallResourceLoadDelegateReturningBoolean):
+ (CallFormDelegate):
+ (CallFormDelegateReturningBoolean):
+ * WebView/WebHTMLView.mm:
+ (setCursor):
+ (setNeedsDisplayInRect):
+
2012-08-30 Benjamin Poulain <[email protected]>
Replace JSC::UString by WTF::String
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebCachedFramePlatformData.h (127192 => 127193)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebCachedFramePlatformData.h 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebCachedFramePlatformData.h 2012-08-30 21:40:39 UTC (rev 127193)
@@ -28,13 +28,14 @@
#import <objc/objc-runtime.h>
#import <WebCore/CachedFramePlatformData.h>
+#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/RetainPtr.h>
class WebCachedFramePlatformData : public WebCore::CachedFramePlatformData {
public:
WebCachedFramePlatformData(id webDocumentView) : m_webDocumentView(webDocumentView) { }
- virtual void clear() { objc_msgSend(m_webDocumentView.get(), @selector(closeIfNotCurrentView)); }
+ virtual void clear() { wtfObjcMsgSend<void>(m_webDocumentView.get(), @selector(closeIfNotCurrentView)); }
id webDocumentView() { return m_webDocumentView.get(); }
private:
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm (127192 => 127193)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDeviceOrientationClient.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -29,6 +29,7 @@
#import "WebDeviceOrientationProvider.h"
#import "WebViewInternal.h"
#import <objc/objc-runtime.h>
+#import <wtf/ObjcRuntimeExtras.h>
using namespace WebCore;
@@ -70,7 +71,7 @@
if (!m_provider) {
m_provider = [m_webView _deviceOrientationProvider];
if ([m_provider respondsToSelector:@selector(setController:)])
- objc_msgSend(m_provider, @selector(setController:), m_controller);
+ wtfObjcMsgSend<void>(m_provider, @selector(setController:), m_controller);
}
return m_provider;
}
Modified: trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm (127192 => 127193)
--- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -33,6 +33,7 @@
#import "WebView.h"
#import "WebViewData.h"
#import <objc/objc-runtime.h>
+#import <wtf/ObjcRuntimeExtras.h>
@implementation WebView (WebDelegateImplementationCaching)
@@ -84,7 +85,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, self);
+ return wtfObjcMsgSend(delegate, selector, self);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -96,7 +97,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, self, object);
+ return wtfObjcMsgSend(delegate, selector, self, object);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -108,7 +109,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect);
+ return wtfObjcMsgSend(delegate, selector, self, rect);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -120,7 +121,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, self, object1, object2);
+ return wtfObjcMsgSend(delegate, selector, self, object1, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -132,7 +133,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, self, object, boolean);
+ return wtfObjcMsgSend(delegate, selector, self, object, boolean);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -144,7 +145,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, self, object1, object2, object3);
+ return wtfObjcMsgSend(delegate, selector, self, object1, object2, object3);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -156,7 +157,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, self, object, integer);
+ return wtfObjcMsgSend(delegate, selector, self, object, integer);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -180,7 +181,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self);
+ return wtfObjcMsgSend<BOOL>(delegate, selector, self);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -192,7 +193,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object);
+ return wtfObjcMsgSend<BOOL>(delegate, selector, self, object);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -204,7 +205,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean);
+ return wtfObjcMsgSend<BOOL>(delegate, selector, self, object, boolean);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -216,7 +217,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2);
+ return wtfObjcMsgSend<BOOL>(delegate, selector, self, object, boolean, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -228,7 +229,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2);
+ return wtfObjcMsgSend<BOOL>(delegate, selector, self, object1, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -240,7 +241,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self);
+ return wtfCallIMP(implementation, delegate, selector, self);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -252,7 +253,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object);
+ return wtfCallIMP(implementation, delegate, selector, self, object);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -264,7 +265,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, object2);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -276,7 +277,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, object2, object3);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, object2, object3);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -288,7 +289,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, object2, object3, object4);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, object2, object3, object4);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -300,7 +301,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, integer, object2);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, integer, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -312,7 +313,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, integer1, integer2, object2);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, integer1, integer2, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -324,7 +325,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, boolean, integer1, integer2, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -336,7 +337,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, object2, integer, object3);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, object2, integer, object3);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -348,7 +349,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, integer1, object2, integer2, object3);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -360,7 +361,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, integer, object2, object3, object4);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, integer, object2, object3, object4);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -372,7 +373,7 @@
if (!delegate)
return nil;
@try {
- return implementation(delegate, selector, self, object1, interval, object2, object3);
+ return wtfCallIMP(implementation, delegate, selector, self, object1, interval, object2, object3);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -502,7 +503,7 @@
BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1)
{
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1);
+ return wtfObjcMsgSend<BOOL>(self->_private->resourceProgressDelegate, selector, self, object1);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -512,7 +513,7 @@
BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2)
{
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2);
+ return wtfObjcMsgSend<BOOL>(self->_private->resourceProgressDelegate, selector, self, object1, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -522,7 +523,7 @@
BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
{
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3);
+ return wtfObjcMsgSend<BOOL>(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -577,7 +578,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, object1, object2);
+ return wtfObjcMsgSend(delegate, selector, object1, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -590,7 +591,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return nil;
@try {
- return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5);
+ return wtfObjcMsgSend(delegate, selector, object1, object2, object3, object4, object5);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
@@ -603,7 +604,7 @@
if (!delegate || ![delegate respondsToSelector:selector])
return result;
@try {
- return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2);
+ return wtfObjcMsgSend<BOOL>(delegate, selector, object1, selectorArg, object2);
} @catch(id exception) {
ReportDiscardedDelegateException(selector, exception);
}
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (127192 => 127193)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -124,8 +124,10 @@
#import <WebKitSystemInterface.h>
#import <dlfcn.h>
#import <limits>
+#import <objc/objc-runtime.h>
#import <runtime/InitializeThreading.h>
#import <wtf/MainThread.h>
+#import <wtf/ObjcRuntimeExtras.h>
#if USE(ACCELERATED_COMPOSITING)
#import <QuartzCore/QuartzCore.h>
@@ -262,7 +264,7 @@
static void setCursor(NSWindow *self, SEL cmd, NSPoint point)
{
if (needsCursorRectsSupportAtPoint(self, point))
- oldSetCursorForMouseLocationIMP(self, cmd, point);
+ wtfCallIMP(oldSetCursorForMouseLocationIMP, self, cmd, point);
}
@@ -296,7 +298,7 @@
static void setNeedsDisplayInRect(NSView *self, SEL cmd, NSRect invalidRect)
{
if (![self _drawnByAncestor]) {
- oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect);
+ wtfCallIMP(oldSetNeedsDisplayInRectIMP, self, cmd, invalidRect);
return;
}
@@ -306,14 +308,14 @@
enclosingWebFrameView = (WebFrameView *)[enclosingWebFrameView superview];
if (!enclosingWebFrameView) {
- oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect);
+ wtfCallIMP(oldSetNeedsDisplayInRectIMP, self, cmd, invalidRect);
return;
}
Frame* coreFrame = core([enclosingWebFrameView webFrame]);
FrameView* frameView = coreFrame ? coreFrame->view() : 0;
if (!frameView || !frameView->isEnclosedInCompositingLayer()) {
- oldSetNeedsDisplayInRectIMP(self, cmd, invalidRect);
+ wtfCallIMP(oldSetNeedsDisplayInRectIMP, self, cmd, invalidRect);
return;
}
Modified: trunk/Source/WebKit2/ChangeLog (127192 => 127193)
--- trunk/Source/WebKit2/ChangeLog 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit2/ChangeLog 2012-08-30 21:40:39 UTC (rev 127193)
@@ -1,3 +1,17 @@
+2012-08-30 Pratik Solanki <[email protected]>
+
+ objc_msgSend and IMP should be cast appropriately before using
+ https://bugs.webkit.org/show_bug.cgi?id=95242
+
+ Reviewed by Benjamin Poulain.
+
+ Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts
+ to a function pointer with right types when calling objc_msgSend and an
+ IMP method directly.
+
+ * UIProcess/API/mac/PDFViewController.mm:
+ (WebKit::PDFViewScrollView_scrollWheel):
+
2012-08-30 Benjamin Poulain <[email protected]>
Replace JSC::UString by WTF::String
Modified: trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm (127192 => 127193)
--- trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PDFViewController.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -37,6 +37,7 @@
#import <PDFKit/PDFKit.h>
#import <WebCore/LocalizedStrings.h>
#import <objc/runtime.h>
+#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/text/CString.h>
#import <wtf/text/WTFString.h>
@@ -537,7 +538,7 @@
}
}
- oldPDFViewScrollView_scrollWheel(self, _cmd, wheelEvent);
+ wtfCallIMP<void>(oldPDFViewScrollView_scrollWheel, self, _cmd, wheelEvent);
}
#endif
Modified: trunk/Tools/ChangeLog (127192 => 127193)
--- trunk/Tools/ChangeLog 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Tools/ChangeLog 2012-08-30 21:40:39 UTC (rev 127193)
@@ -1,3 +1,19 @@
+2012-08-30 Pratik Solanki <[email protected]>
+
+ objc_msgSend and IMP should be cast appropriately before using
+ https://bugs.webkit.org/show_bug.cgi?id=95242
+
+ Reviewed by Benjamin Poulain.
+
+ Use wtfObjcMsgSend and wtfCallIMP templates which do appropriate casts
+ to a function pointer with right types when calling objc_msgSend and an
+ IMP method directly.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (drt_NSFontManager_availableFontFamilies):
+ * WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm:
+ (WTR::wtr_NSFontManager_availableFontFamilies):
+
2012-08-30 Benjamin Poulain <[email protected]>
Replace JSC::UString by WTF::String
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (127192 => 127193)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -89,6 +89,7 @@
#import <wtf/Assertions.h>
#import <wtf/RetainPtr.h>
#import <wtf/Threading.h>
+#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/OwnPtr.h>
extern "C" {
@@ -354,7 +355,7 @@
if (availableFontFamilies)
return availableFontFamilies;
- NSArray *availableFamilies = appKitAvailableFontFamiliesIMP(self, _cmd);
+ NSArray *availableFamilies = wtfCallIMP(appKitAvailableFontFamiliesIMP, self, _cmd);
NSMutableSet *prunedFamiliesSet = [NSMutableSet setWithArray:availableFamilies];
[prunedFamiliesSet intersectSet:allowedFontFamilySet()];
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm (127192 => 127193)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm 2012-08-30 21:38:59 UTC (rev 127192)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/mac/ActivateFonts.mm 2012-08-30 21:40:39 UTC (rev 127193)
@@ -29,6 +29,7 @@
#import <AppKit/AppKit.h>
#import <CoreFoundation/CoreFoundation.h>
#import <objc/objc-runtime.h>
+#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/RetainPtr.h>
@interface WKTRFontActivatorDummyClass : NSObject
@@ -170,7 +171,7 @@
if (availableFontFamilies)
return availableFontFamilies;
- NSArray *availableFamilies = appKitAvailableFontFamiliesIMP(self, _cmd);
+ NSArray *availableFamilies = wtfCallIMP(appKitAvailableFontFamiliesIMP, self, _cmd);
NSMutableSet *prunedFamiliesSet = [NSMutableSet setWithArray:availableFamilies];
[prunedFamiliesSet intersectSet:allowedFontFamilySet()];
_______________________________________________ webkit-changes mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-changes
