History

normalize how ScriptCache::getScript() works relative to ResourceManager

Brad Hefta-Gaub committed 11 years ago

Commit 8395fb61 parent f85cb2c5 files · +28 −47Browse files

Showing the changes to libraries/script-engine/src/ScriptCache.cpp (1 of 5 files). Show all

Unified · Split

libraries/script-engine/src/ScriptCache.cpp+4−2
@@ -26,7 +26,8 @@ ScriptCache::ScriptCache(QObject* parent) { · 25 unmodified lines
26 // nothing to do here...26 // nothing to do here...
27}27}
28 28
29QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& isPending, bool reload) {29QString ScriptCache::getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool reload) {
30 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);
30 QString scriptContents;31 QString scriptContents;
31 if (_scriptCache.contains(url) && !reload) {32 if (_scriptCache.contains(url) && !reload) {
32 qCDebug(scriptengine) << "Found script in cache:" << url.toString();33 qCDebug(scriptengine) << "Found script in cache:" << url.toString();
@@ -50,7 +51,8 @@ QString ScriptCache::getScript(const QUrl& url, ScriptUser* scriptUser, bool& is · 17 unmodified lines
50 return scriptContents;51 return scriptContents;
51}52}
52 53
53void ScriptCache::deleteScript(const QUrl& url) {54void ScriptCache::deleteScript(const QUrl& unnormalizedURL) {
55 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);
54 if (_scriptCache.contains(url)) {56 if (_scriptCache.contains(url)) {
55 qCDebug(scriptengine) << "Delete script from cache:" << url.toString();57 qCDebug(scriptengine) << "Delete script from cache:" << url.toString();
56 _scriptCache.remove(url);58 _scriptCache.remove(url);