Title: [123674] trunk/Source/WebKit/mac
Revision
123674
Author
psola...@apple.com
Date
2012-07-25 16:16:10 -0700 (Wed, 25 Jul 2012)

Log Message

Remove catchesDelegateExceptions from WebViewData and related accessor methods
https://bugs.webkit.org/show_bug.cgi?id=90898

Reviewed by Darin Adler.

Remove catchesDelegateException ivar from WebViewData and all its accesor methods from
WebView. All uses of this flag in WebKit set it to YES and no one calls
_setCatchesDelegateExceptions with NO.

* WebCoreSupport/WebDragClient.mm:
(WebDragClient::startDrag):
* WebView/WebDelegateImplementationCaching.mm:
(CallDelegate):
(CallDelegateReturningFloat):
(CallDelegateReturningBoolean):
(CallResourceLoadDelegateReturningBoolean):
(CallFormDelegate):
(CallFormDelegateReturningBoolean):
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _policyDelegateForwarder]):
(-[WebView _UIDelegateForwarder]):
(-[WebView _editingDelegateForwarder]):
(-[_WebSafeForwarder initWithTarget:defaultTarget:]):
(-[_WebSafeForwarder forwardInvocation:]):
* WebView/WebViewData.h:
* WebView/WebViewPrivate.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (123673 => 123674)


--- trunk/Source/WebKit/mac/ChangeLog	2012-07-25 23:14:58 UTC (rev 123673)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-07-25 23:16:10 UTC (rev 123674)
@@ -1,3 +1,33 @@
+2012-07-25  Pratik Solanki  <psola...@apple.com>
+
+        Remove catchesDelegateExceptions from WebViewData and related accessor methods
+        https://bugs.webkit.org/show_bug.cgi?id=90898
+
+        Reviewed by Darin Adler.
+
+        Remove catchesDelegateException ivar from WebViewData and all its accesor methods from
+        WebView. All uses of this flag in WebKit set it to YES and no one calls
+        _setCatchesDelegateExceptions with NO.
+
+        * WebCoreSupport/WebDragClient.mm:
+        (WebDragClient::startDrag):
+        * WebView/WebDelegateImplementationCaching.mm:
+        (CallDelegate):
+        (CallDelegateReturningFloat):
+        (CallDelegateReturningBoolean):
+        (CallResourceLoadDelegateReturningBoolean):
+        (CallFormDelegate):
+        (CallFormDelegateReturningBoolean):
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView _policyDelegateForwarder]):
+        (-[WebView _UIDelegateForwarder]):
+        (-[WebView _editingDelegateForwarder]):
+        (-[_WebSafeForwarder initWithTarget:defaultTarget:]):
+        (-[_WebSafeForwarder forwardInvocation:]):
+        * WebView/WebViewData.h:
+        * WebView/WebViewPrivate.h:
+
 2012-07-23  Simon Fraser  <simon.fra...@apple.com>
 
         Part 2 of: Implement sticky positioning

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm (123673 => 123674)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm	2012-07-25 23:14:58 UTC (rev 123673)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm	2012-07-25 23:16:10 UTC (rev 123674)
@@ -110,14 +110,11 @@
     id delegate = [m_webView UIDelegate];
     SEL selector = @selector(webView:dragImage:at:offset:event:pasteboard:source:slideBack:forView:);
     if ([delegate respondsToSelector:selector]) {
-        if ([m_webView _catchesDelegateExceptions]) {
-            @try {
-                [delegate webView:m_webView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES forView:topHTMLView];
-            } @catch (id exception) {
-                ReportDiscardedDelegateException(selector, exception);
-            }
-        } else
+        @try {
             [delegate webView:m_webView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES forView:topHTMLView];
+        } @catch (id exception) {
+            ReportDiscardedDelegateException(selector, exception);
+        }
     } else
         [topHTMLView dragImage:dragNSImage at:at offset:NSZeroSize event:event pasteboard:pasteboard source:sourceHTMLView slideBack:YES];
 }

Modified: trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm (123673 => 123674)


--- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm	2012-07-25 23:14:58 UTC (rev 123673)
+++ trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm	2012-07-25 23:16:10 UTC (rev 123674)
@@ -83,8 +83,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, self);
     @try {
         return objc_msgSend(delegate, selector, self);
     } @catch(id exception) {
@@ -97,8 +95,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, self, object);
     @try {
         return objc_msgSend(delegate, selector, self, object);
     } @catch(id exception) {
@@ -111,8 +107,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect);
     @try {
         return reinterpret_cast<id (*)(id, SEL, WebView *, NSRect)>(objc_msgSend)(delegate, selector, self, rect);
     } @catch(id exception) {
@@ -125,8 +119,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, self, object1, object2);
     @try {
         return objc_msgSend(delegate, selector, self, object1, object2);
     } @catch(id exception) {
@@ -139,8 +131,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, self, object, boolean);
     @try {
         return objc_msgSend(delegate, selector, self, object, boolean);
     } @catch(id exception) {
@@ -153,8 +143,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, self, object1, object2, object3);
     @try {
         return objc_msgSend(delegate, selector, self, object1, object2, object3);
     } @catch(id exception) {
@@ -167,8 +155,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, self, object, integer);
     @try {
         return objc_msgSend(delegate, selector, self, object, integer);
     } @catch(id exception) {
@@ -181,8 +167,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return 0.0f;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend_float_return(delegate, selector, self);
     @try {
         return objc_msgSend_float_return(delegate, selector, self);
     } @catch(id exception) {
@@ -195,8 +179,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return result;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *)>(objc_msgSend)(delegate, selector, self);
     } @catch(id exception) {
@@ -209,8 +191,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return result;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(delegate, selector, self, object);
     } @catch(id exception) {
@@ -223,8 +203,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return result;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL)>(objc_msgSend)(delegate, selector, self, object, boolean);
     } @catch(id exception) {
@@ -237,8 +215,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return result;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, BOOL, id)>(objc_msgSend)(delegate, selector, self, object, boolean, object2);
     } @catch(id exception) {
@@ -251,8 +227,6 @@
 {
     if (!delegate || ![delegate respondsToSelector:selector])
         return result;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(delegate, selector, self, object1, object2);
     } @catch(id exception) {
@@ -265,8 +239,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self);
     @try {
         return implementation(delegate, selector, self);
     } @catch(id exception) {
@@ -279,8 +251,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object);
     @try {
         return implementation(delegate, selector, self, object);
     } @catch(id exception) {
@@ -293,8 +263,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, object2);
     @try {
         return implementation(delegate, selector, self, object1, object2);
     } @catch(id exception) {
@@ -307,8 +275,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, object2, object3);
     @try {
         return implementation(delegate, selector, self, object1, object2, object3);
     } @catch(id exception) {
@@ -321,8 +287,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, object2, object3, object4);
     @try {
         return implementation(delegate, selector, self, object1, object2, object3, object4);
     } @catch(id exception) {
@@ -335,8 +299,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, integer, object2);
     @try {
         return implementation(delegate, selector, self, object1, integer, object2);
     } @catch(id exception) {
@@ -349,8 +311,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, integer1, integer2, object2);
     @try {
         return implementation(delegate, selector, self, object1, integer1, integer2, object2);
     } @catch(id exception) {
@@ -363,8 +323,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
     @try {
         return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
     } @catch(id exception) {
@@ -377,8 +335,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, object2, integer, object3);
     @try {
         return implementation(delegate, selector, self, object1, object2, integer, object3);
     } @catch(id exception) {
@@ -391,8 +347,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3);
     @try {
         return implementation(delegate, selector, self, object1, integer1, object2, integer2, object3);
     } @catch(id exception) {
@@ -405,8 +359,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, integer, object2, object3, object4);
     @try {
         return implementation(delegate, selector, self, object1, integer, object2, object3, object4);
     } @catch(id exception) {
@@ -419,8 +371,6 @@
 {
     if (!delegate)
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return implementation(delegate, selector, self, object1, interval, object2, object3);
     @try {
         return implementation(delegate, selector, self, object1, interval, object2, object3);
     } @catch(id exception) {
@@ -551,8 +501,6 @@
 
 BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1)
 {
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1);
     } @catch(id exception) {
@@ -563,8 +511,6 @@
 
 BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2)
 {
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2);
     } @catch(id exception) {
@@ -575,8 +521,6 @@
 
 BOOL CallResourceLoadDelegateReturningBoolean(BOOL result, IMP implementation, WebView *self, SEL selector, id object1, id object2, id object3)
 {
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, WebView *, id, id, id)>(objc_msgSend)(self->_private->resourceProgressDelegate, selector, self, object1, object2, object3);
     } @catch(id exception) {
@@ -632,8 +576,6 @@
     id delegate = self->_private->formDelegate;
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, object1, object2);
     @try {
         return objc_msgSend(delegate, selector, object1, object2);
     } @catch(id exception) {
@@ -647,8 +589,6 @@
     id delegate = self->_private->formDelegate;
     if (!delegate || ![delegate respondsToSelector:selector])
         return nil;
-    if (!self->_private->catchesDelegateExceptions)
-        return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5);
     @try {
         return objc_msgSend(delegate, selector, object1, object2, object3, object4, object5);
     } @catch(id exception) {
@@ -662,8 +602,6 @@
     id delegate = self->_private->formDelegate;
     if (!delegate || ![delegate respondsToSelector:selector])
         return result;
-    if (!self->_private->catchesDelegateExceptions)
-        return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2);
     @try {
         return reinterpret_cast<BOOL (*)(id, SEL, id, SEL, id)>(objc_msgSend)(delegate, selector, object1, selectorArg, object2);
     } @catch(id exception) {

Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (123673 => 123674)


--- trunk/Source/WebKit/mac/WebView/WebView.mm	2012-07-25 23:14:58 UTC (rev 123673)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm	2012-07-25 23:16:10 UTC (rev 123674)
@@ -375,9 +375,8 @@
 {
     id target; // Non-retained. Don't retain delegates.
     id defaultTarget;
-    BOOL catchExceptions;
 }
-- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget catchExceptions:(BOOL)catchExceptions;
+- (id)initWithTarget:(id)target defaultTarget:(id)defaultTarget;
 @end
 
 FindOptions coreOptions(WebFindOptions options)
@@ -709,7 +708,6 @@
     [standardPreferences willAddToWebView];
 
     _private->preferences = [standardPreferences retain];
-    _private->catchesDelegateExceptions = YES;
     _private->mainFrameDocumentReady = NO;
     _private->drawsBackground = YES;
     _private->backgroundColor = [[NSColor colorWithDeviceWhite:1 alpha:1] retain];
@@ -1679,14 +1677,14 @@
 - (id)_policyDelegateForwarder
 {
     if (!_private->policyDelegateForwarder)
-        _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate] catchExceptions:_private->catchesDelegateExceptions];
+        _private->policyDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->policyDelegate defaultTarget:[WebDefaultPolicyDelegate sharedPolicyDelegate]];
     return _private->policyDelegateForwarder;
 }
 
 - (id)_UIDelegateForwarder
 {
     if (!_private->UIDelegateForwarder)
-        _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate] catchExceptions:_private->catchesDelegateExceptions];
+        _private->UIDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->UIDelegate defaultTarget:[WebDefaultUIDelegate sharedUIDelegate]];
     return _private->UIDelegateForwarder;
 }
 
@@ -1698,7 +1696,7 @@
         return nil;
 
     if (!_private->editingDelegateForwarder)
-        _private->editingDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->editingDelegate defaultTarget:[WebDefaultEditingDelegate sharedEditingDelegate] catchExceptions:_private->catchesDelegateExceptions];
+        _private->editingDelegateForwarder = [[_WebSafeForwarder alloc] initWithTarget:_private->editingDelegate defaultTarget:[WebDefaultEditingDelegate sharedEditingDelegate]];
     return _private->editingDelegateForwarder;
 }
 
@@ -2361,16 +2359,6 @@
     _private->page->clearUndoRedoOperations();
 }
 
-- (void)_setCatchesDelegateExceptions:(BOOL)f
-{
-    _private->catchesDelegateExceptions = f;
-}
-
-- (BOOL)_catchesDelegateExceptions
-{
-    return _private->catchesDelegateExceptions;
-}
-
 - (void)_executeCoreCommandByName:(NSString *)name value:(NSString *)value
 {
     Frame* coreFrame = [self _mainCoreFrame];
@@ -2987,28 +2975,24 @@
 
 // Used to send messages to delegates that implement informal protocols.
 
-- (id)initWithTarget:(id)t defaultTarget:(id)dt catchExceptions:(BOOL)c
+- (id)initWithTarget:(id)t defaultTarget:(id)dt
 {
     self = [super init];
     if (!self)
         return nil;
     target = t; // Non retained.
     defaultTarget = dt;
-    catchExceptions = c;
     return self;
 }
 
 - (void)forwardInvocation:(NSInvocation *)invocation
 {
     if ([target respondsToSelector:[invocation selector]]) {
-        if (catchExceptions) {
-            @try {
-                [invocation invokeWithTarget:target];
-            } @catch(id exception) {
-                ReportDiscardedDelegateException([invocation selector], exception);
-            }
-        } else
+        @try {
             [invocation invokeWithTarget:target];
+        } @catch(id exception) {
+            ReportDiscardedDelegateException([invocation selector], exception);
+        }
         return;
     }
 

Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (123673 => 123674)


--- trunk/Source/WebKit/mac/WebView/WebViewData.h	2012-07-25 23:14:58 UTC (rev 123673)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h	2012-07-25 23:16:10 UTC (rev 123674)
@@ -137,7 +137,6 @@
     BOOL becomingFirstResponder;
     BOOL becomingFirstResponderFromOutside;
     BOOL usesPageCache;
-    BOOL catchesDelegateExceptions;
     BOOL cssAnimationsSuspended;
 
     NSColor *backgroundColor;

Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (123673 => 123674)


--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2012-07-25 23:14:58 UTC (rev 123673)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h	2012-07-25 23:16:10 UTC (rev 123674)
@@ -361,9 +361,6 @@
 + (void)_setShouldUseFontSmoothing:(BOOL)f;
 + (BOOL)_shouldUseFontSmoothing;
 
-- (void)_setCatchesDelegateExceptions:(BOOL)f;
-- (BOOL)_catchesDelegateExceptions;
-
 // These two methods are useful for a test harness that needs a consistent appearance for the focus rings
 // regardless of OS X version.
 + (void)_setUsesTestModeFocusRingColor:(BOOL)f;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to