diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-05 15:34:17 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-17 22:11:24 +0200 |
| commit | 450ae20835f1f767f9e414b3445b4b6518af3235 (patch) | |
| tree | 3e7348ccb4a45fe9d2e2e9fe53cd0e2b45d6541c /src/qml/jsruntime/qv4script.cpp | |
| parent | 51e50ec86fb001658d0d03356472addc558657a7 (diff) | |
QtQml: Use QQmlScriptBlob in Qt.include
Invent a new URL fragment "include" for this. We need to make sure the
included JS code inherits the context.
We want to get rid of the local file loading in qv4engine.cpp since it
undermines network transparency. Qt.include therefore has to use the
type loader. For remote files it so far used a hand-rolled network
loading machinery which duplicated the type loader code. By using the
type loader right away, this becomes unnecessary.
Change-Id: Iae5c1ad764b98b101c1d90dbb78e46d3950541aa
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index b54cdf6542..bf8582a7b0 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -147,7 +147,7 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile( QV4::Compiler::Module *module, QQmlJS::Engine *jsEngine, Compiler::JSUnitGenerator *unitGenerator, const QString &fileName, const QString &source, QList<QQmlError> *reportedErrors, - QV4::Compiler::ContextType contextType) + QV4::Compiler::ContextType contextType, InheritContext inheritContext) { using namespace QV4::Compiler; using namespace QQmlJS::AST; @@ -174,6 +174,8 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile( } Codegen cg(unitGenerator, /*strict mode*/false); + if (inheritContext == InheritContext::Yes) + cg.setUseFastLookups(false); cg.generateFromProgram(source, program, module, contextType); if (cg.hasError()) { if (reportedErrors) { |
