Diff
Modified: trunk/Source/WebKit/mac/ChangeLog (156244 => 156245)
--- trunk/Source/WebKit/mac/ChangeLog 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/ChangeLog 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1,3 +1,33 @@
+2013-09-21 Mark Lam <[email protected]>
+
+ 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]):
+
2013-09-18 Anders Carlsson <[email protected]>
RefPtrHashMap should work with move only types
Modified: trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h (156244 => 156245)
--- trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1,5 +1,5 @@
-/*
- * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ /*
+ * Copyright (C) 2005-2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -91,9 +91,6 @@
BOOL exceptionWasRaisedExpectsHasHandlerFlag;
IMP didParseSourceFunc;
IMP failedToParseSourceFunc;
- IMP didEnterCallFrameFunc;
- IMP willExecuteStatementFunc;
- IMP willLeaveCallFrameFunc;
IMP exceptionWasRaisedFunc;
};
Modified: trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h (156244 => 156245)
--- trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005-2013 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -69,24 +69,6 @@
withError:(NSError *)error
forWebFrame:(WebFrame *)webFrame;
-// just entered a stack frame (i.e. called a function, or started global scope)
-- (void)webView:(WebView *)webView didEnterCallFrame:(WebScriptCallFrame *)frame
- sourceId:(WebSourceId)sid
- line:(int)lineno
- forWebFrame:(WebFrame *)webFrame;
-
-// about to execute some code
-- (void)webView:(WebView *)webView willExecuteStatement:(WebScriptCallFrame *)frame
- sourceId:(WebSourceId)sid
- line:(int)lineno
- forWebFrame:(WebFrame *)webFrame;
-
-// about to leave a stack frame (i.e. return from a function)
-- (void)webView:(WebView *)webView willLeaveCallFrame:(WebScriptCallFrame *)frame
- sourceId:(WebSourceId)sid
- line:(int)lineno
- forWebFrame:(WebFrame *)webFrame;
-
// exception is being thrown
- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
hasHandler:(BOOL)hasHandler
@@ -121,19 +103,10 @@
// retrieve user info
- (id)userInfo;
-// get next frame on call stack (or nil if this is already the "global" frame)
-- (WebScriptCallFrame *)caller;
-
-// get array of WebScriptObjects for each scope (innermost first, last is always global object)
-- (NSArray *)scopeChain;
-
// get name of function (if available) or nil
- (NSString *)functionName;
// get pending exception (if any) or nil
- (id)exception;
-// evaluate a script (as if by "eval") in the context of this frame
-- (id)evaluateWebScript:(NSString *)script;
-
@end
Modified: trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm (156244 => 156245)
--- trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/WebView/WebScriptDebugDelegate.mm 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005-2013 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -62,16 +62,13 @@
@interface WebScriptCallFramePrivate : NSObject {
@public
WebScriptObject *globalObject; // the global object's proxy (not retained)
- WebScriptCallFrame *caller; // previous stack frame
DebuggerCallFrame* debuggerCallFrame;
- WebScriptDebugger* debugger;
}
@end
@implementation WebScriptCallFramePrivate
- (void)dealloc
{
- [caller release];
delete debuggerCallFrame;
[super dealloc];
}
@@ -88,31 +85,16 @@
@implementation WebScriptCallFrame (WebScriptDebugDelegateInternal)
-- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debugger:(WebScriptDebugger *)debugger caller:(WebScriptCallFrame *)caller debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
+- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
{
if ((self = [super init])) {
_private = [[WebScriptCallFramePrivate alloc] init];
_private->globalObject = globalObj;
- _private->caller = [caller retain];
- _private->debugger = debugger;
+ _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame);
}
return self;
}
-- (void)_setDebuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame
-{
- if (!_private->debuggerCallFrame)
- _private->debuggerCallFrame = new DebuggerCallFrame(debuggerCallFrame);
- else
- *_private->debuggerCallFrame = debuggerCallFrame;
-}
-
-- (void)_clearDebuggerCallFrame
-{
- delete _private->debuggerCallFrame;
- _private->debuggerCallFrame = 0;
-}
-
- (id)_convertValueToObjcValue:(JSC::JSValue)value
{
if (!value)
@@ -159,42 +141,6 @@
return _userInfo;
}
-- (WebScriptCallFrame *)caller
-{
- return _private->caller;
-}
-
-// Returns an array of scope objects (most local first).
-// The properties of each scope object are the variables for that scope.
-// Note that the last entry in the array will _always_ be the global object (windowScriptObject),
-// whose properties are the global variables.
-
-- (NSArray *)scopeChain
-{
- if (!_private->debuggerCallFrame)
- return [NSArray array];
-
-
- JSScope* scope = _private->debuggerCallFrame->scope();
- JSLockHolder lock(scope->vm());
- if (!scope->next()) // global frame
- return [NSArray arrayWithObject:_private->globalObject];
-
- NSMutableArray *scopes = [[NSMutableArray alloc] init];
-
- ScopeChainIterator end = scope->end();
- for (ScopeChainIterator it = scope->begin(); it != end; ++it) {
- JSObject* object = it.get();
- if (object->isActivationObject())
- object = DebuggerActivation::create(*scope->vm(), object);
- [scopes addObject:[self _convertValueToObjcValue:object]];
- }
-
- NSArray *result = [NSArray arrayWithArray:scopes];
- [scopes release];
- return result;
-}
-
// Returns the name of the function for this frame, if available.
// Returns nil for anonymous functions and for the global frame.
@@ -218,41 +164,4 @@
return exception ? [self _convertValueToObjcValue:exception] : nil;
}
-// Evaluate some _javascript_ code in the context of this frame.
-// The code is evaluated as if by "eval", and the result is returned.
-// If there is an (uncaught) exception, it is returned as though _it_ were the result.
-// Calling this method on the global frame is not quite the same as calling the WebScriptObject
-// method of the same name, due to the treatment of exceptions.
-
-- (id)evaluateWebScript:(NSString *)script
-{
- if (!_private->debuggerCallFrame)
- return nil;
-
- // If this is the global call frame and there is no dynamic global object,
- // Dashcode is attempting to execute JS in the evaluator using a stale
- // WebScriptCallFrame. Instead, we need to set the dynamic global object
- // and evaluate the JS in the global object's global call frame.
- JSGlobalObject* globalObject = _private->debugger->globalObject();
- JSLockHolder lock(globalObject->vm());
-
- if (self == _private->debugger->globalCallFrame() && !globalObject->vm().dynamicGlobalObject) {
- JSGlobalObject* globalObject = _private->debugger->globalObject();
-
- DynamicGlobalObjectScope globalObjectScope(globalObject->vm(), globalObject);
-
- JSC::JSValue exception;
- JSC::JSValue result = evaluateInGlobalCallFrame(script, exception, globalObject);
- if (exception)
- return [self _convertValueToObjcValue:exception];
- return result ? [self _convertValueToObjcValue:result] : nil;
- }
-
- JSC::JSValue exception;
- JSC::JSValue result = _private->debuggerCallFrame->evaluate(script, exception);
- if (exception)
- return [self _convertValueToObjcValue:exception];
- return result ? [self _convertValueToObjcValue:result] : nil;
-}
-
@end
Modified: trunk/Source/WebKit/mac/WebView/WebScriptDebugger.h (156244 => 156245)
--- trunk/Source/WebKit/mac/WebView/WebScriptDebugger.h 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/WebView/WebScriptDebugger.h 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -52,26 +52,21 @@
public:
WebScriptDebugger(JSC::JSGlobalObject*);
- void initGlobalCallFrame(const JSC::DebuggerCallFrame&);
+ JSC::JSGlobalObject* globalObject() const { return m_globalObject.get(); }
+private:
virtual void sourceParsed(JSC::ExecState*, JSC::SourceProvider*, int errorLine, const WTF::String& errorMsg);
- virtual void callEvent(const JSC::DebuggerCallFrame&);
- virtual void atStatement(const JSC::DebuggerCallFrame&);
- virtual void returnEvent(const JSC::DebuggerCallFrame&);
+ virtual void callEvent(const JSC::DebuggerCallFrame&) { }
+ virtual void atStatement(const JSC::DebuggerCallFrame&) { }
+ virtual void returnEvent(const JSC::DebuggerCallFrame&) { }
virtual void exception(const JSC::DebuggerCallFrame&, bool hasHandler);
- virtual void willExecuteProgram(const JSC::DebuggerCallFrame&);
- virtual void didExecuteProgram(const JSC::DebuggerCallFrame&);
- virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&);
+ virtual void willExecuteProgram(const JSC::DebuggerCallFrame&) { }
+ virtual void didExecuteProgram(const JSC::DebuggerCallFrame&) { }
+ virtual void didReachBreakpoint(const JSC::DebuggerCallFrame&) { }
- JSC::JSGlobalObject* globalObject() const { return m_globalObject.get(); }
- WebScriptCallFrame *globalCallFrame() const { return m_globalCallFrame.get(); }
-
-private:
bool m_callingDelegate;
- RetainPtr<WebScriptCallFrame> m_topCallFrame;
JSC::Strong<JSC::JSGlobalObject> m_globalObject;
- RetainPtr<WebScriptCallFrame> m_globalCallFrame;
};
#endif // WebScriptDebugger_h
Modified: trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm (156244 => 156245)
--- trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/WebView/WebScriptDebugger.mm 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,9 +46,7 @@
using namespace WebCore;
@interface WebScriptCallFrame (WebScriptDebugDelegateInternal)
-- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debugger:(WebScriptDebugger *)debugger caller:(WebScriptCallFrame *)caller debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
-- (void)_setDebuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
-- (void)_clearDebuggerCallFrame;
+- (WebScriptCallFrame *)_initWithGlobalObject:(WebScriptObject *)globalObj debuggerCallFrame:(const DebuggerCallFrame&)debuggerCallFrame;
@end
static NSString *toNSString(SourceProvider* sourceProvider)
@@ -78,26 +76,8 @@
, m_globalObject(globalObject->vm(), globalObject)
{
attach(globalObject);
- initGlobalCallFrame(DebuggerCallFrame(globalObject->globalExec(), 0, 0));
}
-void WebScriptDebugger::initGlobalCallFrame(const DebuggerCallFrame& debuggerCallFrame)
-{
- m_callingDelegate = true;
-
- WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
-
- m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
- m_globalCallFrame = m_topCallFrame;
-
- WebView *webView = [webFrame webView];
- WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
- if (implementations->didEnterCallFrameFunc)
- CallScriptDebugDelegate(implementations->didEnterCallFrameFunc, webView, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:), m_topCallFrame.get(), static_cast<NSInteger>(0), -1, webFrame);
-
- m_callingDelegate = false;
-}
-
// callbacks - relay to delegate
void WebScriptDebugger::sourceParsed(ExecState* exec, SourceProvider* sourceProvider, int errorLine, const String& errorMsg)
{
@@ -136,66 +116,6 @@
m_callingDelegate = false;
}
-void WebScriptDebugger::callEvent(const DebuggerCallFrame& debuggerCallFrame)
-{
- if (m_callingDelegate)
- return;
-
- m_callingDelegate = true;
-
- WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
-
- m_topCallFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debugger:this caller:m_topCallFrame.get() debuggerCallFrame:debuggerCallFrame]);
-
- WebView *webView = [webFrame webView];
- WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
- if (implementations->didEnterCallFrameFunc)
- CallScriptDebugDelegate(implementations->didEnterCallFrameFunc, webView, @selector(webView:didEnterCallFrame:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
-
- m_callingDelegate = false;
-}
-
-void WebScriptDebugger::atStatement(const DebuggerCallFrame& debuggerCallFrame)
-{
- if (m_callingDelegate)
- return;
-
- m_callingDelegate = true;
-
- WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
- WebView *webView = [webFrame webView];
-
- [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
-
- WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
- if (implementations->willExecuteStatementFunc)
- CallScriptDebugDelegate(implementations->willExecuteStatementFunc, webView, @selector(webView:willExecuteStatement:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
-
- m_callingDelegate = false;
-}
-
-void WebScriptDebugger::returnEvent(const DebuggerCallFrame& debuggerCallFrame)
-{
- if (m_callingDelegate)
- return;
-
- m_callingDelegate = true;
-
- WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
- WebView *webView = [webFrame webView];
-
- [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
-
- WebScriptDebugDelegateImplementationCache* implementations = WebViewGetScriptDebugDelegateImplementations(webView);
- if (implementations->willLeaveCallFrameFunc)
- CallScriptDebugDelegate(implementations->willLeaveCallFrameFunc, webView, @selector(webView:willLeaveCallFrame:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
-
- [m_topCallFrame.get() _clearDebuggerCallFrame];
- m_topCallFrame = [m_topCallFrame.get() caller];
-
- m_callingDelegate = false;
-}
-
void WebScriptDebugger::exception(const DebuggerCallFrame& debuggerCallFrame, bool hasHandler)
{
if (m_callingDelegate)
@@ -205,30 +125,15 @@
WebFrame *webFrame = toWebFrame(debuggerCallFrame.dynamicGlobalObject());
WebView *webView = [webFrame webView];
- [m_topCallFrame.get() _setDebuggerCallFrame:debuggerCallFrame];
+ RetainPtr<WebScriptCallFrame> callFrame = adoptNS([[WebScriptCallFrame alloc] _initWithGlobalObject:core(webFrame)->script().windowScriptObject() debuggerCallFrame:debuggerCallFrame]);
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, debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
+ CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:hasHandler:sourceId:line:forWebFrame:), callFrame.get(), hasHandler, debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
else
- CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), m_topCallFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
+ CallScriptDebugDelegate(cache->exceptionWasRaisedFunc, webView, @selector(webView:exceptionWasRaised:sourceId:line:forWebFrame:), callFrame.get(), debuggerCallFrame.sourceId(), debuggerCallFrame.line(), webFrame);
}
m_callingDelegate = false;
}
-
-void WebScriptDebugger::willExecuteProgram(const DebuggerCallFrame& debuggerCallFrame)
-{
- callEvent(debuggerCallFrame);
-}
-
-void WebScriptDebugger::didExecuteProgram(const DebuggerCallFrame& debuggerCallFrame)
-{
- returnEvent(debuggerCallFrame);
-}
-
-void WebScriptDebugger::didReachBreakpoint(const DebuggerCallFrame&)
-{
- return;
-}
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (156244 => 156245)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2013-09-22 07:15:15 UTC (rev 156244)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2013-09-22 07:34:49 UTC (rev 156245)
@@ -1708,9 +1708,6 @@
}
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:hasHandler:sourceId:line:forWebFrame:));
if (cache->exceptionWasRaisedFunc)