History

Update ScriptCache to clear ATP assets when disconnected from a domain

Ryan Huffman committed 10 years ago

Commit decb94b1 parent 37e58d13 files · +18 −0Browse files

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

Unified · Split

libraries/script-engine/src/ScriptCache.cpp+13−0
@@ -36,6 +36,19 @@ void ScriptCache::clearCache() { · 35 unmodified lines
36 _scriptCache.clear();36 _scriptCache.clear();
37}37}
38 38
39void ScriptCache::clearATPScriptsFromCache() {
40 Lock lock(_containerLock);
41 qDebug(scriptengine) << "Clearing ATP scripts from ScriptCache";
42 for (auto it = _scriptCache.begin(); it != _scriptCache.end();) {
43 if (it.key().scheme() == "atp") {
44 qDebug(scriptengine) << "Removing: " << it.key();
45 it = _scriptCache.erase(it);
46 } else {
47 ++it;
48 }
49 }
50}
51
39QString ScriptCache::getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool reload) {52QString ScriptCache::getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool reload) {
40 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);53 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);
41 QString scriptContents;54 QString scriptContents;