diff options
author | Richard Weickelt <richard@weickelt.de> | 2021-02-13 15:48:51 +0100 |
---|---|---|
committer | Richard Weickelt <richard@weickelt.de> | 2021-02-13 18:59:43 +0000 |
commit | b458387cf2add62955e09a290be13e56c2c82e70 (patch) | |
tree | e68162e939c070aa9cd61d4a3cde360535349b8c | |
parent | 4bcbfa14cccf82d71b74b37c86ad952d6f331be5 (diff) |
Do not rely on leaked context variables
The current QtScript implementation seems to leak variables of the
prepare script context to invoked JS functions. This will become an
error in the JS port.
Amends d3fa7fe.
Change-Id: I5618efe7e1e8a19656f6a2e6a086267405dd69ec
Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com>
-rw-r--r-- | share/qbs/module-providers/Qt/templates/quick.js | 6 | ||||
-rw-r--r-- | share/qbs/module-providers/Qt/templates/quick.qbs | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/share/qbs/module-providers/Qt/templates/quick.js b/share/qbs/module-providers/Qt/templates/quick.js index 4f3da2fb0..76f2e9e53 100644 --- a/share/qbs/module-providers/Qt/templates/quick.js +++ b/share/qbs/module-providers/Qt/templates/quick.js @@ -31,7 +31,7 @@ var FileInfo = require("qbs.FileInfo"); var Process = require("qbs.Process"); -function scanQrc(qrcFilePath) { +function scanQrc(product, qrcFilePath) { var absInputDir = FileInfo.path(qrcFilePath); var result = []; var process = new Process(); @@ -65,8 +65,8 @@ function qtQuickResourceFileOutputName(fileName) { return fileName.replace(/\.qrc$/, "_qtquickcompiler.qrc"); } -function contentFromQrc(qrcFilePath) { - var filesInQrc = scanQrc(qrcFilePath); +function contentFromQrc(product, qrcFilePath) { + var filesInQrc = scanQrc(product, qrcFilePath); var qmlJsFiles = filesInQrc.filter(function (filePath) { return (/\.(js|qml)$/).test(filePath); } ); diff --git a/share/qbs/module-providers/Qt/templates/quick.qbs b/share/qbs/module-providers/Qt/templates/quick.qbs index bf04fe869..ac3ab5b26 100644 --- a/share/qbs/module-providers/Qt/templates/quick.qbs +++ b/share/qbs/module-providers/Qt/templates/quick.qbs @@ -79,7 +79,7 @@ QtModule { condition: useCompiler inputs: 'qt.quick.qrc' searchPaths: [FileInfo.path(input.filePath)] - scan: QC.scanQrc(input.filePath) + scan: QC.scanQrc(product, input.filePath) } FileTagger { @@ -100,7 +100,7 @@ QtModule { var cmd = new JavaScriptCommand(); cmd.silent = true; cmd.sourceCode = function() { - var content = QC.contentFromQrc(input.filePath); + var content = QC.contentFromQrc(product, input.filePath); content.qrcFilePath = input.filePath; var tf = new TextFile(output.filePath, TextFile.WriteOnly); |