[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
kdecker
kdecker at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:43:51 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit ee1d75956217d0fd2ab86d61563d35999017810a
Author: kdecker <kdecker at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jun 4 18:49:54 2004 +0000
JavaScriptCore:
Reviewed by Dave.
- ObjC bindings do not (yet) pass along sourceurl or line numbers
- we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
- changed the wording of an error message
- the lexer, parser, and interpreter have been made "sourceURL aware"
- stored the url into Error
* bindings/NP_jsobject.cpp:
(NPN_Evaluate):
* bindings/jni/jni_jsobject.cpp:
(JSObject::eval):
* bindings/objc/WebScriptObject.mm:
(-[WebScriptObject evaluateWebScript:]):
* kjs/function.cpp:
(GlobalFuncImp::call):
* kjs/function_object.cpp:
(FunctionObjectImp::construct):
* kjs/internal.cpp:
(Parser::parse):
(InterpreterImp::checkSyntax):
(InterpreterImp::evaluate):
* kjs/internal.h:
* kjs/interpreter.cpp:
(Interpreter::evaluate):
* kjs/interpreter.h:
* kjs/lexer.cpp:
(Lexer::setCode):
* kjs/lexer.h:
(KJS::Lexer::sourceURL):
* kjs/nodes.cpp:
(Node::Node):
(Node::throwError):
(FunctionCallNode::evaluate):
* kjs/nodes.h:
* kjs/object.cpp:
(KJS::Error::create):
* kjs/object.h:
WebCore:
Reviewed by Dave.
- kwq/KWQKHTMLPart.mm: addMessagetoConsole places sourceURL in the dictionary
- khtml/xml/dom_docimpl.cpp: right now, we don't have a way to get a url,
so we leave this blank
- khtml/ecma/kjs_window.cpp: still need to get the real line number and sourceURL
- khtml/ecma/kjs_proxy.cpp: now passing the sourceURL to addMessageToConsole
- khtml/ecma/kjs_events.cpp: still need to grab an accurate line number and sourceURL
* khtml/ecma/kjs_events.cpp:
(JSEventListener::handleEvent):
(JSLazyEventListener::handleEvent):
* khtml/ecma/kjs_proxy.cpp:
(KJSProxyImpl::evaluate):
* khtml/ecma/kjs_window.cpp:
(Window::isSafeScript):
(ScheduledAction::execute):
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::open):
* kwq/KWQKHTMLPart.h:
* kwq/KWQKHTMLPart.mm:
(KWQKHTMLPart::addMessageToConsole):
WebBrowser:
Reviewed by Dave.
- model is now source url aware
- refined the ui with custom NSCells that now display error messages,
line numbers, and source urls
- increased the row size to 35 pixels to accomimdate for ErrorCells
* Debug/ErrorCell.h: Added.
* Debug/ErrorCell.m: Added.
(-[ErrorCell setURL:]):
(-[ErrorCell setErrorMessasge:]):
(-[ErrorCell setLineNumber:]):
(-[ErrorCell drawInteriorWithFrame:inView:]):
* Debug/ErrorConsole.nib:
* Debug/ErrorConsoleController.m:
(-[ErrorConsoleController init]):
(-[ErrorConsoleController awakeFromNib]):
* Debug/ErrorConsoleModel.h:
* Debug/ErrorConsoleModel.m:
(-[ErrorConsoleModel tableView:willDisplayCell:forTableColumn:row:]):
(-[ErrorConsoleModel count]):
(-[ErrorConsoleModel selectedURL]):
* WebBrowser.pbproj/project.pbxproj:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6768 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index cc20527..a5c0111 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,44 @@
+2004-06-04 Kevin Decker <kdecker at apple.com>
+
+ Reviewed by Dave.
+
+ - ObjC bindings do not (yet) pass along sourceurl or line numbers
+ - we don't have a way as of yet to accomidate line numbers and urls for dynamic javascript
+ - changed the wording of an error message
+ - the lexer, parser, and interpreter have been made "sourceURL aware"
+ - stored the url into Error
+
+ * bindings/NP_jsobject.cpp:
+ (NPN_Evaluate):
+ * bindings/jni/jni_jsobject.cpp:
+ (JSObject::eval):
+ * bindings/objc/WebScriptObject.mm:
+ (-[WebScriptObject evaluateWebScript:]):
+ * kjs/function.cpp:
+ (GlobalFuncImp::call):
+ * kjs/function_object.cpp:
+ (FunctionObjectImp::construct):
+ * kjs/internal.cpp:
+ (Parser::parse):
+ (InterpreterImp::checkSyntax):
+ (InterpreterImp::evaluate):
+ * kjs/internal.h:
+ * kjs/interpreter.cpp:
+ (Interpreter::evaluate):
+ * kjs/interpreter.h:
+ * kjs/lexer.cpp:
+ (Lexer::setCode):
+ * kjs/lexer.h:
+ (KJS::Lexer::sourceURL):
+ * kjs/nodes.cpp:
+ (Node::Node):
+ (Node::throwError):
+ (FunctionCallNode::evaluate):
+ * kjs/nodes.h:
+ * kjs/object.cpp:
+ (KJS::Error::create):
+ * kjs/object.h:
+
2004-06-04 Richard Williamson <rjw at apple.com>
Fixed crash when attempting to access properties on nil
diff --git a/JavaScriptCore/bindings/NP_jsobject.cpp b/JavaScriptCore/bindings/NP_jsobject.cpp
index 0baf622..7821a49 100644
--- a/JavaScriptCore/bindings/NP_jsobject.cpp
+++ b/JavaScriptCore/bindings/NP_jsobject.cpp
@@ -119,7 +119,7 @@ void NPN_Evaluate (NPScriptObject *o, NPString *s, NPScriptResultFunctionPtr res
NPUTF16 *scriptString;
unsigned int UTF16Length;
convertNPStringToUTF16 (s, &scriptString, &UTF16Length); // requires free() of returned memory.
- KJS::Value result = obj->root->interpreter()->evaluate(UString((const UChar *)scriptString,UTF16Length)).value();
+ KJS::Value result = obj->root->interpreter()->evaluate(UString(), 0, UString((const UChar *)scriptString,UTF16Length)).value();
Interpreter::unlock();
free ((void *)scriptString);
diff --git a/JavaScriptCore/bindings/jni/jni_jsobject.cpp b/JavaScriptCore/bindings/jni/jni_jsobject.cpp
index 5565b41..138bc81 100644
--- a/JavaScriptCore/bindings/jni/jni_jsobject.cpp
+++ b/JavaScriptCore/bindings/jni/jni_jsobject.cpp
@@ -191,7 +191,7 @@ jobject JSObject::eval(jstring script) const
Object thisObj = Object(const_cast<ObjectImp*>(_imp));
Interpreter::lock();
- KJS::Value result = _root->interpreter()->evaluate(JavaString(script).ustring(),thisObj).value();
+ KJS::Value result = _root->interpreter()->evaluate(UString(), 0, JavaString(script).ustring(),thisObj).value();
Interpreter::unlock();
return convertValueToJObject (result);
}
diff --git a/JavaScriptCore/bindings/objc/WebScriptObject.mm b/JavaScriptCore/bindings/objc/WebScriptObject.mm
index 77bd951..854da8c 100644
--- a/JavaScriptCore/bindings/objc/WebScriptObject.mm
+++ b/JavaScriptCore/bindings/objc/WebScriptObject.mm
@@ -160,7 +160,7 @@ static KJS::List listFromNSArray(ExecState *exec, NSArray *array)
Object thisObj = Object(const_cast<ObjectImp*>([self _imp]));
Interpreter::lock();
Value v = convertObjcValueToValue(exec, &script, ObjcObjectType);
- KJS::Value result = _private->root->interpreter()->evaluate(v.toString(exec)).value();
+ KJS::Value result = _private->root->interpreter()->evaluate(UString(), 0, v.toString(exec)).value();
Interpreter::unlock();
if (exec->hadException()) {
diff --git a/JavaScriptCore/kjs/function.cpp b/JavaScriptCore/kjs/function.cpp
index 85d2115..fbbf6ca 100644
--- a/JavaScriptCore/kjs/function.cpp
+++ b/JavaScriptCore/kjs/function.cpp
@@ -526,7 +526,7 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
int sid;
int errLine;
UString errMsg;
- ProgramNode *progNode = Parser::parse(s.data(),s.size(),&sid,&errLine,&errMsg);
+ ProgramNode *progNode = Parser::parse(UString(), 0, s.data(),s.size(),&sid,&errLine,&errMsg);
// no program node means a syntax occurred
if (!progNode) {
diff --git a/JavaScriptCore/kjs/function_object.cpp b/JavaScriptCore/kjs/function_object.cpp
index 0847ea5..ecbbd47 100644
--- a/JavaScriptCore/kjs/function_object.cpp
+++ b/JavaScriptCore/kjs/function_object.cpp
@@ -211,7 +211,7 @@ Object FunctionObjectImp::construct(ExecState *exec, const List &args)
int sid;
int errLine;
UString errMsg;
- ProgramNode *progNode = Parser::parse(body.data(),body.size(),&sid,&errLine,&errMsg);
+ ProgramNode *progNode = Parser::parse(UString(), 0, body.data(),body.size(),&sid,&errLine,&errMsg);
// notify debugger that source has been parsed
Debugger *dbg = exec->dynamicInterpreter()->imp()->debugger();
diff --git a/JavaScriptCore/kjs/internal.cpp b/JavaScriptCore/kjs/internal.cpp
index 8cbf2f6..4ba9acd 100644
--- a/JavaScriptCore/kjs/internal.cpp
+++ b/JavaScriptCore/kjs/internal.cpp
@@ -435,15 +435,16 @@ void ContextImp::mark()
ProgramNode *Parser::progNode = 0;
int Parser::sid = 0;
-ProgramNode *Parser::parse(const UChar *code, unsigned int length, int *sourceId,
+ProgramNode *Parser::parse(const UString &sourceURL, int startingLineNumber,
+ const UChar *code, unsigned int length, int *sourceId,
int *errLine, UString *errMsg)
{
if (errLine)
*errLine = -1;
if (errMsg)
*errMsg = 0;
-
- Lexer::curr()->setCode(code, length);
+
+ Lexer::curr()->setCode(sourceURL, startingLineNumber, code, length);
progNode = 0;
sid++;
if (sourceId)
@@ -762,7 +763,7 @@ void InterpreterImp::mark()
bool InterpreterImp::checkSyntax(const UString &code)
{
// Parser::parse() returns 0 in a syntax error occurs, so we just check for that
- ProgramNode *progNode = Parser::parse(code.data(),code.size(),0,0,0);
+ ProgramNode *progNode = Parser::parse(UString(), 0, code.data(),code.size(),0,0,0);
bool ok = (progNode != 0);
if (progNode) {
// must ref and deref to clean up properly
@@ -773,7 +774,7 @@ bool InterpreterImp::checkSyntax(const UString &code)
return ok;
}
-Completion InterpreterImp::evaluate(const UString &code, const Value &thisV)
+Completion InterpreterImp::evaluate(const UString &code, const Value &thisV, const UString &sourceURL, int startingLineNumber)
{
#if APPLE_CHANGES
lockInterpreter();
@@ -788,12 +789,12 @@ Completion InterpreterImp::evaluate(const UString &code, const Value &thisV)
return Completion(Throw,Error::create(globExec,GeneralError,"Recursion too deep"));
#endif
}
-
+
// parse the source code
int sid;
int errLine;
UString errMsg;
- ProgramNode *progNode = Parser::parse(code.data(),code.size(),&sid,&errLine,&errMsg);
+ ProgramNode *progNode = Parser::parse(sourceURL, startingLineNumber, code.data(),code.size(),&sid,&errLine,&errMsg);
// notify debugger that source has been parsed
if (dbg) {
@@ -808,10 +809,10 @@ Completion InterpreterImp::evaluate(const UString &code, const Value &thisV)
return Completion(Break);
#endif
}
-
+
// no program node means a syntax error occurred
if (!progNode) {
- Object err = Error::create(globExec,SyntaxError,errMsg.ascii(),errLine);
+ Object err = Error::create(globExec,SyntaxError,errMsg.ascii(),errLine, -1, &sourceURL);
err.put(globExec,"sid",Number(sid));
#if APPLE_CHANGES
unlockInterpreter();
diff --git a/JavaScriptCore/kjs/internal.h b/JavaScriptCore/kjs/internal.h
index 26a059d..9a9d89f 100644
--- a/JavaScriptCore/kjs/internal.h
+++ b/JavaScriptCore/kjs/internal.h
@@ -204,7 +204,8 @@ namespace KJS {
*/
class Parser {
public:
- static ProgramNode *parse(const UChar *code, unsigned int length, int *sourceId = 0,
+ static ProgramNode *parse(const UString &sourceURL, int startingLineNumber,
+ const UChar *code, unsigned int length, int *sourceId = 0,
int *errLine = 0, UString *errMsg = 0);
static ProgramNode *progNode;
@@ -270,7 +271,7 @@ namespace KJS {
ExecState *globalExec() { return globExec; }
bool checkSyntax(const UString &code);
- Completion evaluate(const UString &code, const Value &thisV);
+ Completion evaluate(const UString &code, const Value &thisV, const UString &sourceURL, int startingLineNumber);
Debugger *debugger() const { return dbg; }
void setDebugger(Debugger *d);
diff --git a/JavaScriptCore/kjs/interpreter.cpp b/JavaScriptCore/kjs/interpreter.cpp
index 2c6ab14..9dbee18 100644
--- a/JavaScriptCore/kjs/interpreter.cpp
+++ b/JavaScriptCore/kjs/interpreter.cpp
@@ -115,15 +115,15 @@ bool Interpreter::checkSyntax(const UString &code)
return rep->checkSyntax(code);
}
-Completion Interpreter::evaluate(const UString &code, const Value &thisV, const UString &filename)
+Completion Interpreter::evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, const Value &thisV)
{
- Completion comp = rep->evaluate(code,thisV);
+ Completion comp = rep->evaluate(code,thisV, sourceURL, startingLineNumber);
#if APPLE_CHANGES
if (shouldPrintExceptions() && comp.complType() == Throw) {
lock();
ExecState *exec = rep->globalExec();
- char *f = strdup(filename.ascii());
+ char *f = strdup(sourceURL.ascii());
const char *message = comp.value().toObject(exec).toString(exec).ascii();
printf("%s:%s\n", f, message);
free(f);
diff --git a/JavaScriptCore/kjs/interpreter.h b/JavaScriptCore/kjs/interpreter.h
index 3dbd579..61e45e2 100644
--- a/JavaScriptCore/kjs/interpreter.h
+++ b/JavaScriptCore/kjs/interpreter.h
@@ -198,7 +198,7 @@ namespace KJS {
* execution. This should either be Null() or an Object.
* @return A completion object representing the result of the execution.
*/
- Completion evaluate(const UString &code, const Value &thisV = Value(), const UString &filename = UString());
+ Completion evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, const Value &thisV = Value());
/**
* @internal
diff --git a/JavaScriptCore/kjs/lexer.cpp b/JavaScriptCore/kjs/lexer.cpp
index 5eee467..a166155 100644
--- a/JavaScriptCore/kjs/lexer.cpp
+++ b/JavaScriptCore/kjs/lexer.cpp
@@ -101,9 +101,10 @@ void Lexer::globalClear()
}
#endif
-void Lexer::setCode(const UChar *c, unsigned int len)
+void Lexer::setCode(const UString &sourceURL, int startingLineNumber, const UChar *c, unsigned int len)
{
yylineno = 1;
+ m_sourceURL = sourceURL;
restrKeyword = false;
delimited = false;
eatNextIdentifier = false;
diff --git a/JavaScriptCore/kjs/lexer.h b/JavaScriptCore/kjs/lexer.h
index 512c234..350d5fd 100644
--- a/JavaScriptCore/kjs/lexer.h
+++ b/JavaScriptCore/kjs/lexer.h
@@ -38,10 +38,11 @@ namespace KJS {
~Lexer();
static Lexer *curr();
- void setCode(const UChar *c, unsigned int len);
+ void setCode(const UString &sourceURL, int startingLineNumber, const UChar *c, unsigned int len);
int lex();
int lineNo() const { return yylineno + 1; }
+ UString sourceURL() const { return m_sourceURL; }
bool prevTerminator() const { return terminator; }
@@ -74,6 +75,7 @@ namespace KJS {
private:
int yylineno;
+ UString m_sourceURL;
bool done;
char *buffer8;
UChar *buffer16;
diff --git a/JavaScriptCore/kjs/nodes.cpp b/JavaScriptCore/kjs/nodes.cpp
index 5e35056..8acf505 100644
--- a/JavaScriptCore/kjs/nodes.cpp
+++ b/JavaScriptCore/kjs/nodes.cpp
@@ -89,6 +89,7 @@ std::list<Node *> * Node::s_nodes = 0L;
Node::Node()
{
line = Lexer::curr()->lineNo();
+ sourceURL = Lexer::curr()->sourceURL();
refcount = 0;
#ifdef KJS_DEBUG_MEM
if (!s_nodes)
@@ -125,7 +126,7 @@ void Node::finalCheck()
Value Node::throwError(ExecState *exec, ErrorType e, const char *msg)
{
- Object err = Error::create(exec, e, msg, lineNo(), sourceId());
+ Object err = Error::create(exec, e, msg, lineNo(), sourceId(), &sourceURL);
exec->setException(err);
return err;
}
@@ -689,7 +690,7 @@ Value FunctionCallNode::evaluate(ExecState *exec)
Value v = ref.getValue(exec);
if (v.type() != ObjectType) {
- return throwError(exec, TypeError, "Value %s (result of expression %s) is not object. Cannot be called.", v, expr);
+ return throwError(exec, TypeError, "Value %s (result of expression %s) is not object.", v, expr);
}
Object func = Object(static_cast<ObjectImp*>(v.imp()));
diff --git a/JavaScriptCore/kjs/nodes.h b/JavaScriptCore/kjs/nodes.h
index 9d52751..041fba7 100644
--- a/JavaScriptCore/kjs/nodes.h
+++ b/JavaScriptCore/kjs/nodes.h
@@ -102,6 +102,7 @@ namespace KJS {
Value throwError(ExecState *exec, ErrorType e, const char *msg, Value v, Node *expr);
Value throwError(ExecState *exec, ErrorType e, const char *msg, Identifier label);
int line;
+ UString sourceURL;
unsigned int refcount;
virtual int sourceId() const { return -1; }
private:
diff --git a/JavaScriptCore/kjs/object.cpp b/JavaScriptCore/kjs/object.cpp
index 6c26619..9ec5f42 100644
--- a/JavaScriptCore/kjs/object.cpp
+++ b/JavaScriptCore/kjs/object.cpp
@@ -492,7 +492,7 @@ const char * const errorNamesArr[] = {
const char * const * const Error::errorNames = errorNamesArr;
Object Error::create(ExecState *exec, ErrorType errtype, const char *message,
- int lineno, int sourceId)
+ int lineno, int sourceId, const UString *sourceURL)
{
Object cons;
switch (errtype) {
@@ -530,6 +530,8 @@ Object Error::create(ExecState *exec, ErrorType errtype, const char *message,
if (sourceId != -1)
err.put(exec, "sourceId", Number(sourceId));
+ err.put(exec,"sourceURL", String(*sourceURL));
+
return err;
/*
diff --git a/JavaScriptCore/kjs/object.h b/JavaScriptCore/kjs/object.h
index 9d312c7..4b1efbb 100644
--- a/JavaScriptCore/kjs/object.h
+++ b/JavaScriptCore/kjs/object.h
@@ -635,7 +635,7 @@ namespace KJS {
*/
static Object create(ExecState *exec, ErrorType errtype = GeneralError,
const char *message = 0, int lineno = -1,
- int sourceId = -1);
+ int sourceId = -1, const UString *sourceURL = 0);
/**
* Array of error names corresponding to @ref ErrorType
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3ed32cf..44dd9aa 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,28 @@
+2004-06-04 Kevin Decker <kdecker at apple.com>
+
+ Reviewed by Dave.
+
+ - kwq/KWQKHTMLPart.mm: addMessagetoConsole places sourceURL in the dictionary
+ - khtml/xml/dom_docimpl.cpp: right now, we don't have a way to get a url,
+ so we leave this blank
+ - khtml/ecma/kjs_window.cpp: still need to get the real line number and sourceURL
+ - khtml/ecma/kjs_proxy.cpp: now passing the sourceURL to addMessageToConsole
+ - khtml/ecma/kjs_events.cpp: still need to grab an accurate line number and sourceURL
+
+ * khtml/ecma/kjs_events.cpp:
+ (JSEventListener::handleEvent):
+ (JSLazyEventListener::handleEvent):
+ * khtml/ecma/kjs_proxy.cpp:
+ (KJSProxyImpl::evaluate):
+ * khtml/ecma/kjs_window.cpp:
+ (Window::isSafeScript):
+ (ScheduledAction::execute):
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::open):
+ * kwq/KWQKHTMLPart.h:
+ * kwq/KWQKHTMLPart.mm:
+ (KWQKHTMLPart::addMessageToConsole):
+
2004-06-04 Ken Kocienda <kocienda at apple.com>
Reviewed by Hyatt
diff --git a/WebCore/khtml/ecma/kjs_events.cpp b/WebCore/khtml/ecma/kjs_events.cpp
index 5a18f3c..d2d744d 100644
--- a/WebCore/khtml/ecma/kjs_events.cpp
+++ b/WebCore/khtml/ecma/kjs_events.cpp
@@ -116,11 +116,12 @@ void JSEventListener::handleEvent(DOM::Event &evt, bool isWindowEvent)
KJS::Interpreter::lock();
char *message = exec->exception().toObject(exec).get(exec, messagePropertyName).toString(exec).ascii();
int lineNumber = exec->exception().toObject(exec).get(exec, "line").toInt32(exec);
+ UString sourceURL = exec->exception().toObject(exec).get(exec, "sourceURL").toString(exec);
KJS::Interpreter::unlock();
if (Interpreter::shouldPrintExceptions()) {
printf("(event handler):%s\n", message);
}
- KWQ(part)->addMessageToConsole(message, lineNumber );
+ KWQ(part)->addMessageToConsole(message, lineNumber, sourceURL.qstring());
exec->clearException();
}
#else
@@ -163,7 +164,7 @@ JSLazyEventListener::JSLazyEventListener(QString _code, const Object &_win, bool
void JSLazyEventListener::handleEvent(DOM::Event &evt, bool isWindowEvent)
{
parseCode();
- if (!listener.isNull()) {
+ if (!listener.isNull()) {
JSEventListener::handleEvent(evt, isWindowEvent);
}
}
diff --git a/WebCore/khtml/ecma/kjs_proxy.cpp b/WebCore/khtml/ecma/kjs_proxy.cpp
index 31f733e..919e373 100644
--- a/WebCore/khtml/ecma/kjs_proxy.cpp
+++ b/WebCore/khtml/ecma/kjs_proxy.cpp
@@ -115,7 +115,7 @@ QVariant KJSProxyImpl::evaluate(QString filename, int baseLine,
KJS::Value thisNode = n.isNull() ? Window::retrieve( m_part ) : getDOMNode(m_script->globalExec(),n);
UString code( str );
- Completion comp = m_script->evaluate(code, thisNode, filename);
+ Completion comp = m_script->evaluate(filename, baseLine, code, thisNode);
bool success = ( comp.complType() == Normal ) || ( comp.complType() == ReturnValue );
#ifdef KJS_DEBUGGER
// KJSDebugWin::instance()->setCode(QString::null);
@@ -129,13 +129,15 @@ QVariant KJSProxyImpl::evaluate(QString filename, int baseLine,
if ( comp.complType() == Throw )
{
KJS::Interpreter::lock();
- UString msg = comp.value().toString(m_script->globalExec());
+ UString errorMessage = comp.value().toString(m_script->globalExec());
int lineNumber = comp.value().toObject(m_script->globalExec()).get(m_script->globalExec(), "line").toInt32(m_script->globalExec());
+ UString sourceURL = comp.value().toObject(m_script->globalExec()).get(m_script->globalExec(), "sourceURL").toString(m_script->globalExec());
KJS::Interpreter::unlock();
+
#if APPLE_CHANGES
- KWQ(m_part)->addMessageToConsole(msg.qstring(), lineNumber);
+ KWQ(m_part)->addMessageToConsole(errorMessage.qstring(), lineNumber, sourceURL.qstring());
#else
- kdWarning(6070) << "Script threw exception: " << msg.qstring() << endl;
+ kdWarning(6070) << "Script threw exception: " << errorMessage.qstring() << endl;
#endif
}
return QVariant();
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 4ab0842..a92dadd 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -1050,7 +1050,7 @@ bool Window::isSafeScript(ExecState *exec) const
QString message;
message.sprintf("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n",
thisDocument->URL().latin1(), actDocument->URL().latin1());
- KWQ(m_part)->addMessageToConsole(message, 1);
+ KWQ(m_part)->addMessageToConsole(message, 1, QString()); //fixme: provide a real line number and sourceurl
}
#endif
@@ -1684,7 +1684,7 @@ void ScheduledAction::execute(Window *window)
if (Interpreter::shouldPrintExceptions()) {
printf("(timer):%s\n", message);
}
- KWQ(window->m_part)->addMessageToConsole(message, lineNumber);
+ KWQ(window->m_part)->addMessageToConsole(message, lineNumber, QString());
#endif
exec->clearException();
}
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index 497d557..a313762 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -1274,8 +1274,9 @@ void DocumentImpl::open( )
connect(m_tokenizer,SIGNAL(finishedParsing()),this,SIGNAL(finishedParsing()));
m_tokenizer->begin();
- if (m_view && m_view->part()->jScript())
- m_view->part()->jScript()->setSourceFile(m_url,"");
+ if (m_view && m_view->part()->jScript()) {
+ m_view->part()->jScript()->setSourceFile(m_url,""); //fixme
+ }
}
HTMLElementImpl* DocumentImpl::body()
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 41c3473..696d350 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -181,7 +181,7 @@ public:
void runJavaScriptAlert(const QString &message);
bool runJavaScriptConfirm(const QString &message);
bool runJavaScriptPrompt(const QString &message, const QString &defaultValue, QString &result);
- void KWQKHTMLPart::addMessageToConsole(const QString &message, const unsigned int lineNumber);
+ void KWQKHTMLPart::addMessageToConsole(const QString &message, unsigned int lineNumber, const QString &sourceID);
using KHTMLPart::xmlDocImpl;
khtml::RenderObject *renderer();
void forceLayout();
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index ecf2874..60fbc43 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -1581,10 +1581,13 @@ bool KWQKHTMLPart::runJavaScriptPrompt(const QString &prompt, const QString &def
return false;
}
-void KWQKHTMLPart::addMessageToConsole(const QString &message, const unsigned int lineNumber)
+void KWQKHTMLPart::addMessageToConsole(const QString &message, unsigned lineNumber, const QString &sourceURL)
{
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:
- message.getNSString(), @"message",[NSNumber numberWithInt: lineNumber], @"lineNumber", NULL];
+ message.getNSString(), @"message",
+ [NSNumber numberWithInt: lineNumber], @"lineNumber",
+ sourceURL.getNSString(), @"sourceURL",
+ NULL];
[_bridge addMessageToConsole:dictionary];
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list