diff options
author | Ulf Hermann <[email protected]> | 2017-12-11 12:44:47 +0100 |
---|---|---|
committer | Michael Brasser <[email protected]> | 2017-12-21 16:02:50 +0000 |
commit | 52bc4fbfbae6aa1569dc134dd103e966f04bc2e6 (patch) | |
tree | 91c5f84c6623f14338b95b5acbb40c66cb7d1aaf /src/qml/jsruntime/qv4function_p.h | |
parent | cbdbbe79ec141e66f3160a1332e49518f9682517 (diff) |
Use potentially intercepted URL as ID for compilation units
We generally have to pass a URL and a file name everywhere because the
logical URL might be something else than the actual file being loaded.
For example a QQmlFileSelector might modify the URL to be loaded for a
specific file. This resulting URL, however, should not be used to
resolve further URLs defined in the file loaded that way.
As we need to access QQmlTypeLoader::m_url as string more often now,
cache it and avoid frequent translations between QUrl and QString.
Furthermore, QQmlDataBlob's URLs are changed to follow the same
semantics. The finalUrl is the one that should be used to resolve
further URLs, the url is the one used to load the content, and subject
to any redirects or interceptions.
This changes the semantics of URL redirects. Previously a redirected URL
was used as the base URL for furher URL resolution. This doesn't work
because redirection occurs after interception and interception should
not influence the resolution of further URLs. We now use the original
URL as base URL for resolution of further URLs and rely on the server to
redirect those, too.
Task-number: QTBUG-61209
Change-Id: I93822f820bed2515995de3cb118099218b510ca4
Reviewed-by: Michael Brasser <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4function_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4function_p.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h index 54d0528c42..b212b3d027 100644 --- a/src/qml/jsruntime/qv4function_p.h +++ b/src/qml/jsruntime/qv4function_p.h @@ -84,6 +84,7 @@ struct Q_QML_EXPORT Function { return compilationUnit->runtimeStrings[compiledFunction->nameIndex]; } inline QString sourceFile() const { return compilationUnit->fileName(); } + inline QUrl finalUrl() const { return compilationUnit->finalUrl(); } inline bool usesArgumentsObject() const { return compiledFunction->flags & CompiledData::Function::UsesArgumentsObject; } inline bool isStrict() const { return compiledFunction->flags & CompiledData::Function::IsStrict; } |