+2003-12-09 Maciej Stachowiak <mjs@apple.com>
+
+ Reviewed by Darin.
+
+ <rdar://problem/3501030>: JavaScript sites crash when a PAC file is in place (WebCore,Safari 1.2)
+
+ * khtml/ecma/kjs_events.cpp:
+ (JSEventListener::handleEvent): Lock interpreter when needed.
+ (JSLazyEventListener::parseCode): Likewise.
+ (KJS::getDOMEvent): Likewise.
+ * khtml/ecma/kjs_proxy.cpp:
+ (KJSProxyImpl::evaluate): Likewise.
+ (KJSProxyImpl::initScript): Likewise.
+
2003-12-09 David Hyatt <hyatt@apple.com>
Fix for 3491235, really make <script src="..."/> work in HTML. My original attempt to fix this only made
if (isWindowEvent) {
thisObj = win;
} else {
+ KJS::Interpreter::lock();
thisObj = Object::dynamicCast(getDOMNode(exec,evt.currentTarget()));
+ KJS::Interpreter::unlock();
if ( !thisObj.isNull() ) {
ScopeChain scope = oldScope;
static_cast<DOMNode*>(thisObj.imp())->pushEventHandlerScope(exec, scope);
// ... and in the interpreter
interpreter->setCurrentEvent( &evt );
+ KJS::Interpreter::lock();
Value retval = listener.call(exec, thisObj, args);
+ KJS::Interpreter::unlock();
listener.setScope( oldScope );
KJS::ScriptInterpreter *interpreter = static_cast<KJS::ScriptInterpreter *>(proxy->interpreter());
ExecState *exec = interpreter->globalExec();
+
+ KJS::Interpreter::lock();
+
//KJS::Constructor constr(KJS::Global::current().get("Function").imp());
KJS::Object constr = interpreter->builtinFunction();
KJS::List args;
args.append(eventString);
args.append(KJS::String(code));
listener = constr.construct(exec, args); // ### is globalExec ok ?
+
+ KJS::Interpreter::unlock();
if ( exec->hadException() ) {
exec->clearException();
if (!ei)
return Null();
ScriptInterpreter* interp = static_cast<ScriptInterpreter *>(exec->interpreter());
+
+ KJS::Interpreter::lock();
+
DOMObject *ret = interp->getDOMObject(ei);
if (!ret) {
if (ei->isKeyboardEvent())
interp->putDOMObject(ei, ret);
}
+
+ KJS::Interpreter::unlock();
+
return Value(ret);
}
{
if ( comp.complType() == Throw )
{
+ KJS::Interpreter::lock();
UString msg = comp.value().toString(m_script->globalExec());
+ KJS::Interpreter::unlock();
kdWarning(6070) << "Script threw exception: " << msg.qstring() << endl;
}
return QVariant();
m_script->setDebuggingEnabled(m_debugEnabled);
#endif
//m_script->enableDebug();
+ KJS::Interpreter::lock();
globalObject.put(m_script->globalExec(),
"debug", Value(new TestFunctionImp()), Internal);
+ KJS::Interpreter::unlock();
#if APPLE_CHANGES
QString userAgent = KWQ(m_part)->userAgent();