diff options
author | Kevin Krammer <kevin.krammer@kdab.com> | 2015-10-12 16:24:59 +0200 |
---|---|---|
committer | Kevin Krammer <kevin.krammer@kdab.com> | 2016-01-23 13:09:48 +0000 |
commit | d6c5c3b529ca49452ecd74a7e139f189c7fb0efc (patch) | |
tree | d7e234123dd0fa441fb6c714917662820c715de0 /src | |
parent | 3cc589c98390992e3ee8a7970dc2913ea857d623 (diff) |
Pass Qt.include() URLs through the URL interceptor if present
JavaScript files loaded by the Qt.include() function did not get
passed through the QQmlEngine's URL interceptor, while those loaded
by import statements did.
Now both include variants have the resolved URL passed through
the interceptor, e.g. an installed QQmlFileSelector
Task-number: QTBUG-50483
Change-Id: Ife75e6b644687f3fb04048a311e570cdcbab8c6d
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4include.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4include.cpp b/src/qml/jsruntime/qv4include.cpp index 90c6738c46..93badb3ed8 100644 --- a/src/qml/jsruntime/qv4include.cpp +++ b/src/qml/jsruntime/qv4include.cpp @@ -183,6 +183,8 @@ QV4::ReturnedValue QV4Include::method_include(QV4::CallContext *ctx) V4THROW_ERROR("Qt.include(): Can only be called from JavaScript files"); QUrl url(scope.engine->resolvedUrl(ctx->args()[0].toQStringNoThrow())); + if (scope.engine->qmlEngine() && scope.engine->qmlEngine()->urlInterceptor()) + url = scope.engine->qmlEngine()->urlInterceptor()->intercept(url, QQmlAbstractUrlInterceptor::JavaScriptFile); QV4::ScopedValue callbackFunction(scope, QV4::Primitive::undefinedValue()); if (ctx->argc() >= 2 && ctx->args()[1].as<QV4::FunctionObject>()) |