diff options
| author | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-13 13:49:05 +0200 |
|---|---|---|
| committer | Ulf Hermann <ulf.hermann@qt.io> | 2025-06-17 22:11:24 +0200 |
| commit | 82bf7d20089bc4b9438e349fa45c1c640b973025 (patch) | |
| tree | 68a0cdb06d7dbae150bbf90dc4ababdbba8b3604 /src/qml/jsruntime/qv4script.cpp | |
| parent | 450ae20835f1f767f9e414b3445b4b6518af3235 (diff) | |
QV4::Script: Remove createFromFileOrCache()
It isn't used anymore and it was bad since it unconditionally loaded
from a local file, subverting the network transparency.
Change-Id: I3c8d045b03a5250eb390731b9d8a8df6f74586a0
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
| -rw-r--r-- | src/qml/jsruntime/qv4script.cpp | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp index bf8582a7b0..d045e097a2 100644 --- a/src/qml/jsruntime/qv4script.cpp +++ b/src/qml/jsruntime/qv4script.cpp @@ -193,55 +193,4 @@ QQmlRefPointer<QV4::CompiledData::CompilationUnit> Script::precompile( return cg.generateCompilationUnit(/*generate unit data*/false); } -Script *Script::createFromFileOrCache( - ExecutionEngine *engine, QmlContext *qmlContext, const QString &fileName, - const QUrl &originalUrl, QString *error) -{ - if (error) - error->clear(); - - QQmlMetaType::CachedUnitLookupError cacheError = QQmlMetaType::CachedUnitLookupError::NoError; - const ExecutionEngine::DiskCacheOptions options = engine->diskCacheOptions(); - if (const QQmlPrivate::CachedQmlUnit *cachedUnit - = (options & ExecutionEngine::DiskCache::Aot) - ? QQmlMetaType::findCachedCompilationUnit( - originalUrl, - (options & ExecutionEngine::DiskCache::AotByteCode) - ? QQmlMetaType::AcceptUntyped - : QQmlMetaType::RequireFullyTyped, - &cacheError) - : nullptr) { - QQmlRefPointer<QV4::ExecutableCompilationUnit> jsUnit - = engine->insertCompilationUnit( - QQml::makeRefPointer<QV4::CompiledData::CompilationUnit>( - cachedUnit->qmlData, cachedUnit->aotCompiledFunctions)); - return new QV4::Script(engine, qmlContext, jsUnit); - } - - QFile f(fileName); - if (!f.open(QIODevice::ReadOnly)) { - if (error) { - if (cacheError == QQmlMetaType::CachedUnitLookupError::VersionMismatch) { - *error = originalUrl.toString() - + QString::fromUtf8(" was compiled ahead of time with an incompatible " - "version of Qt and the original source code cannot be " - "found. Please recompile"); - } else { - *error = QString::fromUtf8("Error opening source file %1: %2") - .arg(originalUrl.toString()).arg(f.errorString()); - } - } - return nullptr; - } - - QByteArray data = f.readAll(); - QString sourceCode = QString::fromUtf8(data); - - auto result = new QV4::Script( - engine, qmlContext, /*parseAsBinding*/false, sourceCode, originalUrl.toString()); - result->m_contextType = QV4::Compiler::ContextType::ScriptImportedByQML; - result->parse(); - return result; -} - QT_END_NAMESPACE |
