Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1303)

Unified Diff: Source/core/inspector/InjectedScriptManager.cpp

Issue 686763002: Fix Runtime.executionContextCreated for crafted iframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InjectedScriptManager.cpp
diff --git a/Source/core/inspector/InjectedScriptManager.cpp b/Source/core/inspector/InjectedScriptManager.cpp
index c402941d615f59f898c69993e0686d9447713869..61f3b7950cd47c4a72ba250c6142ad9629d5599a 100644
--- a/Source/core/inspector/InjectedScriptManager.cpp
+++ b/Source/core/inspector/InjectedScriptManager.cpp
@@ -119,30 +119,14 @@ void InjectedScriptManager::discardInjectedScripts()
m_scriptStateToId.clear();
}
-void InjectedScriptManager::discardInjectedScriptsFor(LocalDOMWindow* window)
+void InjectedScriptManager::discardInjectedScriptFor(ScriptState* scriptState)
{
- if (m_scriptStateToId.isEmpty())
+ ScriptStateToId::iterator it = m_scriptStateToId.find(scriptState);
+ if (it == m_scriptStateToId.end())
return;
- Vector<long> idsToRemove;
- IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end();
- for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it) {
- ScriptState* scriptState = it->value.scriptState();
- if (window != scriptState->domWindow())
- continue;
- m_scriptStateToId.remove(scriptState);
- idsToRemove.append(it->key);
- }
- m_idToInjectedScript.removeAll(idsToRemove);
-
- // Now remove script states that have id but no injected script.
- Vector<ScriptState*> scriptStatesToRemove;
- for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scriptStateToId.end(); ++it) {
- ScriptState* scriptState = it->key.get();
- if (window == scriptState->domWindow())
- scriptStatesToRemove.append(scriptState);
- }
- m_scriptStateToId.removeAll(scriptStatesToRemove);
+ m_idToInjectedScript.remove(it->value);
+ m_scriptStateToId.remove(scriptState);
yurys 2014/11/13 13:58:30 m_scriptStateToId.remove(it);
eustas 2014/12/05 10:01:36 Done.
}
bool InjectedScriptManager::canAccessInspectedWorkerGlobalScope(ScriptState*)

Powered by Google App Engine
This is Rietveld 408576698