Changeset 156245 in webkit
- Timestamp:
- Sep 22, 2013, 12:34:49 AM (12 years ago)
- Location:
- trunk/Source/WebKit/mac
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebKit/mac/ChangeLog ¶
r156056 r156245 1 2013-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 1 31 2013-09-18 Anders Carlsson <andersca@apple.com> 2 32 -
TabularUnified trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h ¶
r150205 r156245 1 /*2 * Copyright (C) 2005 , 2006, 2007, 2008, 2009Apple Inc. All rights reserved.1 /* 2 * Copyright (C) 2005-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 92 92 IMP didParseSourceFunc; 93 93 IMP failedToParseSourceFunc; 94 IMP didEnterCallFrameFunc;95 IMP willExecuteStatementFunc;96 IMP willLeaveCallFrameFunc;97 94 IMP exceptionWasRaisedFunc; 98 95 }; -
TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h ¶
r147447 r156245 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2005-2013 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 70 70 forWebFrame:(WebFrame *)webFrame; 71 71 72 // just entered a stack frame (i.e. called a function, or started global scope)73 - (void)webView:(WebView *)webView didEnterCallFrame:(WebScriptCallFrame *)frame74 sourceId:(WebSourceId)sid75 line:(int)lineno76 forWebFrame:(WebFrame *)webFrame;77 78 // about to execute some code79 - (void)webView:(WebView *)webView willExecuteStatement:(WebScriptCallFrame *)frame80 sourceId:(WebSourceId)sid81 line:(int)lineno82 forWebFrame:(WebFrame *)webFrame;83 84 // about to leave a stack frame (i.e. return from a function)85 - (void)webView:(WebView *)webView willLeaveCallFrame:(WebScriptCallFrame *)frame86 sourceId:(WebSourceId)sid87 line:(int)lineno88 forWebFrame:(WebFrame *)webFrame;89 90 72 // exception is being thrown 91 73 - (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame … … 122 104 - (id)userInfo; 123 105 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 130 106 // get name of function (if available) or nil 131 107 - (NSString *)functionName; … … 134 110 - (id)exception; 135 111 136 // evaluate a script (as if by "eval") in the context of this frame137 - (id)evaluateWebScript:(NSString *)script;138 139 112 @end -
TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm ¶
r148696 r156245 1 1 /* 2 * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.2 * Copyright (C) 2005-2013 Apple Computer, Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 63 63 @public 64 64 WebScriptObject *globalObject; // the global object's proxy (not retained) 65 WebScriptCallFrame *caller; // previous stack frame66 65 DebuggerCallFrame* debuggerCallFrame; 67 WebScriptDebugger* debugger;68 66 } 69 67 @end … … 72 70 - (void)dealloc 73 71 { 74 [caller release];75 72 delete debuggerCallFrame; 76 73 [super dealloc]; … … 89 86 @implementation WebScriptCallFrame (WebScriptDebugDelegateInternal) 90 87 91 - (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debugger :(WebScriptDebugger *)debugger caller:(WebScriptCallFrame *)caller debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame88 - (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame 92 89 { 93 90 if ((self = [super init])) { 94 91 _private = [[WebScriptCallFramePrivate alloc] init]; 95 92 _private->globalObject = globalObj; 96 _private->caller = [caller retain]; 97 _private->debugger = debugger; 93 _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame); 98 94 } 99 95 return self; 100 }101 102 - (void)_setDebuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame103 {104 if (!_private->debuggerCallFrame)105 _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame);106 else107 *_private->debuggerCallFrame = debuggerCallFrame;108 }109 110 - (void)_clearDebuggerCallFrame111 {112 delete _private->debuggerCallFrame;113 _private->debuggerCallFrame = 0;114 96 } 115 97 … … 160 142 } 161 143 162 - (WebScriptCallFrame *)caller163 {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 *)scopeChain173 {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 frame181 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 198 144 // Returns the name of the function for this frame, if available. 199 145 // Returns nil for anonymous functions and for the global frame. … … 219 165 } 220 166 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 WebScriptObject225 // method of the same name, due to the treatment of exceptions.226 227 - (id)evaluateWebScript:(NSString *)script228 {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 stale234 // WebScriptCallFrame. Instead, we need to set the dynamic global object235 // 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 258 167 @end -
TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugger.h ¶
r155622 r156245 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 WebScriptDebugger(JSC::JSGlobalObject*); 54 54 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 66 55 JSC::JSGlobalObject* globalObject() const { return m_globalObject.get(); } 67 WebScriptCallFrame *globalCallFrame() const { return m_globalCallFrame.get(); }68 56 69 57 private: 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 70 67 bool m_callingDelegate; 71 RetainPtr<WebScriptCallFrame> m_topCallFrame;72 68 73 69 JSC::Strong<JSC::JSGlobalObject> m_globalObject; 74 RetainPtr<WebScriptCallFrame> m_globalCallFrame;75 70 }; 76 71 -
TabularUnified trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm ¶
r155622 r156245 1 1 /* 2 * Copyright (C) 2008 Apple Inc. All rights reserved.2 * Copyright (C) 2008-2013 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 47 47 48 48 @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; 52 50 @end 53 51 … … 79 77 { 80 78 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;99 79 } 100 80 … … 137 117 } 138 118 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 199 119 void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, bool hasHandler) 200 120 { … … 206 126 WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject()); 207 127 WebView *webView = [webFrame webView]; 208 [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];128 RetainPtr<WebScriptCallFrame> callFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debuggerCallFrame:debuggerCallFrame]); 209 129 210 130 WebScriptDebugDelegateImplementationCache* cache = WebViewGetScriptDebugDelegateImplementations(webView); 211 131 if (cache->exceptionWasRaisedFunc) { 212 132 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); 214 134 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); 216 136 } 217 137 218 138 m_callingDelegate = false; 219 139 } 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 1709 1709 1710 1710 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:));1714 1711 1715 1712 cache->exceptionWasRaisedFunc = getMethod(delegate, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:));
Note:
See TracChangeset
for help on using the changeset viewer.