Fix tst_qqmlecmascript::scriptErrors()
authorSimon Hausmann <simon.hausmann@digia.com>
Fri, 7 Jun 2013 14:20:54 +0000 (16:20 +0200)
committerLars Knoll <lars.knoll@digia.com>
Fri, 7 Jun 2013 16:33:44 +0000 (18:33 +0200)
* 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 <lars.knoll@digia.com>
src/qml/qml/qqmlcontextwrapper.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp

index 592472e..5507c8b 100644 (file)
@@ -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);
index f1142ac..bb38b85 100644 (file)
@@ -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\"";