[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

darin at apple.com darin at apple.com
Sun Feb 20 23:21:17 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit c171f357fd8aeff883c98e1f991d9cf6bd9c1c92
Author: darin at apple.com <darin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 20 02:18:13 2011 +0000

    2011-01-19  Darin Adler  <darin at apple.com>
    
            Reviewed by Sam Weinig.
    
            Would like script debugging protocol method to differentiate between caught and uncaught exceptions
            https://bugs.webkit.org/show_bug.cgi?id=52104
            rdar://problem/8704226
    
            * WebView/WebDelegateImplementationCaching.h:
            Fix type of second integer in CallScriptDebugDelegate function overload
            to be int to match the actual Objective-C method. Added a new overload
            that includes a BOOL in the right place. Added a boolean named
            exceptionWasRaisedExpectsHasHandlerFlag.
    
            * WebView/WebDelegateImplementationCaching.mm:
            (CallDelegate): Added overloads as above.
            (CallScriptDebugDelegate): Ditto.
    
            * WebView/WebScriptDebugDelegate.h: Added new method with the additional
            boolean argument. Marked the old method informally deprecated.
    
            * WebView/WebScriptDebugger.mm:
            (WebScriptDebugger::exception): Added code to call with or without the
            boolean depending on exceptionWasRaisedExpectsHasHandlerFlag.
    
            * WebView/WebView.mm:
            (-[WebView _cacheScriptDebugDelegateImplementations]): Set up the
            exceptionWasRaisedExpectsHasHandlerFlag. Also fixed old code that was not
            guaranteed to set didParseSourceExpectsBaseLineNumber to NO.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76191 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog
index 50f2cdb..3e6ae7e 100644
--- a/Source/WebKit/mac/ChangeLog
+++ b/Source/WebKit/mac/ChangeLog
@@ -1,3 +1,33 @@
+2011-01-19  Darin Adler  <darin at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        Would like script debugging protocol method to differentiate between caught and uncaught exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=52104
+        rdar://problem/8704226
+
+        * WebView/WebDelegateImplementationCaching.h:
+        Fix type of second integer in CallScriptDebugDelegate function overload
+        to be int to match the actual Objective-C method. Added a new overload
+        that includes a BOOL in the right place. Added a boolean named
+        exceptionWasRaisedExpectsHasHandlerFlag.
+
+        * WebView/WebDelegateImplementationCaching.mm:
+        (CallDelegate): Added overloads as above.
+        (CallScriptDebugDelegate): Ditto.
+
+        * WebView/WebScriptDebugDelegate.h: Added new method with the additional
+        boolean argument. Marked the old method informally deprecated.
+
+        * WebView/WebScriptDebugger.mm:
+        (WebScriptDebugger::exception): Added code to call with or without the
+        boolean depending on exceptionWasRaisedExpectsHasHandlerFlag.
+
+        * WebView/WebView.mm:
+        (-[WebView _cacheScriptDebugDelegateImplementations]): Set up the
+        exceptionWasRaisedExpectsHasHandlerFlag. Also fixed old code that was not
+        guaranteed to set didParseSourceExpectsBaseLineNumber to NO.
+
 2011-01-19  Tony Gentilcore  <tonyg at chromium.org>
 
         Reviewed by Mihai Parparita.
diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h
index 2aadc83..8bc776b 100644
--- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h
+++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h
@@ -80,6 +80,7 @@ struct WebFrameLoadDelegateImplementationCache {
 
 struct WebScriptDebugDelegateImplementationCache {
     BOOL didParseSourceExpectsBaseLineNumber;
+    BOOL exceptionWasRaisedExpectsHasHandlerFlag;
     IMP didParseSourceFunc;
     IMP failedToParseSourceFunc;
     IMP didEnterCallFrameFunc;
@@ -138,7 +139,8 @@ BOOL CallResourceLoadDelegateReturningBoolean(BOOL, IMP, WebView *, SEL, id, id,
 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, id, NSInteger, id);
 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
-id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);
+id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, int, id);
+id CallScriptDebugDelegate(IMP, WebView *, SEL, id, BOOL, NSInteger, int, id);
 
 id CallHistoryDelegate(IMP, WebView *, SEL);
 id CallHistoryDelegate(IMP, WebView *, SEL, id, id);
diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
index d00d60b..c070b2b 100644
--- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
+++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm
@@ -345,7 +345,7 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE
     return nil;
 }
 
-static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, NSInteger integer2, id object2)
+static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
 {
     if (!delegate)
         return nil;
@@ -359,6 +359,20 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE
     return nil;
 }
 
+static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
+{
+    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) {
+        ReportDiscardedDelegateException(selector, exception);
+    }
+    return nil;
+}
+
 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
 {
     if (!delegate)
@@ -574,11 +588,16 @@ id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id o
     return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer, object2, object3, object4);
 }
 
-id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, NSInteger integer2, id object2)
+id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
 {
     return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
 }
 
+id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
+{
+    return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, boolean, integer1, integer2, object2);
+}
+
 id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector)
 {
     return CallDelegate(implementation, self, self->_private->historyDelegate, selector);
diff --git a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h
index 823cc35..2444b98 100644
--- a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h
+++ b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h
@@ -99,9 +99,17 @@ enum {
 
 // exception is being thrown
 - (void)webView:(WebView *)webView   exceptionWasRaised:(WebScriptCallFrame *)frame
+                                             hasHandler:(BOOL)hasHandler
                                                sourceId:(WebSourceId)sid
                                                    line:(int)lineno
                                             forWebFrame:(WebFrame *)webFrame;
+
+// exception is being thrown (deprecated old version; called only if new version is not implemented)
+- (void)webView:(WebView *)webView   exceptionWasRaised:(WebScriptCallFrame *)frame
+                                               sourceId:(WebSourceId)sid
+                                                   line:(int)lineno
+                                            forWebFrame:(WebFrame *)webFrame;
+
 @end
 
 
diff --git a/Source/WebKit/mac/WebView/WebScriptDebugger.mm b/Source/WebKit/mac/WebView/WebScriptDebugger.mm
index 533f033..9bc3bce 100644
--- a/Source/WebKit/mac/WebView/WebScriptDebugger.mm
+++ b/Source/WebKit/mac/WebView/WebScriptDebugger.mm
@@ -212,9 +212,13 @@ void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, in
     WebView *webView = [webFrame webView];
     [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
 
-    WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
-    if (implementations->exceptionWasRaisedFunc)
-        CallScriptDebugDelegate(implementations->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), sourceID, lineNumber, webFrame);
+    WebScriptDebugDelegateImplementationCache* cache = WebViewGetScriptDebugDelegateImplementations(webView);
+    if (cache->exceptionWasRaisedFunc) {
+        if (cache->exceptionWasRaisedExpectsHasHandlerFlag)
+            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), m_topCallFrame.get(), hasHandler, sourceID, lineNumber, webFrame);
+        else
+            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), sourceID, lineNumber, webFrame);
+    }
 
     m_callingDelegate = false;
 }
diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm
index 809b286..720022b 100644
--- a/Source/WebKit/mac/WebView/WebView.mm
+++ b/Source/WebKit/mac/WebView/WebView.mm
@@ -1604,14 +1604,23 @@ static inline IMP getMethod(id o, SEL s)
     cache->didParseSourceFunc = getMethod(delegate, @selector(webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:));
     if (cache->didParseSourceFunc)
         cache->didParseSourceExpectsBaseLineNumber = YES;
-    else
+    else {
+        cache->didParseSourceExpectsBaseLineNumber = NO;
         cache->didParseSourceFunc = getMethod(delegate, @selector(webView:didParseSource:fromURL:sourceId:forWebFrame:));
+    }
 
     cache->failedToParseSourceFunc = getMethod(delegate, @selector(webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:));
     cache->didEnterCallFrameFunc = getMethod(delegate, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:));
     cache->willExecuteStatementFunc = getMethod(delegate, @selector(webView:willExecuteStatement:sourceId:line:forWebFrame:));
     cache->willLeaveCallFrameFunc = getMethod(delegate, @selector(webView:willLeaveCallFrame:sourceId:line:forWebFrame:));
-    cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
+
+    cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:));
+    if (cache->exceptionWasRaisedFunc)
+        cache->exceptionWasRaisedExpectsHasHandlerFlag = YES;
+    else {
+        cache->exceptionWasRaisedExpectsHasHandlerFlag = NO;
+        cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
+    }
 }
 
 - (void)_cacheHistoryDelegateImplementations

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list