diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-15 09:06:43 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-15 09:31:31 (GMT) |
commit | c411f16870f112c3407c28c22b617f613a82cff4 (patch) | |
tree | 29a1bcd590c8b31af2aab445bfe8a978dc5bf582 /src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp | |
parent | 3d77b56b32a0c53ec0bbfaa07236fedb900ff336 (diff) | |
download | Qt-c411f16870f112c3407c28c22b617f613a82cff4.zip Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.gz Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.bz2 |
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-15062009 ( 65232bf00dc494ebfd978f998c88f58d18ecce1e )
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp | 51 |
1 files changed, 14 insertions, 37 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp index 42ddf04..e63594c 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/ExceptionHelpers.cpp @@ -31,6 +31,7 @@ #include "CodeBlock.h" #include "CallFrame.h" +#include "JSGlobalObjectFunctions.h" #include "JSObject.h" #include "JSNotAnObject.h" #include "Interpreter.h" @@ -38,16 +39,6 @@ namespace JSC { -static void substitute(UString& string, const UString& substring) -{ - int position = string.find("%s"); - ASSERT(position != -1); - UString newString = string.substr(0, position); - newString.append(substring); - newString.append(string.substr(position + 2)); - string = newString; -} - class InterruptedExecutionError : public JSObject { public: InterruptedExecutionError(JSGlobalData* globalData) @@ -56,38 +47,26 @@ public: } virtual bool isWatchdogException() const { return true; } + + virtual UString toString(ExecState*) const { return "JavaScript execution exceeded timeout."; } }; -JSValuePtr createInterruptedExecutionException(JSGlobalData* globalData) +JSValue createInterruptedExecutionException(JSGlobalData* globalData) { return new (globalData) InterruptedExecutionError(globalData); } -JSValuePtr createError(ExecState* exec, ErrorType e, const char* msg) +static JSValue createError(ExecState* exec, ErrorType e, const char* msg) { return Error::create(exec, e, msg, -1, -1, 0); } -JSValuePtr createError(ExecState* exec, ErrorType e, const char* msg, const Identifier& label) -{ - UString message = msg; - substitute(message, label.ustring()); - return Error::create(exec, e, message, -1, -1, 0); -} - -JSValuePtr createError(ExecState* exec, ErrorType e, const char* msg, JSValuePtr v) -{ - UString message = msg; - substitute(message, v->toString(exec)); - return Error::create(exec, e, message, -1, -1, 0); -} - -JSValuePtr createStackOverflowError(ExecState* exec) +JSValue createStackOverflowError(ExecState* exec) { return createError(exec, RangeError, "Maximum call stack size exceeded."); } -JSValuePtr createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock) +JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock) { int startOffset = 0; int endOffset = 0; @@ -102,12 +81,10 @@ JSValuePtr createUndefinedVariableError(ExecState* exec, const Identifier& ident return exception; } -bool isStrWhiteSpace(UChar c); - -static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, int expressionStart, int expressionStop, JSValuePtr value, UString error) +static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, int expressionStart, int expressionStop, JSValue value, UString error) { if (!expressionStop || expressionStart > codeBlock->source()->length()) { - UString errorText = value->toString(exec); + UString errorText = value.toString(exec); errorText.append(" is "); errorText.append(error); return errorText; @@ -119,7 +96,7 @@ static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, in errorText.append('\''); errorText.append(codeBlock->source()->getRange(expressionStart, expressionStop)); errorText.append("' ["); - errorText.append(value->toString(exec)); + errorText.append(value.toString(exec)); errorText.append("] is "); } else { // No range information, so give a few characters of context @@ -140,7 +117,7 @@ static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, in errorText.append("near '..."); errorText.append(codeBlock->source()->getRange(start, stop)); errorText.append("...' ["); - errorText.append(value->toString(exec)); + errorText.append(value.toString(exec)); errorText.append("] is "); } errorText.append(error); @@ -148,7 +125,7 @@ static UString createErrorMessage(ExecState* exec, CodeBlock* codeBlock, int, in return errorText; } -JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValuePtr value, unsigned bytecodeOffset, CodeBlock* codeBlock) +JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value, unsigned bytecodeOffset, CodeBlock* codeBlock) { UString message = "not a valid argument for '"; message.append(op); @@ -166,7 +143,7 @@ JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValuePtr va return exception; } -JSObject* createNotAConstructorError(ExecState* exec, JSValuePtr value, unsigned bytecodeOffset, CodeBlock* codeBlock) +JSObject* createNotAConstructorError(ExecState* exec, JSValue value, unsigned bytecodeOffset, CodeBlock* codeBlock) { int startOffset = 0; int endOffset = 0; @@ -187,7 +164,7 @@ JSObject* createNotAConstructorError(ExecState* exec, JSValuePtr value, unsigned return exception; } -JSValuePtr createNotAFunctionError(ExecState* exec, JSValuePtr value, unsigned bytecodeOffset, CodeBlock* codeBlock) +JSValue createNotAFunctionError(ExecState* exec, JSValue value, unsigned bytecodeOffset, CodeBlock* codeBlock) { int startOffset = 0; int endOffset = 0; |