Reviewed by Darin
authorkdecker <kdecker@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jul 2004 23:43:29 +0000 (23:43 +0000)
committerkdecker <kdecker@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jul 2004 23:43:29 +0000 (23:43 +0000)
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

WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/kjs_events.cpp
WebCore/khtml/ecma/kjs_events.h
WebCore/khtml/ecma/kjs_proxy.cpp
WebCore/khtml/ecma/kjs_window.cpp
WebCore/khtml/ecma/kjs_window.h

index 737a00e5fdaddcfc66d8ef4190601462bd00ce5d..58220ececccad2645a1b9c60cf9d67857799799d 100644 (file)
@@ -1,3 +1,19 @@
+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
index 2334c974a717b41c9a14ea84582d857efb7fcc7a..80d85f7799b2b9e5e68b14dc905d58b5d3952d9c 100644 (file)
@@ -154,11 +154,12 @@ Object JSEventListener::listenerObj() const
   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)
@@ -188,18 +189,16 @@ void JSLazyEventListener::parseCode() const
       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();
       
index 256b8de419919284118ac6c0fae8a23dc0700a93..bfd7e4f690bee25882c3dae4cc67cbc39acfb926 100644 (file)
@@ -50,14 +50,16 @@ namespace KJS {
 
   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;
   };
 
 
index 919e3731b9f9f4f2a74d8a004fdbcf578699f976..f6a41864f4d38853ecfc87d699e21b0c14df29c2 100644 (file)
@@ -172,8 +172,7 @@ DOM::EventListener *KJSProxyImpl::createHTMLEventHandler(QString sourceUrl, QStr
 #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)
index bc3587a0c5eea8de51c5a0d6c6f922d3faf211e3..a0b5ccd4c39b80198ebef8bb840e8b91c0154636 100644 (file)
@@ -1100,9 +1100,9 @@ JSEventListener *Window::getJSEventListener(const Value& val, bool html)
   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 )
index f25c29b1ff84b38c8eb9dce94aa31a009e8096d2..10c7bdd6063711098cfffe4ada8e44de401171cc 100644 (file)
@@ -103,7 +103,7 @@ namespace KJS {
     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;