From 1dedc7caa0f474e2c0fa35bfae8d2262ed32f24d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 7 Jun 2013 16:20:54 +0200 Subject: [PATCH] Fix tst_qqmlecmascript::scriptErrors() * In the context wrapper, throw a real JS exception that when serialized to a string includes the "Error:" prefix (due to the error object's name) * Added column information to one of the expected error messages Change-Id: I4c1bc749f01425efb0a27121f7f1b8cf4946d644 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlcontextwrapper.cpp | 2 +- tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qml/qml/qqmlcontextwrapper.cpp b/src/qml/qml/qqmlcontextwrapper.cpp index 592472e..5507c8b 100644 --- a/src/qml/qml/qqmlcontextwrapper.cpp +++ b/src/qml/qml/qqmlcontextwrapper.cpp @@ -310,7 +310,7 @@ void QmlContextWrapper::put(Managed *m, ExecutionContext *ctx, String *name, con if (wrapper->readOnly) { QString error = QLatin1String("Invalid write to global property \"") + name->toQString() + QLatin1Char('"'); - ctx->throwError(Value::fromString(ctx->engine->newString(error))); + ctx->throwError(error); } Object::put(m, ctx, name, value); diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index f1142ac..bb38b85 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1750,7 +1750,7 @@ void tst_qqmlecmascript::scriptErrors() QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\""; QString warning4 = url + ":13: ReferenceError: a is not defined"; QString warning5 = url + ":11: ReferenceError: a is not defined"; - QString warning6 = url + ":10: Unable to assign [undefined] to int"; + QString warning6 = url + ":10:21: Unable to assign [undefined] to int"; QString warning7 = url + ":15: Error: Cannot assign to read-only property \"trueProperty\""; QString warning8 = url + ":16: Error: Cannot assign to non-existent property \"fakeProperty\""; -- 2.7.4