diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-25 22:42:58 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-28 13:33:43 +0200 |
commit | 18d4794e3f614eec8594f6636d569af8bc112618 (patch) | |
tree | c4f552dab56fea3f76b0b9542585a775c41db108 /src/qml/jsruntime/qv4globalobject.cpp | |
parent | 150731fc68bcf823bec40729285813d902990cb7 (diff) |
Fix Value usage in ErrorObjects
Change-Id: Iaa14ad5a8d3f085843e49195f8f4bb7bb020b9b6
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4globalobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4globalobject.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4globalobject.cpp b/src/qml/jsruntime/qv4globalobject.cpp index 014d97a146..4cb351eeb0 100644 --- a/src/qml/jsruntime/qv4globalobject.cpp +++ b/src/qml/jsruntime/qv4globalobject.cpp @@ -599,8 +599,11 @@ ReturnedValue GlobalFunctions::method_decodeURI(SimpleCallContext *context) QString uriString = context->callData->args[0].toString(context)->toQString(); bool ok; QString out = decode(uriString, DecodeNonReserved, &ok); - if (!ok) - context->throwURIError(Value::fromString(context, QStringLiteral("malformed URI sequence"))); + if (!ok) { + Scope scope(context); + ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence"))); + context->throwURIError(s); + } return Value::fromString(context, out).asReturnedValue(); } @@ -614,8 +617,11 @@ ReturnedValue GlobalFunctions::method_decodeURIComponent(SimpleCallContext *cont QString uriString = context->callData->args[0].toString(context)->toQString(); bool ok; QString out = decode(uriString, DecodeAll, &ok); - if (!ok) - context->throwURIError(Value::fromString(context, QStringLiteral("malformed URI sequence"))); + if (!ok) { + Scope scope(context); + ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence"))); + context->throwURIError(s); + } return Value::fromString(context, out).asReturnedValue(); } @@ -629,8 +635,11 @@ ReturnedValue GlobalFunctions::method_encodeURI(SimpleCallContext *context) QString uriString = context->callData->args[0].toString(context)->toQString(); bool ok; QString out = encode(uriString, uriUnescapedReserved, &ok); - if (!ok) - context->throwURIError(Value::fromString(context, QStringLiteral("malformed URI sequence"))); + if (!ok) { + Scope scope(context); + ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence"))); + context->throwURIError(s); + } return Value::fromString(context, out).asReturnedValue(); } @@ -644,8 +653,11 @@ ReturnedValue GlobalFunctions::method_encodeURIComponent(SimpleCallContext *cont QString uriString = context->callData->args[0].toString(context)->toQString(); bool ok; QString out = encode(uriString, uriUnescaped, &ok); - if (!ok) - context->throwURIError(Value::fromString(context, QStringLiteral("malformed URI sequence"))); + if (!ok) { + Scope scope(context); + ScopedString s(scope, context->engine->newString(QStringLiteral("malformed URI sequence"))); + context->throwURIError(s); + } return Value::fromString(context, out).asReturnedValue(); } |