History

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

Seth Alves committed 10 years ago

Commit 8c278561 parent b95c81d1 file · +7 −1Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+7−1
@@ -912,7 +912,13 @@ void ScriptEngine::include(const QStringList& includeFiles, QScriptValue callbac · 911 unmodified lines
912 // Do NOT use PreferLocalFile as its behavior is unpredictable (e.g., on defaultScriptsLocation())912 // Do NOT use PreferLocalFile as its behavior is unpredictable (e.g., on defaultScriptsLocation())
913 const auto strippingFlags = QUrl::RemoveFilename | QUrl::RemoveQuery | QUrl::RemoveFragment;913 const auto strippingFlags = QUrl::RemoveFilename | QUrl::RemoveQuery | QUrl::RemoveFragment;
914 for (QString file : includeFiles) {914 for (QString file : includeFiles) {
915 QUrl thisURL { resolvePath(file) };915 QUrl thisURL;
916 if (file.startsWith("/~/")) {
917 thisURL = expandScriptUrl(QUrl::fromLocalFile(file));
918 } else {
919 thisURL = resolvePath(file);
920 }
921
916 if (!_includedURLs.contains(thisURL)) {922 if (!_includedURLs.contains(thisURL)) {
917 if (!currentSandboxURL.isEmpty() && (thisURL.scheme() == "file") &&923 if (!currentSandboxURL.isEmpty() && (thisURL.scheme() == "file") &&
918 (924 (