Now correctly identifies when scripts are not urls as well as javascript: urls.
Showing the changes to libraries/script-engine/src/ScriptCache.cpp (1 of 1 file). Show all
Unified · Split
| @@ -110,11 +110,18 @@ void ScriptCache::getScriptContents(const QString& scriptOrURL, contentAvailable · 109 unmodified lines | ||
| 110 | 110 | QUrl url = ResourceManager::normalizeURL(unnormalizedURL); |
| 111 | 111 | |
| 112 | 112 | // attempt to determine if this is a URL to a script, or if this is actually a script itself (which is valid in the entityScript use case) |
| 113 | − if (url.scheme().isEmpty() && scriptOrURL.simplified().replace(" ", "").contains("(function(){")) { | |
| 113 | + if (unnormalizedURL.scheme().isEmpty() && scriptOrURL.simplified().replace(" ", "").contains("(function(){")) { | |
| 114 | 114 | contentAvailable(scriptOrURL, scriptOrURL, false, true); |
| 115 | 115 | return; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | + // give a similar treatment to javacript: urls | |
| 119 | + if (unnormalizedURL.scheme() == "javascript") { | |
| 120 | + QString contents{ scriptOrURL }; | |
| 121 | + contents.replace(QRegExp("^javascript:"), ""); | |
| 122 | + contentAvailable(scriptOrURL, contents, false, true); | |
| 123 | + } | |
| 124 | + | |
| 118 | 125 | Lock lock(_containerLock); |
| 119 | 126 | if (_scriptCache.contains(url) && !forceDownload) { |
| 120 | 127 | auto scriptContent = _scriptCache[url]; |