From d6c5c3b529ca49452ecd74a7e139f189c7fb0efc Mon Sep 17 00:00:00 2001 From: Kevin Krammer Date: Mon, 12 Oct 2015 16:24:59 +0200 Subject: 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 --- src/qml/jsruntime/qv4include.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') 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()) -- cgit v1.2.3