diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-04-17 01:01:42 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-04-17 07:58:19 +0200 |
commit | 761d23806633cb32613f2ddf11711b3a71650eb1 (patch) | |
tree | 900fd3ff412cbb74c9213f7369deafc64aabb5c5 | |
parent | 8bc3329e2cec4638fa9af274a40dda176bbb7352 (diff) | |
parent | 259c958e21c63f227a1bb678867210e0f6af0991 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
Change-Id: I9d31c982881a617099354bf8acceb76332f11496
19 files changed, 109 insertions, 34 deletions
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp index e6d079fe36..c0ce125741 100644 --- a/src/qml/compiler/qv4compileddata.cpp +++ b/src/qml/compiler/qv4compileddata.cpp @@ -900,6 +900,8 @@ bool ResolvedTypeReference::addToHash(QCryptographicHash *hash, QQmlEngine *engi hash->addData(createPropertyCache(engine)->checksum(&ok)); return ok; } + if (!compilationUnit) + return false; hash->addData(compilationUnit->unitData()->md5Checksum, sizeof(compilationUnit->unitData()->md5Checksum)); return true; } diff --git a/src/qml/compiler/qv4compilercontext_p.h b/src/qml/compiler/qv4compilercontext_p.h index cb20ea9d57..57ef4be36e 100644 --- a/src/qml/compiler/qv4compilercontext_p.h +++ b/src/qml/compiler/qv4compilercontext_p.h @@ -217,7 +217,6 @@ struct Context { bool usesThis = false; bool innerFunctionAccessesThis = false; bool innerFunctionAccessesNewTarget = false; - bool hasTry = false; bool returnsClosure = false; mutable bool argumentsCanEscape = false; bool requiresExecutionContext = false; diff --git a/src/qml/compiler/qv4compilerscanfunctions.cpp b/src/qml/compiler/qv4compilerscanfunctions.cpp index 04593f202a..8984b6931e 100644 --- a/src/qml/compiler/qv4compilerscanfunctions.cpp +++ b/src/qml/compiler/qv4compilerscanfunctions.cpp @@ -741,9 +741,9 @@ void ScanFunctions::calcEscapingVariables() if (c->contextType != ContextType::ESModule) continue; for (const auto &entry: c->exportEntries) { - auto m = c->members.find(entry.localName); - if (m != c->members.end()) - m->canEscape = true; + auto mIt = c->members.constFind(entry.localName); + if (mIt != c->members.constEnd()) + mIt->canEscape = true; } break; } @@ -759,8 +759,8 @@ void ScanFunctions::calcEscapingVariables() } Q_ASSERT(c != inner); while (c) { - Context::MemberMap::const_iterator it = c->members.find(var); - if (it != c->members.end()) { + Context::MemberMap::const_iterator it = c->members.constFind(var); + if (it != c->members.constEnd()) { if (c->parent || it->isLexicallyScoped()) { it->canEscape = true; c->requiresExecutionContext = true; @@ -816,15 +816,17 @@ void ScanFunctions::calcEscapingVariables() // add an escaping 'this' variable c->addLocalVar(QStringLiteral("this"), Context::VariableDefinition, VariableScope::Let); c->requiresExecutionContext = true; - auto m = c->members.find(QStringLiteral("this")); - m->canEscape = true; + auto mIt = c->members.constFind(QStringLiteral("this")); + Q_ASSERT(mIt != c->members.constEnd()); + mIt->canEscape = true; } if (c->innerFunctionAccessesNewTarget) { // add an escaping 'new.target' variable c->addLocalVar(QStringLiteral("new.target"), Context::VariableDefinition, VariableScope::Let); c->requiresExecutionContext = true; - auto m = c->members.find(QStringLiteral("new.target")); - m->canEscape = true; + auto mIt = c->members.constFind(QStringLiteral("new.target")); + Q_ASSERT(mIt != c->members.constEnd()); + mIt->canEscape = true; } if (c->allVarsEscape && c->contextType == ContextType::Block && c->members.isEmpty()) c->allVarsEscape = false; @@ -845,8 +847,9 @@ void ScanFunctions::calcEscapingVariables() } if (c->contextType == ContextType::Block && c->isCatchBlock) { c->requiresExecutionContext = true; - auto m = c->members.find(c->caughtVariable); - m->canEscape = true; + auto mIt = c->members.constFind(c->caughtVariable); + Q_ASSERT(mIt != c->members.constEnd()); + mIt->canEscape = true; } const QLatin1String exprForOn("expression for on"); if (c->contextType == ContextType::Binding && c->name.length() > exprForOn.size() && @@ -855,7 +858,7 @@ void ScanFunctions::calcEscapingVariables() // we don't know if the code is a signal handler or not. c->requiresExecutionContext = true; if (c->allVarsEscape) { - for (auto &m : c->members) + for (const auto &m : qAsConst(c->members)) m.canEscape = true; } } diff --git a/src/qml/jsruntime/qv4global_p.h b/src/qml/jsruntime/qv4global_p.h index 44adac26cd..d47393b3bb 100644 --- a/src/qml/jsruntime/qv4global_p.h +++ b/src/qml/jsruntime/qv4global_p.h @@ -94,7 +94,8 @@ inline double trunc(double d) { return d > 0 ? floor(d) : ceil(d); } #elif defined(Q_PROCESSOR_X86_64) && (QT_POINTER_SIZE == 8) \ && (defined(Q_OS_WIN) || defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_MAC) || defined(Q_OS_FREEBSD)) # define V4_ENABLE_JIT -#elif defined(Q_PROCESSOR_ARM_32) && (QT_POINTER_SIZE == 4) +#elif defined(Q_PROCESSOR_ARM_32) && (QT_POINTER_SIZE == 4) \ + && (defined(Q_OS_LINUX) || defined(Q_OS_QNX) || defined(Q_OS_FREEBSD) || defined(Q_OS_INTEGRITY)) # if defined(thumb2) || defined(__thumb2__) || ((defined(__thumb) || defined(__thumb__)) && __TARGET_ARCH_THUMB-0 == 4) # define V4_ENABLE_JIT # elif defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB == 2 // clang 3.5 and later will set this if the core supports the Thumb-2 ISA. diff --git a/src/qml/jsruntime/qv4identifiertable.cpp b/src/qml/jsruntime/qv4identifiertable.cpp index e476baa886..4305bc4647 100644 --- a/src/qml/jsruntime/qv4identifiertable.cpp +++ b/src/qml/jsruntime/qv4identifiertable.cpp @@ -70,7 +70,7 @@ IdentifierTable::~IdentifierTable() { free(entriesByHash); free(entriesById); - for (auto &h : idHashes) + for (const auto &h : qAsConst(idHashes)) h->identifierTable = nullptr; } diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp index dee6a67792..6afa6d36d6 100644 --- a/src/qml/jsruntime/qv4stringobject.cpp +++ b/src/qml/jsruntime/qv4stringobject.cpp @@ -765,9 +765,8 @@ static void appendReplacementString(QString *result, const QString &input, const i += skip; if (substStart != JSC::Yarr::offsetNoMatch && substEnd != JSC::Yarr::offsetNoMatch) *result += input.midRef(substStart, substEnd - substStart); - else { + else if (skip == 0) // invalid capture reference. Taken as literal value *result += replaceValue.at(i); - } } else { *result += replaceValue.at(i); } diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index a79d4d074c..5a1364473e 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -867,7 +867,7 @@ bool QQmlImportInstance::resolveType(QQmlTypeLoader *typeLoader, const QHashedSt *typeRecursionDetected = true; } else { QQmlType returnType = fetchOrCreateTypeForUrl( - qmlUrl, type, registrationType == QQmlType::CompositeSingletonType, nullptr); + qmlUrl, type, registrationType == QQmlType::CompositeSingletonType, errors); if (type_return) *type_return = returnType; return returnType.isValid(); diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index 79e8a11aa8..53fe0a4c4b 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -241,6 +241,7 @@ private: friend class QQuickWidget; friend class QQuickRenderControl; friend class QQuickAnimatorController; + friend class QQuickWidgetPrivate; Q_DISABLE_COPY(QQuickWindow) }; diff --git a/src/quickwidgets/qquickwidget.cpp b/src/quickwidgets/qquickwidget.cpp index a098c94670..f1a0f0c863 100644 --- a/src/quickwidgets/qquickwidget.cpp +++ b/src/quickwidgets/qquickwidget.cpp @@ -76,6 +76,18 @@ QT_BEGIN_NAMESPACE +// override setVisble to prevent accidental offscreen window being created +// by base class. +class QQuickOffcreenWindowPrivate: public QQuickWindowPrivate { +public: + void setVisible(bool visible) override { + Q_Q(QWindow); + // this stays always invisible + visibility = visible ? QWindow::Windowed : QWindow::Hidden; + q->visibilityChanged(visibility); // workaround for QTBUG-49054 + } +}; + class QQuickWidgetRenderControl : public QQuickRenderControl { public: @@ -94,7 +106,7 @@ void QQuickWidgetPrivate::init(QQmlEngine* e) Q_Q(QQuickWidget); renderControl = new QQuickWidgetRenderControl(q); - offscreenWindow = new QQuickWindow(renderControl); + offscreenWindow = new QQuickWindow(*new QQuickOffcreenWindowPrivate(),renderControl); offscreenWindow->setTitle(QString::fromLatin1("Offscreen")); // Do not call create() on offscreenWindow. @@ -1321,12 +1333,9 @@ void QQuickWidget::showEvent(QShowEvent *) triggerUpdate(); } } - QWindowPrivate *offscreenPrivate = QWindowPrivate::get(d->offscreenWindow); - if (!offscreenPrivate->visible) { - offscreenPrivate->visible = true; - emit d->offscreenWindow->visibleChanged(true); - offscreenPrivate->updateVisibility(); - } + + // note offscreenWindow is "QQuickOffScreenWindow" instance + d->offscreenWindow->setVisible(true); if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>()) service->setParentWindow(d->offscreenWindow, window()->windowHandle()); } @@ -1337,12 +1346,8 @@ void QQuickWidget::hideEvent(QHideEvent *) Q_D(QQuickWidget); if (!d->offscreenWindow->isPersistentSceneGraph()) d->invalidateRenderControl(); - QWindowPrivate *offscreenPrivate = QWindowPrivate::get(d->offscreenWindow); - if (offscreenPrivate->visible) { - offscreenPrivate->visible = false; - emit d->offscreenWindow->visibleChanged(false); - offscreenPrivate->updateVisibility(); - } + // note offscreenWindow is "QQuickOffScreenWindow" instance + d->offscreenWindow->setVisible(false); if (QQmlInspectorService *service = QQmlDebugConnector::service<QQmlInspectorService>()) service->setParentWindow(d->offscreenWindow, d->offscreenWindow); } diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 620e31e01a..75fa2216f7 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -4427,6 +4427,34 @@ void tst_QJSEngine::stringReplace() val = engine.evaluate("'x'.replace(/()()()()()()()()()(x)/, '$10')"); QVERIFY(val.isString()); QCOMPARE(val.toString(), QString("x")); + + val = engine.evaluate("'123'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("123")); + + val = engine.evaluate("'123.00'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("123")); + + val = engine.evaluate("'123.0'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("123")); + + val = engine.evaluate("'123.'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("123")); + + val = engine.evaluate("'123.50'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("123.5")); + + val = engine.evaluate("'123.05'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("123.05")); + + val = engine.evaluate("'0.050'.replace(/\\.0*$|(\\.\\d*[1-9])(0+)$/, '$1')"); + QVERIFY(val.isString()); + QCOMPARE(val.toString(), QString("0.05")); } void tst_QJSEngine::protoChanges_QTBUG68369() diff --git a/tests/auto/qml/qmlmin/tst_qmlmin.cpp b/tests/auto/qml/qmlmin/tst_qmlmin.cpp index c393149f59..d1e74aecef 100644 --- a/tests/auto/qml/qmlmin/tst_qmlmin.cpp +++ b/tests/auto/qml/qmlmin/tst_qmlmin.cpp @@ -128,6 +128,7 @@ void tst_qmlmin::initTestCase() invalidFiles << "tests/auto/qml/parserstress/tests/ecma_3/FunExpr/fe-001.js"; invalidFiles << "tests/auto/qml/qjsengine/script/com/trolltech/syntaxerror/__init__.js"; invalidFiles << "tests/auto/qml/debugger/qqmlpreview/data/broken.qml"; + invalidFiles << "tests/auto/qml/qqmllanguage/data/fuzzed.2.qml"; } QStringList tst_qmlmin::findFiles(const QDir &d) diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt b/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt new file mode 100644 index 0000000000..e399799fe9 --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/fuzzed.1.errors.txt @@ -0,0 +1,2 @@ +2:8:Cannot assign to non-existent property "_G" + diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.1.qml b/tests/auto/qml/qqmllanguage/data/fuzzed.1.qml new file mode 100644 index 0000000000..f80b9c3a2d --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/fuzzed.1.qml @@ -0,0 +1,2 @@ +import QtQuick 2.4 +Item { _G.G.G:G } diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt b/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt new file mode 100644 index 0000000000..92ce4c649f --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/fuzzed.2.errors.txt @@ -0,0 +1,2 @@ +5:1:TetZ$ is not a type +-1:-1:Invalid QML type name "TetZ$" diff --git a/tests/auto/qml/qqmllanguage/data/fuzzed.2.qml b/tests/auto/qml/qqmllanguage/data/fuzzed.2.qml Binary files differnew file mode 100644 index 0000000000..e726f6783c --- /dev/null +++ b/tests/auto/qml/qqmllanguage/data/fuzzed.2.qml diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 89c1d05905..fe2256319b 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -361,7 +361,7 @@ private: } \ file.close(); \ } else { \ - QCOMPARE(expected, actual); \ + QCOMPARE(actual, expected); \ } \ } @@ -615,6 +615,9 @@ void tst_qqmllanguage::errors_data() QTest::newRow("assignComponentToWrongType") << "assignComponentToWrongType.qml" << "assignComponentToWrongType.errors.txt" << false; QTest::newRow("cyclicAlias") << "cyclicAlias.qml" << "cyclicAlias.errors.txt" << false; + + QTest::newRow("fuzzed.1") << "fuzzed.1.qml" << "fuzzed.1.errors.txt" << false; + QTest::newRow("fuzzed.2") << "fuzzed.2.qml" << "fuzzed.2.errors.txt" << false; } @@ -625,6 +628,7 @@ void tst_qqmllanguage::errors() QFETCH(bool, create); QQmlComponent component(&engine, testFileUrl(file)); + QTRY_VERIFY(!component.isLoading()); QScopedPointer<QObject> object; diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp index 4916cb4cc0..fd50ff5020 100644 --- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp +++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp @@ -34,6 +34,8 @@ #include <QtQml/qqml.h> #include <QtQml/qqmlapplicationengine.h> +#include <private/qv4global_p.h> + #ifdef Q_OS_WIN #include <windows.h> #endif @@ -46,6 +48,7 @@ private slots: void initTestCase() override; void perfMapFile(); void functionTable(); + void jitEnabled(); }; void tst_QV4Assembler::initTestCase() @@ -137,6 +140,26 @@ void tst_QV4Assembler::functionTable() #endif } +#ifdef V4_ENABLE_JIT +#define JIT_ENABLED 1 +#else +#define JIT_ENABLED 0 +#endif + +void tst_QV4Assembler::jitEnabled() +{ +#if defined(Q_OS_IOS) || defined(Q_OS_TVOS) + /* JIT should be disabled on iOS and tvOS. */ + QCOMPARE(JIT_ENABLED, 0); +#elif defined(Q_OS_WIN) && defined(Q_PROCESSOR_ARM) + /* JIT should be disabled Windows on ARM/ARM64 for now. */ + QCOMPARE(JIT_ENABLED, 0); +#else + /* JIT should be enabled on all other architectures/OSes tested in CI. */ + QCOMPARE(JIT_ENABLED, 1); +#endif +} + QTEST_MAIN(tst_QV4Assembler) #include "tst_qv4assembler.moc" diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST index ecdf8f558e..893f95dcea 100644 --- a/tests/auto/quick/qquicklistview/BLACKLIST +++ b/tests/auto/quick/qquicklistview/BLACKLIST @@ -6,3 +6,6 @@ opensuse-leap [populateTransitions] opensuse-42.1 #QTBUG-65964 + +[contentHeightWithDelayRemove] +osx-10.12 diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp index aaf37b32cd..fd5c3653ad 100644 --- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp +++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp @@ -161,7 +161,7 @@ void tst_qquickwidget::showHide() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(childView->quickWindow()->isVisible()); + QVERIFY(!childView->quickWindow()->isVisible()); // this window is always not visible see QTBUG-65761 QVERIFY(childView->quickWindow()->visibility() != QWindow::Hidden); window.hide(); @@ -612,7 +612,7 @@ void tst_qquickwidget::synthMouseFromTouch() childView->resize(300, 300); window.show(); QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(childView->quickWindow()->isVisible()); + QVERIFY(!childView->quickWindow()->isVisible()); // this window is always not visible see QTBUG-65761 QVERIFY(item->isVisible()); QPoint p1 = QPoint(20, 20); |