diff options
author | Tim Jenssen <tim.jenssen@digia.com> | 2013-05-17 15:53:44 +0200 |
---|---|---|
committer | Tim Jenssen <tim.jenssen@digia.com> | 2013-05-21 12:18:23 +0200 |
commit | 583d986a2b65447aea518d02e67bd3b6c80c2b59 (patch) | |
tree | f6f576204038fc15c758408cf9d2ebcbc7cff39a /src/libs/installer | |
parent | db47e1e10b2a09de7656b668bd482781e50f8c38 (diff) |
avoid wrong replacings in the load script code
Change-Id: Ia0d437fe1200ffa692e7b9a204622619934e92a5
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
Diffstat (limited to 'src/libs/installer')
-rw-r--r-- | src/libs/installer/scriptengine.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libs/installer/scriptengine.cpp b/src/libs/installer/scriptengine.cpp index f7bb114f5..6178f467f 100644 --- a/src/libs/installer/scriptengine.cpp +++ b/src/libs/installer/scriptengine.cpp @@ -258,14 +258,14 @@ QScriptValue ScriptEngine::loadInConext(const QString &context, const QString &f // create inside closure in one line to keep linenumber in the right order // which is used as a debug output in an exception case + // scriptContent will be added as the last arg command to prevent wrong + // replacements of %1, %2 or %3 inside the scriptContent QString scriptContent = QString::fromLatin1( - "(function() { %1 %2 ; return new %3; })();"); + "(function() { %1 %3 ; return new %2; })();"); - scriptContent = scriptContent.arg(scriptInjection); - - // add file content to it - scriptContent = scriptContent.arg(QLatin1String(file.readAll())); - scriptContent = scriptContent.arg(context); + // merging everything together and as last we are adding the file content to prevent wrong + // replacements of %1 %2 or %3 inside the javascript code + scriptContent = scriptContent.arg(scriptInjection, context, QLatin1String(file.readAll())); QScriptValue scriptContext = evaluate(scriptContent, fileName); if (hasUncaughtException()) { |