Changeset 156245 in webkit


Ignore:
Timestamp:
Sep 22, 2013, 12:34:49 AM (12 years ago)
Author:
mark.lam@apple.com
Message:

Remove unused code in WebKit/mac's WebScriptDebugDelegate.
https://bugs.webkit.org/show_bug.cgi?id=121706.

Reviewed by Timothy Hatcher.

WebScriptDebugDelegate's didEnterCallFrame, willExecuteStatement,
and willLeaveCallFrame are not in use. Removed them and all methods
and fields used for supporting them.

  • WebView/WebDelegateImplementationCaching.h:
  • WebView/WebScriptDebugDelegate.h:
  • WebView/WebScriptDebugDelegate.mm:

(-[WebScriptCallFramePrivate dealloc]):
(-[WebScriptCallFrame _initWithGlobalObject:debuggerCallFrame:]):

  • WebView/WebScriptDebugger.h:

(WebScriptDebugger::globalObject):
(WebScriptDebugger::callEvent):
(WebScriptDebugger::atStatement):
(WebScriptDebugger::returnEvent):
(WebScriptDebugger::willExecuteProgram):
(WebScriptDebugger::didExecuteProgram):
(WebScriptDebugger::didReachBreakpoint):

  • WebView/WebScriptDebugger.mm:

(WebScriptDebugger::WebScriptDebugger):
(WebScriptDebugger::exception):

  • WebView/WebView.mm:

(-[WebView _cacheScriptDebugDelegateImplementations]):

Location:
trunk/Source/WebKit/mac
Files:
7 edited

Legend:

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

    r156056 r156245  
     12013-09-21  Mark Lam  <mark.lam@apple.com>
     2
     3        Remove unused code in WebKit/mac's WebScriptDebugDelegate.
     4        https://bugs.webkit.org/show_bug.cgi?id=121706.
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        WebScriptDebugDelegate's didEnterCallFrame, willExecuteStatement,
     9        and willLeaveCallFrame are not in use. Removed them and all methods
     10        and fields used for supporting them.
     11
     12        * WebView/WebDelegateImplementationCaching.h:
     13        * WebView/WebScriptDebugDelegate.h:
     14        * WebView/WebScriptDebugDelegate.mm:
     15        (-[WebScriptCallFramePrivate dealloc]):
     16        (-[WebScriptCallFrame _initWithGlobalObject:debuggerCallFrame:]):
     17        * WebView/WebScriptDebugger.h:
     18        (WebScriptDebugger::globalObject):
     19        (WebScriptDebugger::callEvent):
     20        (WebScriptDebugger::atStatement):
     21        (WebScriptDebugger::returnEvent):
     22        (WebScriptDebugger::willExecuteProgram):
     23        (WebScriptDebugger::didExecuteProgram):
     24        (WebScriptDebugger::didReachBreakpoint):
     25        * WebView/WebScriptDebugger.mm:
     26        (WebScriptDebugger::WebScriptDebugger):
     27        (WebScriptDebugger::exception):
     28        * WebView/WebView.mm:
     29        (-[WebView _cacheScriptDebugDelegateImplementations]):
     30
    1312013-09-18  Anders Carlsson  <andersca@apple.com>
    232
  • TabularUnified trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h

    r150205 r156245  
    1 /*
    2  * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     1 /*
     2 * Copyright (C) 2005-2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    9292    IMP didParseSourceFunc;
    9393    IMP failedToParseSourceFunc;
    94     IMP didEnterCallFrameFunc;
    95     IMP willExecuteStatementFunc;
    96     IMP willLeaveCallFrameFunc;
    9794    IMP exceptionWasRaisedFunc;
    9895};
  • TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h

    r147447 r156245  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2005-2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7070                                            forWebFrame:(WebFrame *)webFrame;
    7171
    72 // just entered a stack frame (i.e. called a function, or started global scope)
    73 - (void)webView:(WebView *)webView    didEnterCallFrame:(WebScriptCallFrame *)frame
    74                                                sourceId:(WebSourceId)sid
    75                                                    line:(int)lineno
    76                                             forWebFrame:(WebFrame *)webFrame;
    77 
    78 // about to execute some code
    79 - (void)webView:(WebView *)webView willExecuteStatement:(WebScriptCallFrame *)frame
    80                                                sourceId:(WebSourceId)sid
    81                                                    line:(int)lineno
    82                                             forWebFrame:(WebFrame *)webFrame;
    83 
    84 // about to leave a stack frame (i.e. return from a function)
    85 - (void)webView:(WebView *)webView   willLeaveCallFrame:(WebScriptCallFrame *)frame
    86                                                sourceId:(WebSourceId)sid
    87                                                    line:(int)lineno
    88                                             forWebFrame:(WebFrame *)webFrame;
    89 
    9072// exception is being thrown
    9173- (void)webView:(WebView *)webView   exceptionWasRaised:(WebScriptCallFrame *)frame
     
    122104- (id)userInfo;
    123105
    124 // get next frame on call stack (or nil if this is already the "global" frame)
    125 - (WebScriptCallFrame *)caller;
    126 
    127 // get array of WebScriptObjects for each scope (innermost first, last is always global object)
    128 - (NSArray *)scopeChain;
    129 
    130106// get name of function (if available) or nil
    131107- (NSString *)functionName;
     
    134110- (id)exception;
    135111
    136 // evaluate a script (as if by "eval") in the context of this frame
    137 - (id)evaluateWebScript:(NSString *)script;
    138 
    139112@end
  • TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm

    r148696 r156245  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2005-2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    6363@public
    6464    WebScriptObject        *globalObject;   // the global object's proxy (not retained)
    65     WebScriptCallFrame     *caller;         // previous stack frame
    6665    DebuggerCallFrame* debuggerCallFrame;
    67     WebScriptDebugger* debugger;
    6866}
    6967@end
     
    7270- (void)dealloc
    7371{
    74     [caller release];
    7572    delete debuggerCallFrame;
    7673    [super dealloc];
     
    8986@implementation WebScriptCallFrame (WebScriptDebugDelegateInternal)
    9087
    91 - (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debugger:(WebScriptDebugger *)debugger caller:(WebScriptCallFrame *)caller debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
     88- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
    9289{
    9390    if ((self = [super init])) {
    9491        _private = [[WebScriptCallFramePrivate alloc] init];
    9592        _private->globalObject = globalObj;
    96         _private->caller = [caller retain];
    97         _private->debugger = debugger;
     93        _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame);
    9894    }
    9995    return self;
    100 }
    101 
    102 - (void)_setDebuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
    103 {
    104     if (!_private->debuggerCallFrame)
    105         _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame);
    106     else
    107         *_private->debuggerCallFrame = debuggerCallFrame;
    108 }
    109 
    110 - (void)_clearDebuggerCallFrame
    111 {
    112     delete _private->debuggerCallFrame;
    113     _private->debuggerCallFrame = 0;
    11496}
    11597
     
    160142}
    161143
    162 - (WebScriptCallFrame *)caller
    163 {
    164     return _private->caller;
    165 }
    166 
    167 // Returns an array of scope objects (most local first).
    168 // The properties of each scope object are the variables for that scope.
    169 // Note that the last entry in the array will _always_ be the global object (windowScriptObject),
    170 // whose properties are the global variables.
    171 
    172 - (NSArray *)scopeChain
    173 {
    174     if (!_private->debuggerCallFrame)
    175         return [NSArray array];
    176 
    177 
    178     JSScope* scope = _private->debuggerCallFrame->scope();
    179     JSLockHolder lock(scope->vm());
    180     if (!scope->next())  // global frame
    181         return [NSArray arrayWithObject:_private->globalObject];
    182 
    183     NSMutableArray *scopes = [[NSMutableArray alloc] init];
    184 
    185     ScopeChainIterator end = scope->end();
    186     for (ScopeChainIterator it = scope->begin(); it != end; ++it) {
    187         JSObject* object = it.get();
    188         if (object->isActivationObject())
    189             object = DebuggerActivation::create(*scope->vm(), object);
    190         [scopes addObject:[self _convertValueToObjcValue:object]];
    191     }
    192 
    193     NSArray *result = [NSArray arrayWithArray:scopes];
    194     [scopes release];
    195     return result;
    196 }
    197 
    198144// Returns the name of the function for this frame, if available.
    199145// Returns nil for anonymous functions and for the global frame.
     
    219165}
    220166
    221 // Evaluate some JavaScript code in the context of this frame.
    222 // The code is evaluated as if by "eval", and the result is returned.
    223 // If there is an (uncaught) exception, it is returned as though _it_ were the result.
    224 // Calling this method on the global frame is not quite the same as calling the WebScriptObject
    225 // method of the same name, due to the treatment of exceptions.
    226 
    227 - (id)evaluateWebScript:(NSString *)script
    228 {
    229     if (!_private->debuggerCallFrame)
    230         return nil;
    231 
    232     // If this is the global call frame and there is no dynamic global object,
    233     // Dashcode is attempting to execute JS in the evaluator using a stale
    234     // WebScriptCallFrame. Instead, we need to set the dynamic global object
    235     // and evaluate the JS in the global object's global call frame.
    236     JSGlobalObject* globalObject = _private->debugger->globalObject();
    237     JSLockHolder lock(globalObject->vm());
    238 
    239     if (self == _private->debugger->globalCallFrame() && !globalObject->vm().dynamicGlobalObject) {
    240         JSGlobalObject* globalObject = _private->debugger->globalObject();
    241 
    242         DynamicGlobalObjectScope globalObjectScope(globalObject->vm(), globalObject);
    243 
    244         JSC::JSValue exception;
    245         JSC::JSValue result = evaluateInGlobalCallFrame(script, exception, globalObject);
    246         if (exception)
    247             return [self _convertValueToObjcValue:exception];
    248         return result ? [self _convertValueToObjcValue:result] : nil;       
    249     }
    250 
    251     JSC::JSValue exception;
    252     JSC::JSValue result = _private->debuggerCallFrame->evaluate(script, exception);
    253     if (exception)
    254         return [self _convertValueToObjcValue:exception];
    255     return result ? [self _convertValueToObjcValue:result] : nil;
    256 }
    257 
    258167@end
  • TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugger.h

    r155622 r156245  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5353    WebScriptDebugger(JSC::JSGlobalObject*);
    5454
    55     void initGlobalCallFrame(const JSC::DebuggerCallFrame&);
    56 
    57     virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const WTF::String& errorMsg);
    58     virtual void callEvent(const JSC::DebuggerCallFrame&);
    59     virtual void atStatement(const JSC::DebuggerCallFrame&);
    60     virtual void returnEvent(const JSC::DebuggerCallFrame&);
    61     virtual void exception(const JSC::DebuggerCallFrame&, bool hasHandler);
    62     virtual void willExecuteProgram(const JSC::DebuggerCallFrame&);
    63     virtual void didExecuteProgram(const JSC::DebuggerCallFrame&);
    64     virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&);
    65 
    6655    JSC::JSGlobalObject* globalObject() const { return m_globalObject.get(); }
    67     WebScriptCallFrame *globalCallFrame() const { return m_globalCallFrame.get(); }
    6856
    6957private:
     58    virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const WTF::String& errorMsg);
     59    virtual void callEvent(const JSC::DebuggerCallFrame&) { }
     60    virtual void atStatement(const JSC::DebuggerCallFrame&) { }
     61    virtual void returnEvent(const JSC::DebuggerCallFrame&) { }
     62    virtual void exception(const JSC::DebuggerCallFrame&, bool hasHandler);
     63    virtual void willExecuteProgram(const JSC::DebuggerCallFrame&) { }
     64    virtual void didExecuteProgram(const JSC::DebuggerCallFrame&) { }
     65    virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&) { }
     66
    7067    bool m_callingDelegate;
    71     RetainPtr<WebScriptCallFrame> m_topCallFrame;
    7268
    7369    JSC::Strong<JSC::JSGlobalObject> m_globalObject;
    74     RetainPtr<WebScriptCallFrame> m_globalCallFrame;
    7570};
    7671
  • TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm

    r155622 r156245  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4747
    4848@interface WebScriptCallFrame (WebScriptDebugDelegateInternal)
    49 - (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debugger:(WebScriptDebugger *)debugger caller:(WebScriptCallFrame *)caller debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
    50 - (void)_setDebuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
    51 - (void)_clearDebuggerCallFrame;
     49- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
    5250@end
    5351
     
    7977{
    8078    attach(globalObject);
    81     initGlobalCallFrame(DebuggerCallFrame(globalObject->globalExec(), 0, 0));
    82 }
    83 
    84 void WebScriptDebugger::initGlobalCallFrame(const DebuggerCallFrame& debuggerCallFrame)
    85 {
    86     m_callingDelegate = true;
    87 
    88     WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
    89 
    90     m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
    91     m_globalCallFrame = m_topCallFrame;
    92 
    93     WebView *webView = [webFrame webView];
    94     WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
    95     if (implementations->didEnterCallFrameFunc)
    96         CallScriptDebugDelegate(implementations->didEnterCallFrameFunc, webView, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:), m_topCallFrame.get(), static_cast<NSInteger>(0), -1, webFrame);
    97 
    98     m_callingDelegate = false;
    9979}
    10080
     
    137117}
    138118
    139 void WebScriptDebugger::callEvent(const DebuggerCallFrame& debuggerCallFrame)
    140 {
    141     if (m_callingDelegate)
    142         return;
    143 
    144     m_callingDelegate = true;
    145 
    146     WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
    147 
    148     m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
    149 
    150     WebView *webView = [webFrame webView];
    151     WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
    152     if (implementations->didEnterCallFrameFunc)
    153         CallScriptDebugDelegate(implementations->didEnterCallFrameFunc, webView, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    154 
    155     m_callingDelegate = false;
    156 }
    157 
    158 void WebScriptDebugger::atStatement(const DebuggerCallFrame& debuggerCallFrame)
    159 {
    160     if (m_callingDelegate)
    161         return;
    162 
    163     m_callingDelegate = true;
    164 
    165     WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
    166     WebView *webView = [webFrame webView];
    167 
    168     [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
    169 
    170     WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
    171     if (implementations->willExecuteStatementFunc)
    172         CallScriptDebugDelegate(implementations->willExecuteStatementFunc, webView, @selector(webView:willExecuteStatement:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    173 
    174     m_callingDelegate = false;
    175 }
    176 
    177 void WebScriptDebugger::returnEvent(const DebuggerCallFrame& debuggerCallFrame)
    178 {
    179     if (m_callingDelegate)
    180         return;
    181 
    182     m_callingDelegate = true;
    183 
    184     WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
    185     WebView *webView = [webFrame webView];
    186 
    187     [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
    188 
    189     WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
    190     if (implementations->willLeaveCallFrameFunc)
    191         CallScriptDebugDelegate(implementations->willLeaveCallFrameFunc, webView, @selector(webView:willLeaveCallFrame:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    192 
    193     [m_topCallFrame.get() _clearDebuggerCallFrame];
    194     m_topCallFrame = [m_topCallFrame.get() caller];
    195 
    196     m_callingDelegate = false;
    197 }
    198 
    199119void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, bool hasHandler)
    200120{
     
    206126    WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
    207127    WebView *webView = [webFrame webView];
    208     [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
     128    RetainPtr<WebScriptCallFrame> callFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debuggerCallFrame:debuggerCallFrame]);
    209129
    210130    WebScriptDebugDelegateImplementationCache* cache = WebViewGetScriptDebugDelegateImplementations(webView);
    211131    if (cache->exceptionWasRaisedFunc) {
    212132        if (cache->exceptionWasRaisedExpectsHasHandlerFlag)
    213             CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), m_topCallFrame.get(), hasHandler, debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
     133            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), callFrame.get(), hasHandler, debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    214134        else
    215             CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
     135            CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), callFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
    216136    }
    217137
    218138    m_callingDelegate = false;
    219139}
    220 
    221 void WebScriptDebugger::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame)
    222 {
    223     callEvent(debuggerCallFrame);
    224 }
    225 
    226 void WebScriptDebugger::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame)
    227 {
    228     returnEvent(debuggerCallFrame);
    229 }
    230 
    231 void WebScriptDebugger::didReachBreakpoint(const DebuggerCallFrame&)
    232 {
    233     return;
    234 }
  • TabularUnified trunk/Source/WebKit/mac/WebView/WebView.mm

    r155726 r156245  
    17091709
    17101710    cache->failedToParseSourceFunc = getMethod(delegate, @selector(webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:));
    1711     cache->didEnterCallFrameFunc = getMethod(delegate, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:));
    1712     cache->willExecuteStatementFunc = getMethod(delegate, @selector(webView:willExecuteStatement:sourceId:line:forWebFrame:));
    1713     cache->willLeaveCallFrameFunc = getMethod(delegate, @selector(webView:willLeaveCallFrame:sourceId:line:forWebFrame:));
    17141711
    17151712    cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:));
Note: See TracChangeset for help on using the changeset viewer.