2 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2006 David Smith (catfish.man@gmail.com)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #import "WebDelegateImplementationCaching.h"
32 #import "WebKitLogging.h"
34 #import "WebViewData.h"
35 #import <objc/objc-runtime.h>
37 @implementation WebView (WebDelegateImplementationCaching)
39 WebResourceDelegateImplementationCache* WebViewGetResourceLoadDelegateImplementations(WebView *webView)
41 static WebResourceDelegateImplementationCache empty;
44 return &webView->_private->resourceLoadDelegateImplementations;
47 WebFrameLoadDelegateImplementationCache* WebViewGetFrameLoadDelegateImplementations(WebView *webView)
49 static WebFrameLoadDelegateImplementationCache empty;
52 return &webView->_private->frameLoadDelegateImplementations;
55 WebScriptDebugDelegateImplementationCache* WebViewGetScriptDebugDelegateImplementations(WebView *webView)
57 static WebScriptDebugDelegateImplementationCache empty;
60 return &webView->_private->scriptDebugDelegateImplementations;
63 WebHistoryDelegateImplementationCache* WebViewGetHistoryDelegateImplementations(WebView *webView)
65 static WebHistoryDelegateImplementationCache empty;
68 return &webView->_private->historyDelegateImplementations;
71 // We use these functions to call the delegates and block exceptions. These functions are
72 // declared inside a WebView category to get direct access to the delegate data memebers,
73 // preventing more ObjC message dispatch and compensating for the expense of the @try/@catch.
75 typedef float (*ObjCMsgSendFPRet)(id, SEL, ...);
77 static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend_fpret);
79 static const ObjCMsgSendFPRet objc_msgSend_float_return = reinterpret_cast<ObjCMsgSendFPRet>(objc_msgSend);
82 static inline id CallDelegate(WebView *self, id delegate, SEL selector)
84 if (!delegate || ![delegate respondsToSelector:selector])
86 if (!self->_private->catchesDelegateExceptions)
87 return objc_msgSend(delegate, selector, self);
89 return objc_msgSend(delegate, selector, self);
90 } @catch(id exception) {
91 ReportDiscardedDelegateException(selector, exception);
96 static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object)
98 if (!delegate || ![delegate respondsToSelector:selector])
100 if (!self->_private->catchesDelegateExceptions)
101 return objc_msgSend(delegate, selector, self, object);
103 return objc_msgSend(delegate, selector, self, object);
104 } @catch(id exception) {
105 ReportDiscardedDelegateException(selector, exception);
110 static inline id CallDelegate(WebView *self, id delegate, SEL selector, NSRect rect)
112 if (!delegate || ![delegate respondsToSelector:selector])
114 if (!self->_private->catchesDelegateExceptions)
115 return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect);
117 return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect);
118 } @catch(id exception) {
119 ReportDiscardedDelegateException(selector, exception);
124 static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object1, id object2)
126 if (!delegate || ![delegate respondsToSelector:selector])
128 if (!self->_private->catchesDelegateExceptions)
129 return objc_msgSend(delegate, selector, self, object1, object2);
131 return objc_msgSend(delegate, selector, self, object1, object2);
132 } @catch(id exception) {
133 ReportDiscardedDelegateException(selector, exception);
138 static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object, BOOL boolean)
140 if (!delegate || ![delegate respondsToSelector:selector])
142 if (!self->_private->catchesDelegateExceptions)
143 return objc_msgSend(delegate, selector, self, object, boolean);
145 return objc_msgSend(delegate, selector, self, object, boolean);
146 } @catch(id exception) {
147 ReportDiscardedDelegateException(selector, exception);
152 static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
154 if (!delegate || ![delegate respondsToSelector:selector])
156 if (!self->_private->catchesDelegateExceptions)
157 return objc_msgSend(delegate, selector, self, object1, object2, object3);
159 return objc_msgSend(delegate, selector, self, object1, object2, object3);
160 } @catch(id exception) {
161 ReportDiscardedDelegateException(selector, exception);
166 static inline id CallDelegate(WebView *self, id delegate, SEL selector, id object, NSUInteger integer)
168 if (!delegate || ![delegate respondsToSelector:selector])
170 if (!self->_private->catchesDelegateExceptions)
171 return objc_msgSend(delegate, selector, self, object, integer);
173 return objc_msgSend(delegate, selector, self, object, integer);
174 } @catch(id exception) {
175 ReportDiscardedDelegateException(selector, exception);
180 static inline float CallDelegateReturningFloat(WebView *self, id delegate, SEL selector)
182 if (!delegate || ![delegate respondsToSelector:selector])
184 if (!self->_private->catchesDelegateExceptions)
185 return objc_msgSend_float_return(delegate, selector, self);
187 return objc_msgSend_float_return(delegate, selector, self);
188 } @catch(id exception) {
189 ReportDiscardedDelegateException(selector, exception);
194 static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector)
196 if (!delegate || ![delegate respondsToSelector:selector])
198 if (!self->_private->catchesDelegateExceptions)
199 return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self);
201 return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self);
202 } @catch(id exception) {
203 ReportDiscardedDelegateException(selector, exception);
208 static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object)
210 if (!delegate || ![delegate respondsToSelector:selector])
212 if (!self->_private->catchesDelegateExceptions)
213 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object);
215 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object);
216 } @catch(id exception) {
217 ReportDiscardedDelegateException(selector, exception);
222 static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean)
224 if (!delegate || ![delegate respondsToSelector:selector])
226 if (!self->_private->catchesDelegateExceptions)
227 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean);
229 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean);
230 } @catch(id exception) {
231 ReportDiscardedDelegateException(selector, exception);
236 static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object, BOOL boolean, id object2)
238 if (!delegate || ![delegate respondsToSelector:selector])
240 if (!self->_private->catchesDelegateExceptions)
241 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2);
243 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2);
244 } @catch(id exception) {
245 ReportDiscardedDelegateException(selector, exception);
250 static inline BOOL CallDelegateReturningBoolean(BOOL result, WebView *self, id delegate, SEL selector, id object1, id object2)
252 if (!delegate || ![delegate respondsToSelector:selector])
254 if (!self->_private->catchesDelegateExceptions)
255 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2);
257 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2);
258 } @catch(id exception) {
259 ReportDiscardedDelegateException(selector, exception);
264 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector)
268 if (!self->_private->catchesDelegateExceptions)
269 return implementation(delegate, selector, self);
271 return implementation(delegate, selector, self);
272 } @catch(id exception) {
273 ReportDiscardedDelegateException(selector, exception);
278 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object)
282 if (!self->_private->catchesDelegateExceptions)
283 return implementation(delegate, selector, self, object);
285 return implementation(delegate, selector, self, object);
286 } @catch(id exception) {
287 ReportDiscardedDelegateException(selector, exception);
292 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2)
296 if (!self->_private->catchesDelegateExceptions)
297 return implementation(delegate, selector, self, object1, object2);
299 return implementation(delegate, selector, self, object1, object2);
300 } @catch(id exception) {
301 ReportDiscardedDelegateException(selector, exception);
306 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3)
310 if (!self->_private->catchesDelegateExceptions)
311 return implementation(delegate, selector, self, object1, object2, object3);
313 return implementation(delegate, selector, self, object1, object2, object3);
314 } @catch(id exception) {
315 ReportDiscardedDelegateException(selector, exception);
320 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, id object3, id object4)
324 if (!self->_private->catchesDelegateExceptions)
325 return implementation(delegate, selector, self, object1, object2, object3, object4);
327 return implementation(delegate, selector, self, object1, object2, object3, object4);
328 } @catch(id exception) {
329 ReportDiscardedDelegateException(selector, exception);
334 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2)
338 if (!self->_private->catchesDelegateExceptions)
339 return implementation(delegate, selector, self, object1, integer, object2);
341 return implementation(delegate, selector, self, object1, integer, object2);
342 } @catch(id exception) {
343 ReportDiscardedDelegateException(selector, exception);
348 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
352 if (!self->_private->catchesDelegateExceptions)
353 return implementation(delegate, selector, self, object1, integer1, integer2, object2);
355 return implementation(delegate, selector, self, object1, integer1, integer2, object2);
356 } @catch(id exception) {
357 ReportDiscardedDelegateException(selector, exception);
362 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
366 if (!self->_private->catchesDelegateExceptions)
367 return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
369 return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
370 } @catch(id exception) {
371 ReportDiscardedDelegateException(selector, exception);
376 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
380 if (!self->_private->catchesDelegateExceptions)
381 return implementation(delegate, selector, self, object1, object2, integer, object3);
383 return implementation(delegate, selector, self, object1, object2, integer, object3);
384 } @catch(id exception) {
385 ReportDiscardedDelegateException(selector, exception);
390 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
394 if (!self->_private->catchesDelegateExceptions)
395 return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3);
397 return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3);
398 } @catch(id exception) {
399 ReportDiscardedDelegateException(selector, exception);
404 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
408 if (!self->_private->catchesDelegateExceptions)
409 return implementation(delegate, selector, self, object1, integer, object2, object3, object4);
411 return implementation(delegate, selector, self, object1, integer, object2, object3, object4);
412 } @catch(id exception) {
413 ReportDiscardedDelegateException(selector, exception);
418 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSTimeInterval interval, id object2, id object3)
422 if (!self->_private->catchesDelegateExceptions)
423 return implementation(delegate, selector, self, object1, interval, object2, object3);
425 return implementation(delegate, selector, self, object1, interval, object2, object3);
426 } @catch(id exception) {
427 ReportDiscardedDelegateException(selector, exception);
432 id CallUIDelegate(WebView *self, SEL selector)
434 return CallDelegate(self, self->_private->UIDelegate, selector);
437 id CallUIDelegate(WebView *self, SEL selector, id object)
439 return CallDelegate(self, self->_private->UIDelegate, selector, object);
442 id CallUIDelegate(WebView *self, SEL selector, id object, BOOL boolean)
444 return CallDelegate(self, self->_private->UIDelegate, selector, object, boolean);
447 id CallUIDelegate(WebView *self, SEL selector, NSRect rect)
449 return CallDelegate(self, self->_private->UIDelegate, selector, rect);
452 id CallUIDelegate(WebView *self, SEL selector, id object1, id object2)
454 return CallDelegate(self, self->_private->UIDelegate, selector, object1, object2);
457 id CallUIDelegate(WebView *self, SEL selector, id object1, id object2, id object3)
459 return CallDelegate(self, self->_private->UIDelegate, selector, object1, object2, object3);
462 id CallUIDelegate(WebView *self, SEL selector, id object, NSUInteger integer)
464 return CallDelegate(self, self->_private->UIDelegate, selector, object, integer);
467 float CallUIDelegateReturningFloat(WebView *self, SEL selector)
469 return CallDelegateReturningFloat(self, self->_private->UIDelegate, selector);
472 BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector)
474 return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector);
477 BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object)
479 return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object);
482 BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean)
484 return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean);
487 BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object, BOOL boolean, id object2)
489 return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object, boolean, object2);
492 BOOL CallUIDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, id object2)
494 return CallDelegateReturningBoolean(result, self, self->_private->UIDelegate, selector, object1, object2);
497 id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector)
499 return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector);
502 id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object)
504 return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object);
507 id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
509 return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2);
512 id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
514 return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2, object3);
517 id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
519 return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, object2, object3, object4);
522 id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSTimeInterval interval, id object2, id object3)
524 return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object1, interval, object2, object3);
527 id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
529 return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2);
532 id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
534 return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3);
537 id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3, id object4)
539 return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, object3, object4);
542 id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2)
544 return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, integer, object2);
547 id CallResourceLoadDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
549 return CallDelegate(implementation, self, self->_private->resourceProgressDelegate, selector, object1, object2, integer, object3);
552 BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1)
554 if (!self->_private->catchesDelegateExceptions)
555 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1);
557 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1);
558 } @catch(id exception) {
559 ReportDiscardedDelegateException(selector, exception);
564 BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2)
566 if (!self->_private->catchesDelegateExceptions)
567 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2);
569 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2);
570 } @catch(id exception) {
571 ReportDiscardedDelegateException(selector, exception);
576 BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
578 if (!self->_private->catchesDelegateExceptions)
579 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3);
581 return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3);
582 } @catch(id exception) {
583 ReportDiscardedDelegateException(selector, exception);
588 id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, NSInteger integer, id object3)
590 return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, object2, integer, object3);
593 id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, id object2, NSInteger integer2, id object3)
595 return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, object2, integer2, object3);
598 id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer, id object2, id object3, id object4)
600 return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
603 id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
605 return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
608 id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
610 return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, boolean, integer1, integer2, object2);
613 id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector)
615 return CallDelegate(implementation, self, self->_private->historyDelegate, selector);
618 id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2)
620 return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2);
623 id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
625 return CallDelegate(implementation, self, self->_private->historyDelegate, selector, object1, object2, object3);
628 // The form delegate needs to have it's own implementation, because the first argument is never the WebView
630 id CallFormDelegate(WebView *self, SEL selector, id object1, id object2)
632 id delegate = self->_private->formDelegate;
633 if (!delegate || ![delegate respondsToSelector:selector])
635 if (!self->_private->catchesDelegateExceptions)
636 return objc_msgSend(delegate, selector, object1, object2);
638 return objc_msgSend(delegate, selector, object1, object2);
639 } @catch(id exception) {
640 ReportDiscardedDelegateException(selector, exception);
645 id CallFormDelegate(WebView *self, SEL selector, id object1, id object2, id object3, id object4, id object5)
647 id delegate = self->_private->formDelegate;
648 if (!delegate || ![delegate respondsToSelector:selector])
650 if (!self->_private->catchesDelegateExceptions)
651 return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5);
653 return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5);
654 } @catch(id exception) {
655 ReportDiscardedDelegateException(selector, exception);
660 BOOL CallFormDelegateReturningBoolean(BOOL result, WebView *self, SEL selector, id object1, SEL selectorArg, id object2)
662 id delegate = self->_private->formDelegate;
663 if (!delegate || ![delegate respondsToSelector:selector])
665 if (!self->_private->catchesDelegateExceptions)
666 return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2);
668 return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2);
669 } @catch(id exception) {
670 ReportDiscardedDelegateException(selector, exception);