Reviewed by Maciej.
Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
JavaScriptCore portion of the fix.
* JavaScriptCore.exp: Update symbol for change in argument type.
* kjs/debugger.cpp:
(Debugger::detach): Clear map of recent exceptions.
(Debugger::hasHandledException): Track the most recent exception
thrown by an interpreter.
(Debugger::exception): Change exception argument to a JSValue.
* kjs/debugger.h:
* kjs/nodes.cpp:
(Node::debugExceptionIfNeeded): Notify the debugger of an exception
if it hasn't seen it before.
(ThrowNode::execute): Notify the debugger that an exception is being thrown.
* kjs/nodes.h:
2006-07-23 Geoffrey Garen <ggaren@apple.com>
Patch by Eric Albert, reviewed by Darin and me.
- Fixed <rdar://problem/
4645931> JavaScriptCore stack-scanning code
crashes (Collector::markStackObjectsConservatively)
* bindings/jni/jni_jsobject.cpp: On 64bit systems, jint is a long, not an
int.
(JavaJSObject::getSlot):
(JavaJSObject::setSlot):
* kjs/collector.cpp:
(KJS::Collector::markCurrentThreadConservatively): Use a pointer instead of
an int as 'dummy,' because on LP64 systems, an int is not pointer-aligned,
and we want to scan the stack for pointers.
* JavaScriptCore.xcodeproj/project.pbxproj: After a tense cease-fire, the
XCode war has started up again!
WebCore:
Reviewed by maciej.
Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
WebCore portion of the fix.
* bridge/mac/WebCoreScriptDebugger.h:
(-[WebScriptDebugger exceptionRaised:sourceId:line::]): Add delegate method.
* bridge/mac/WebCoreScriptDebugger.mm:
(WebCoreScriptDebuggerImp::exception): Call delegate method when an exception is raised.
WebKit:
Reviewed by Maciej.
Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
WebKit portion of the fix.
* DefaultDelegates/WebDefaultScriptDebugDelegate.m:
(-[WebDefaultScriptDebugDelegate webView:exceptionWasRaised:sourceId:line:forWebFrame:]):
* DefaultDelegates/WebScriptDebugServer.h:
* DefaultDelegates/WebScriptDebugServer.m:
(-[WebScriptDebugServer webView:exceptionWasRaised:sourceId:line:forWebFrame:]): Notify
listeners that an exception has been raised.
* WebView/WebScriptDebugDelegate.h:
* WebView/WebScriptDebugDelegate.m:
(-[WebScriptCallFrame exceptionRaised:sourceId:line:]): Dispatch through to delegate and
WebScriptDebugServer.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15593
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-07-23 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Maciej.
+
+ Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
+
+ JavaScriptCore portion of the fix.
+
+ * JavaScriptCore.exp: Update symbol for change in argument type.
+ * kjs/debugger.cpp:
+ (Debugger::detach): Clear map of recent exceptions.
+ (Debugger::hasHandledException): Track the most recent exception
+ thrown by an interpreter.
+ (Debugger::exception): Change exception argument to a JSValue.
+ * kjs/debugger.h:
+ * kjs/nodes.cpp:
+ (Node::debugExceptionIfNeeded): Notify the debugger of an exception
+ if it hasn't seen it before.
+ (ThrowNode::execute): Notify the debugger that an exception is being thrown.
+ * kjs/nodes.h:
+
2006-07-23 Geoffrey Garen <ggaren@apple.com>
Patch by Eric Albert, reviewed by Darin and me.
__ZN3KJS8Bindings8Instance32createBindingForLanguageInstanceENS1_15BindingLanguageEPvPKNS0_10RootObjectE
__ZN3KJS8Debugger12sourceUnusedEPNS_9ExecStateEi
__ZN3KJS8Debugger6attachEPNS_11InterpreterE
-__ZN3KJS8Debugger9exceptionEPNS_9ExecStateEiiPNS_8JSObjectE
+__ZN3KJS8Debugger9exceptionEPNS_9ExecStateEiiPNS_7JSValueE
__ZN3KJS8DebuggerC2Ev
__ZN3KJS8DebuggerD2Ev
__ZN3KJS8JSObject11hasInstanceEPNS_9ExecStateEPNS_7JSValueE
} else
p = &q->next;
}
+
+ if (interp)
+ latestExceptions.remove(interp);
+ else
+ latestExceptions.clear();
+}
+
+bool Debugger::hasHandledException(ExecState *exec, JSValue *exception)
+{
+ if (latestExceptions.get(exec->dynamicInterpreter()).get() == exception)
+ return true;
+
+ latestExceptions.set(exec->dynamicInterpreter(), exception);
+ return false;
}
bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/, const UString &/*sourceURL*/,
}
bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
- JSObject */*exceptionObj*/)
+ JSValue */*exception*/)
{
return true;
}
#ifndef _KJSDEBUGGER_H_
#define _KJSDEBUGGER_H_
+#include <wtf/HashMap.h>
+#include "protect.h"
+
namespace KJS {
class DebuggerImp;
class Interpreter;
class ExecState;
class JSObject;
+ class JSValue;
class UString;
class List;
* be aborted
*/
virtual bool exception(ExecState *exec, int sourceId, int lineno,
- JSObject *exceptionObj);
+ JSValue *exception);
+
+ bool hasHandledException(ExecState *, JSValue *);
/**
* Called when a line of the script is reached (before it is executed)
private:
DebuggerImp *rep;
+ HashMap<Interpreter*, ProtectedPtr<JSValue> > latestExceptions;
public:
static int debuggersPresent;
setExceptionDetailsIfNeeded(exec); \
JSValue *ex = exec->exception(); \
exec->clearException(); \
+ debugExceptionIfNeeded(exec, ex); \
return Completion(Throw, ex); \
} \
if (Collector::isOutOfMemory()) \
#define KJS_CHECKEXCEPTIONVALUE \
if (exec->hadException()) { \
setExceptionDetailsIfNeeded(exec); \
+ debugExceptionIfNeeded(exec, exec->exception()); \
return jsUndefined(); \
} \
if (Collector::isOutOfMemory()) \
#define KJS_CHECKEXCEPTIONLIST \
if (exec->hadException()) { \
setExceptionDetailsIfNeeded(exec); \
+ debugExceptionIfNeeded(exec, exec->exception()); \
return List(); \
} \
if (Collector::isOutOfMemory()) \
}
}
+void Node::debugExceptionIfNeeded(ExecState* exec, JSValue* exceptionValue)
+{
+ Debugger* dbg = exec->dynamicInterpreter()->debugger();
+ if (dbg && !dbg->hasHandledException(exec, exceptionValue)) {
+ bool cont = dbg->exception(exec, currentSourceId(exec), m_line, exceptionValue);
+ if (!cont)
+ dbg->imp()->abort();
+ }
+}
+
Node *Node::nodeInsideAllParens()
{
return this;
JSValue *v = expr->evaluate(exec);
KJS_CHECKEXCEPTION
+ debugExceptionIfNeeded(exec, v);
+
return Completion(Throw, v);
}
JSValue *throwUndefinedVariableError(ExecState *, const Identifier &);
void setExceptionDetailsIfNeeded(ExecState*);
+ void debugExceptionIfNeeded(ExecState*, JSValue*);
int m_line;
private:
+2006-07-23 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by maciej.
+
+ Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
+
+ WebCore portion of the fix.
+
+ * bridge/mac/WebCoreScriptDebugger.h:
+ (-[WebScriptDebugger exceptionRaised:sourceId:line::]): Add delegate method.
+ * bridge/mac/WebCoreScriptDebugger.mm:
+ (WebCoreScriptDebuggerImp::exception): Call delegate method when an exception is raised.
+
2006-07-23 Alice Liu <alice.liu@apple.com>
Reviewed by Adele.
- (void)enteredFrame:(WebCoreScriptCallFrame *)frame sourceId:(int)sid line:(int)lineno;
- (void)hitStatement:(WebCoreScriptCallFrame *)frame sourceId:(int)sid line:(int)lineno;
- (void)leavingFrame:(WebCoreScriptCallFrame *)frame sourceId:(int)sid line:(int)lineno;
+- (void)exceptionRaised:(WebCoreScriptCallFrame *)frame sourceId:(int)sid line:(int)lineno;
@end
}
return true;
}
+ virtual bool exception(ExecState *state, int sid, int lineno, JSValue *exception) {
+ if (!_nested) {
+ _nested = true;
+ [[_objc delegate] exceptionRaised:_current sourceId:sid line:lineno];
+ _nested = false;
+ }
+ return true;
+ }
+
};
+2006-07-23 Mark Rowe <opendarwin.org@bdash.net.nz>
+
+ Reviewed by Maciej.
+
+ Bug 9686: [Drosera] Need the ability to break into Drosera on Javascript exceptions
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=9686
+
+ WebKit portion of the fix.
+
+ * DefaultDelegates/WebDefaultScriptDebugDelegate.m:
+ (-[WebDefaultScriptDebugDelegate webView:exceptionWasRaised:sourceId:line:forWebFrame:]):
+ * DefaultDelegates/WebScriptDebugServer.h:
+ * DefaultDelegates/WebScriptDebugServer.m:
+ (-[WebScriptDebugServer webView:exceptionWasRaised:sourceId:line:forWebFrame:]): Notify
+ listeners that an exception has been raised.
+ * WebView/WebScriptDebugDelegate.h:
+ * WebView/WebScriptDebugDelegate.m:
+ (-[WebScriptCallFrame exceptionRaised:sourceId:line:]): Dispatch through to delegate and
+ WebScriptDebugServer.
+
2006-07-23 Adele Peterson <adele@apple.com>
Reviewed by Darin.
http://bugzilla.opendarwin.org/show_bug.cgi?id=9624
REGRESSION: After ctrl-clicking in a EMPTY input or textarea field, the contextual menu shows "Search in Google" and "Search in Spotlight" as active menu items
-
+
* DefaultDelegates/WebDefaultContextMenuDelegate.m:
(-[WebDefaultUIDelegate editingContextMenuItemsForElement:defaultMenuItems:]):
Don't create Dictionary, Spotlight or Google lookup items if there's no selection.
-
+
2006-07-12 Mark Rowe <opendarwin.org@bdash.net.nz>
Reviewed by Timothy.
{
}
+- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
+ sourceId:(int)sid
+ line:(int)lineno
+ forWebFrame:(WebFrame *)webFrame
+{
+}
+
@end
sourceId:(int)sid
line:(int)lineno
forWebFrame:(WebFrame *)webFrame;
+
+- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
+ sourceId:(int)sid
+ line:(int)lineno
+ forWebFrame:(WebFrame *)webFrame;
@end
@protocol WebScriptDebugServer <NSObject>
[self suspendProcessIfPaused];
}
+- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
+ sourceId:(int)sid
+ line:(int)lineno
+ forWebFrame:(WebFrame *)webFrame
+{
+ if (![listeners count])
+ return;
+
+ NSEnumerator *enumerator = [listeners objectEnumerator];
+ NSDistantObject <WebScriptDebugListener> *listener = nil;
+
+ while ((listener = [enumerator nextObject])) {
+ if ([[listener connectionForProxy] isValid])
+ [listener webView:webView exceptionWasRaised:frame sourceId:sid line:lineno forWebFrame:webFrame];
+ }
+
+ // check for messages from the listeners, so they can pause immediately
+ [[NSRunLoop currentRunLoop] runMode:NSConnectionReplyMode beforeDate:[NSDate distantPast]];
+
+ [self suspendProcessIfPaused];
+}
+
@end
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
- shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);
line:(int)lineno
forWebFrame:(WebFrame *)webFrame;
+// exception is being thrown
+- (void)webView:(WebView *)webView exceptionWasRaised:(WebScriptCallFrame *)frame
+ sourceId:(int)sid
+ line:(int)lineno
+ forWebFrame:(WebFrame *)webFrame;
@end
[[WebScriptDebugServer sharedScriptDebugServer] webView:webView willLeaveCallFrame:[frame wrapper] sourceId:sid line:lineno forWebFrame:_webFrame];
}
+- (void)exceptionRaised:(WebCoreScriptCallFrame *)frame sourceId:(int)sid line:(int)lineno
+{
+ WebView *webView = [_webFrame webView];
+ [[webView _scriptDebugDelegateForwarder] webView:webView exceptionWasRaised:[frame wrapper] sourceId:sid line:lineno forWebFrame:_webFrame];
+ if ([WebScriptDebugServer listenerCount])
+ [[WebScriptDebugServer sharedScriptDebugServer] webView:webView exceptionWasRaised:[frame wrapper] sourceId:sid line:lineno forWebFrame:_webFrame];
+}
+
@end