allow scripts on the web to refer to interface-local javascript libraries

This commit is contained in:
Seth Alves 2016-04-28 13:40:55 -07:00
parent b95c81d0ba
commit 8c278563f5

View file

@ -912,7 +912,13 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac
// Do NOT use PreferLocalFile as its behavior is unpredictable (e.g., on defaultScriptsLocation())
const auto strippingFlags = QUrl::RemoveFilename | QUrl::RemoveQuery | QUrl::RemoveFragment;
for (QString file : includeFiles) {
QUrl thisURL { resolvePath(file) };
QUrl thisURL;
if (file.startsWith("/~/")) {
thisURL = expandScriptUrl(QUrl::fromLocalFile(file));
} else {
thisURL = resolvePath(file);
}
if (!_includedURLs.contains(thisURL)) {
if (!currentSandboxURL.isEmpty() && (thisURL.scheme() == "file") &&
(