From 4f08859e812681b67cc197e997102fa81d21ded4 Mon Sep 17 00:00:00 2001 From: Alan Alpert <416365416c@gmail.com> Date: Tue, 3 Dec 2013 08:41:04 -0800 Subject: Revert "Revert ffaf39e9a7f11d4e2800b3b37160a2a952795614" This reverts commit 27052dcad9810869a9065da4c06e9f14379411d7. While the additional flexibility would be nice, I've been reminded that we already did commit to it back in July. Change-Id: Iaf990dda98ee46eb028b4737bdeeafd050d9513f Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> --- src/qml/qml/qml.pri | 2 +- src/qml/qml/qqmlabstracturlinterceptor.cpp | 3 -- src/qml/qml/qqmlabstracturlinterceptor.h | 67 ++++++++++++++++++++++++++++++ src/qml/qml/qqmlabstracturlinterceptor_p.h | 67 ------------------------------ src/qml/qml/qqmlcompiler.cpp | 2 +- src/qml/qml/qqmlcontext.cpp | 2 +- src/qml/qml/qqmlengine.cpp | 2 +- src/qml/qml/qqmlfileselector.cpp | 2 +- src/qml/qml/qqmlfileselector_p.h | 2 +- src/qml/qml/qqmltypeloader.cpp | 2 +- src/qml/qml/qqmltypeloader_p.h | 2 +- 11 files changed, 75 insertions(+), 78 deletions(-) create mode 100644 src/qml/qml/qqmlabstracturlinterceptor.h delete mode 100644 src/qml/qml/qqmlabstracturlinterceptor_p.h (limited to 'src/qml') diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index f969f5c644..3bba6f8e83 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -126,7 +126,7 @@ HEADERS += \ $$PWD/qqmlplatform_p.h \ $$PWD/qqmlbinding_p.h \ $$PWD/qqmlextensionplugin_p.h \ - $$PWD/qqmlabstracturlinterceptor_p.h \ + $$PWD/qqmlabstracturlinterceptor.h \ $$PWD/qqmlapplicationengine_p.h \ $$PWD/qqmlapplicationengine.h \ $$PWD/qqmllistwrapper_p.h \ diff --git a/src/qml/qml/qqmlabstracturlinterceptor.cpp b/src/qml/qml/qqmlabstracturlinterceptor.cpp index 321698ad8e..127dad86ce 100644 --- a/src/qml/qml/qqmlabstracturlinterceptor.cpp +++ b/src/qml/qml/qqmlabstracturlinterceptor.cpp @@ -44,9 +44,6 @@ \inmodule QtQml \brief allows you to control QML file loading. - \note This class is not currently public API, due to the risk of being affected - by planned engine changes in upcoming releases. - QQmlAbstractUrlInterceptor is an interface which can be used to alter URLs before they are used by the QML engine. This is primarily useful for altering file urls into other file urls, such as selecting different graphical assets diff --git a/src/qml/qml/qqmlabstracturlinterceptor.h b/src/qml/qml/qqmlabstracturlinterceptor.h new file mode 100644 index 0000000000..4bcaa89b4a --- /dev/null +++ b/src/qml/qml/qqmlabstracturlinterceptor.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtQml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQMLABSTRACTURLINTERCEPTOR_H +#define QQMLABSTRACTURLINTERCEPTOR_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class Q_QML_EXPORT QQmlAbstractUrlInterceptor +{ + Q_FLAGS(InterceptionPoint) +public: + enum DataType { //Matches QQmlDataBlob::Type + QmlFile = 0, + JavaScriptFile = 1, + QmldirFile = 2, + UrlString = 0x1000 + }; + + QQmlAbstractUrlInterceptor() {} + virtual ~QQmlAbstractUrlInterceptor() {} + virtual QUrl intercept(const QUrl &path, DataType type) = 0; +}; + +QT_END_NAMESPACE +#endif diff --git a/src/qml/qml/qqmlabstracturlinterceptor_p.h b/src/qml/qml/qqmlabstracturlinterceptor_p.h deleted file mode 100644 index 471c837eed..0000000000 --- a/src/qml/qml/qqmlabstracturlinterceptor_p.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Research In Motion. -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtQml module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLABSTRACTURLINTERCEPTOR_H -#define QQMLABSTRACTURLINTERCEPTOR_H - -#include -#include - -QT_BEGIN_NAMESPACE - -class Q_QML_PRIVATE_EXPORT QQmlAbstractUrlInterceptor -{ - Q_FLAGS(InterceptionPoint) -public: - enum DataType { //Matches QQmlDataBlob::Type - QmlFile = 0, - JavaScriptFile = 1, - QmldirFile = 2, - UrlString = 0x1000 - }; - - QQmlAbstractUrlInterceptor() {} - virtual ~QQmlAbstractUrlInterceptor() {} - virtual QUrl intercept(const QUrl &path, DataType type) = 0; -}; - -QT_END_NAMESPACE -#endif diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 93ec2516c8..187274890b 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -61,7 +61,7 @@ #include "qqmlscriptstring.h" #include "qqmlglobal_p.h" #include "qqmlbinding_p.h" -#include "qqmlabstracturlinterceptor_p.h" +#include "qqmlabstracturlinterceptor.h" #include "qqmlcodegenerator_p.h" #include diff --git a/src/qml/qml/qqmlcontext.cpp b/src/qml/qml/qqmlcontext.cpp index 7731935b75..78e6650d02 100644 --- a/src/qml/qml/qqmlcontext.cpp +++ b/src/qml/qml/qqmlcontext.cpp @@ -48,7 +48,7 @@ #include "qqmlengine_p.h" #include "qqmlengine.h" #include "qqmlinfo.h" -#include "qqmlabstracturlinterceptor_p.h" +#include "qqmlabstracturlinterceptor.h" #include #include diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index d082b9a8fd..1320f51d25 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -66,7 +66,7 @@ #include #include #include "qqmlincubator.h" -#include "qqmlabstracturlinterceptor_p.h" +#include "qqmlabstracturlinterceptor.h" #include #include diff --git a/src/qml/qml/qqmlfileselector.cpp b/src/qml/qml/qqmlfileselector.cpp index 7f2007ec00..6ddc2eb2ff 100644 --- a/src/qml/qml/qqmlfileselector.cpp +++ b/src/qml/qml/qqmlfileselector.cpp @@ -40,10 +40,10 @@ ****************************************************************************/ #include +#include #include #include "qqmlfileselector.h" #include "qqmlfileselector_p.h" -#include "qqmlabstracturlinterceptor_p.h" #include QT_BEGIN_NAMESPACE diff --git a/src/qml/qml/qqmlfileselector_p.h b/src/qml/qml/qqmlfileselector_p.h index fe3679e08d..501f563ade 100644 --- a/src/qml/qml/qqmlfileselector_p.h +++ b/src/qml/qml/qqmlfileselector_p.h @@ -54,8 +54,8 @@ // #include "qqmlfileselector.h" -#include "qqmlabstracturlinterceptor_p.h" #include +#include #include #include diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp index 895a2a9cd6..85d2fe41d9 100644 --- a/src/qml/qml/qqmltypeloader.cpp +++ b/src/qml/qml/qqmltypeloader.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qqmltypeloader_p.h" -#include "qqmlabstracturlinterceptor_p.h" +#include "qqmlabstracturlinterceptor.h" #include "qqmlcontextwrapper_p.h" #include "qqmlexpression_p.h" diff --git a/src/qml/qml/qqmltypeloader_p.h b/src/qml/qml/qqmltypeloader_p.h index c9a5edc39e..b93cf2942d 100644 --- a/src/qml/qml/qqmltypeloader_p.h +++ b/src/qml/qml/qqmltypeloader_p.h @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -67,7 +68,6 @@ #include #include #include -#include #include #include -- cgit v1.2.3 From 20d2e3faf8b08fb70fdbca586db1d3839af4146a Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 3 Dec 2013 21:47:02 +0100 Subject: QQmlImport: Don't try use a dangling pointer. toUtf8 would return a temporary, and constData would hold a pointer inside that temporary. This isn't even remotely safe. Move the pointer use down to the initializeEngine call so it is kept around long enough for us to do our stuff. This is a backport of cf51cdb8fb002ae3602a4c886e7c67913d77373a. Task-number: QTBUG-35355 Task-number: QTBUG-35343 Change-Id: I338ad7f4d4137445ed9a311a293ea82bf023aafd Reviewed-by: Robin Burchell Reviewed-by: Lars Knoll --- src/qml/qml/qqmlimport.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/qml') diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index 30b5abb383..8645d2116a 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1966,8 +1966,7 @@ bool QQmlImportDatabase::importPlugin(const QString &filePath, const QString &ur if (QQmlExtensionInterface *eiface = qobject_cast(instance)) { QQmlEnginePrivate *ep = QQmlEnginePrivate::get(engine); - const char *moduleId = uri.toUtf8().constData(); - ep->typeLoader.initializeEngine(eiface, moduleId); + ep->typeLoader.initializeEngine(eiface, uri.toUtf8().constData()); } } } -- cgit v1.2.3 From 725118563976bd5abd1c368b90579dbf44462323 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 4 Dec 2013 16:03:59 +0100 Subject: Fix a crash in JSON.parse Properly set members that are actually array indices and don't crash when trying to set those. Task-number: QTBUG-35383 Change-Id: I04d4b65c27e97a2e9db19541ed46ee1bb202f780 Reviewed-by: Simon Hausmann Reviewed-by: Milian Wolff --- src/qml/jsruntime/qv4jsonobject.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/qml') diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp index 458b46b36e..5aac8c8197 100644 --- a/src/qml/jsruntime/qv4jsonobject.cpp +++ b/src/qml/jsruntime/qv4jsonobject.cpp @@ -284,8 +284,13 @@ bool JsonParser::parseMember(ObjectRef o) return false; ScopedString s(scope, context->engine->newIdentifier(key)); - Property *p = o->insertMember(s, Attr_Data); - p->value = val.asReturnedValue(); + uint idx = s->asArrayIndex(); + if (idx < UINT_MAX) { + o->putIndexed(idx, val); + } else { + Property *p = o->insertMember(s, Attr_Data); + p->value = val.asReturnedValue(); + } END; return true; -- cgit v1.2.3