Fixed <rdar://problem/
3682340> (error console does not include source urls or line numbers of event exceptions).
* khtml/ecma/kjs_events.cpp:
(JSLazyEventListener::JSLazyEventListener):
(JSLazyEventListener::parseCode):
* khtml/ecma/kjs_events.h:
* khtml/ecma/kjs_proxy.cpp:
(KJSProxyImpl::createHTMLEventHandler):
* khtml/ecma/kjs_window.cpp:
(Window::getJSLazyEventListener):
* khtml/ecma/kjs_window.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7106
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2004-07-22 Kevin Decker <kdecker@apple.com>
+
+ Reviewed by Darin
+
+ Fixed <rdar://problem/3682340> (error console does not include source urls or line numbers of event exceptions).
+
+ * khtml/ecma/kjs_events.cpp:
+ (JSLazyEventListener::JSLazyEventListener):
+ (JSLazyEventListener::parseCode):
+ * khtml/ecma/kjs_events.h:
+ * khtml/ecma/kjs_proxy.cpp:
+ (KJSProxyImpl::createHTMLEventHandler):
+ * khtml/ecma/kjs_window.cpp:
+ (Window::getJSLazyEventListener):
+ * khtml/ecma/kjs_window.h:
+
2004-07-22 Ken Kocienda <kocienda@apple.com>
Reviewed by Hyatt
return listener;
}
-JSLazyEventListener::JSLazyEventListener(QString _code, const Object &_win, bool _html)
+JSLazyEventListener::JSLazyEventListener(QString _code, const Object &_win, bool _html, int lineno)
: JSEventListener(Object(), _win, _html),
code(_code),
parsed(false)
{
+ lineNumber = lineno;
}
void JSLazyEventListener::handleEvent(DOM::Event &evt, bool isWindowEvent)
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;
static ProtectedValue eventString = KJS::String("event");
-
+ UString sourceURL(part->m_url.url());
args.append(eventString);
args.append(KJS::String(code));
- listener = constr.construct(exec, args); // ### is globalExec ok ?
+ listener = constr.construct(exec, args, sourceURL, lineNumber); // ### is globalExec ok ?
KJS::Interpreter::unlock();
class JSLazyEventListener : public JSEventListener {
public:
- JSLazyEventListener(QString _code, const Object &_win, bool _html = false);
+ JSLazyEventListener(QString _code, const Object &_win, bool _html = false, int lineno = 0);
virtual void handleEvent(DOM::Event &evt, bool isWindowEvent);
Object listenerObj() const;
+
private:
void parseCode() const;
mutable QString code;
mutable bool parsed;
+ int lineNumber;
};
#endif
initScript();
-
- return KJS::Window::retrieveWindow(m_part)->getJSLazyEventListener(code,true);
+ return KJS::Window::retrieveWindow(m_part)->getJSLazyEventListener(code,true,m_handlerLineno);
}
void KJSProxyImpl::finishedWithEvent(const DOM::Event &event)
return new JSEventListener(Object(listenerObject), Object(this), html);
}
-JSLazyEventListener *Window::getJSLazyEventListener(const QString& code, bool html)
+JSLazyEventListener *Window::getJSLazyEventListener(const QString& code, bool html, int lineNumber)
{
- return new JSLazyEventListener(code, Object(this), html);
+ return new JSLazyEventListener(code, Object(this), html, lineNumber);
}
void Window::clear( ExecState *exec )
Location *location() const;
Selection *selection() const;
JSEventListener *getJSEventListener(const Value &val, bool html = false);
- JSLazyEventListener *getJSLazyEventListener(const QString &code, bool html = false);
+ JSLazyEventListener *getJSLazyEventListener(const QString &code, bool html = false, int lineno = 0);
void clear( ExecState *exec );
virtual UString toString(ExecState *exec) const;