Changeset 76191 in webkit


Ignore:
Timestamp:
Jan 19, 2011 6:18:13 PM (13 years ago)
Author:
Darin Adler
Message:

2011-01-19 Darin Adler <Darin Adler>

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.
Location:
trunk/Source/WebKit/mac
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r76170 r76191  
     12011-01-19  Darin Adler  <darin@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Would like script debugging protocol method to differentiate between caught and uncaught exceptions
     6        https://bugs.webkit.org/show_bug.cgi?id=52104
     7        rdar://problem/8704226
     8
     9        * WebView/WebDelegateImplementationCaching.h:
     10        Fix type of second integer in CallScriptDebugDelegate function overload
     11        to be int to match the actual Objective-C method. Added a new overload
     12        that includes a BOOL in the right place. Added a boolean named
     13        exceptionWasRaisedExpectsHasHandlerFlag.
     14
     15        * WebView/WebDelegateImplementationCaching.mm:
     16        (CallDelegate): Added overloads as above.
     17        (CallScriptDebugDelegate): Ditto.
     18
     19        * WebView/WebScriptDebugDelegate.h: Added new method with the additional
     20        boolean argument. Marked the old method informally deprecated.
     21
     22        * WebView/WebScriptDebugger.mm:
     23        (WebScriptDebugger::exception): Added code to call with or without the
     24        boolean depending on exceptionWasRaisedExpectsHasHandlerFlag.
     25
     26        * WebView/WebView.mm:
     27        (-[WebView _cacheScriptDebugDelegateImplementations]): Set up the
     28        exceptionWasRaisedExpectsHasHandlerFlag. Also fixed old code that was not
     29        guaranteed to set didParseSourceExpectsBaseLineNumber to NO.
     30
    1312011-01-19  Tony Gentilcore  <tonyg@chromium.org>
    232
  • trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h

    r58442 r76191  
    8181struct WebScriptDebugDelegateImplementationCache {
    8282    BOOL didParseSourceExpectsBaseLineNumber;
     83    BOOL exceptionWasRaisedExpectsHasHandlerFlag;
    8384    IMP didParseSourceFunc;
    8485    IMP failedToParseSourceFunc;
     
    139140id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, NSInteger, id);
    140141id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, id, id, id);
    141 id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, NSInteger, id);
     142id CallScriptDebugDelegate(IMP, WebView *, SEL, id, NSInteger, int, id);
     143id CallScriptDebugDelegate(IMP, WebView *, SEL, id, BOOL, NSInteger, int, id);
    142144
    143145id CallHistoryDelegate(IMP, WebView *, SEL);
  • trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm

    r58442 r76191  
    346346}
    347347
    348 static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, NSInteger integer2, id object2)
     348static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
    349349{
    350350    if (!delegate)
     
    360360}
    361361
     362static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
     363{
     364    if (!delegate)
     365        return nil;
     366    if (!self->_private->catchesDelegateExceptions)
     367        return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
     368    @try {
     369        return implementation(delegate, selector, self, object1, boolean, integer1, integer2, object2);
     370    } @catch(id exception) {
     371        ReportDiscardedDelegateException(selector, exception);
     372    }
     373    return nil;
     374}
     375
    362376static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object1, id object2, NSInteger integer, id object3)
    363377{
     
    575589}
    576590
    577 id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, NSInteger integer2, id object2)
     591id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, NSInteger integer1, int integer2, id object2)
    578592{
    579593    return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, integer1, integer2, object2);
    580594}
    581595
     596id CallScriptDebugDelegate(IMP implementation, WebView *self, SEL selector, id object1, BOOL boolean, NSInteger integer1, int integer2, id object2)
     597{
     598    return CallDelegate(implementation, self, self->_private->scriptDebugDelegate, selector, object1, boolean, integer1, integer2, object2);
     599}
     600
    582601id CallHistoryDelegate(IMP implementation, WebView *self, SEL selector)
    583602{
  • trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h

    r40631 r76191  
    100100// exception is being thrown
    101101- (void)webView:(WebView *)webView   exceptionWasRaised:(WebScriptCallFrame *)frame
     102                                             hasHandler:(BOOL)hasHandler
    102103                                               sourceId:(WebSourceId)sid
    103104                                                   line:(int)lineno
    104105                                            forWebFrame:(WebFrame *)webFrame;
     106
     107// exception is being thrown (deprecated old version; called only if new version is not implemented)
     108- (void)webView:(WebView *)webView   exceptionWasRaised:(WebScriptCallFrame *)frame
     109                                               sourceId:(WebSourceId)sid
     110                                                   line:(int)lineno
     111                                            forWebFrame:(WebFrame *)webFrame;
     112
    105113@end
    106114
  • trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm

    r76129 r76191  
    213213    [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
    214214
    215     WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
    216     if (implementations->exceptionWasRaisedFunc)
    217         CallScriptDebugDelegate(implementations->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), sourceID, lineNumber, webFrame);
     215    WebScriptDebugDelegateImplementationCache* cache = WebViewGetScriptDebugDelegateImplementations(webView);
     216    if (cache->exceptionWasRaisedFunc) {
     217        if (cache->exceptionWasRaisedExpectsHasHandlerFlag)
     218            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), m_topCallFrame.get(), hasHandler, sourceID, lineNumber, webFrame);
     219        else
     220            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), sourceID, lineNumber, webFrame);
     221    }
    218222
    219223    m_callingDelegate = false;
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r75857 r76191  
    16051605    if (cache->didParseSourceFunc)
    16061606        cache->didParseSourceExpectsBaseLineNumber = YES;
    1607     else
     1607    else {
     1608        cache->didParseSourceExpectsBaseLineNumber = NO;
    16081609        cache->didParseSourceFunc = getMethod(delegate, @selector(webView:didParseSource:fromURL:sourceId:forWebFrame:));
     1610    }
    16091611
    16101612    cache->failedToParseSourceFunc = getMethod(delegate, @selector(webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:));
     
    16121614    cache->willExecuteStatementFunc = getMethod(delegate, @selector(webView:willExecuteStatement:sourceId:line:forWebFrame:));
    16131615    cache->willLeaveCallFrameFunc = getMethod(delegate, @selector(webView:willLeaveCallFrame:sourceId:line:forWebFrame:));
    1614     cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
     1616
     1617    cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:));
     1618    if (cache->exceptionWasRaisedFunc)
     1619        cache->exceptionWasRaisedExpectsHasHandlerFlag = YES;
     1620    else {
     1621        cache->exceptionWasRaisedExpectsHasHandlerFlag = NO;
     1622        cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:));
     1623    }
    16151624}
    16161625
Note: See TracChangeset for help on using the changeset viewer.