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
3636 _scriptCache.clear();
3737 }
3838
39+void 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+
3952 QString ScriptCache::getScript(const QUrl& unnormalizedURL, ScriptUser* scriptUser, bool& isPending, bool reload) {
4053 QUrl url = ResourceManager::normalizeURL(unnormalizedURL);
4154 QString scriptContents;