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

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: rebase Created 6 years 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
« no previous file with comments | « Source/core/inspector/InjectedScriptManager.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScriptManager.cpp
diff --git a/Source/core/inspector/InjectedScriptManager.cpp b/Source/core/inspector/InjectedScriptManager.cpp
index c402941d615f59f898c69993e0686d9447713869..5be19e757b164dbe0717873120a286b148028614 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(it);
}
bool InjectedScriptManager::canAccessInspectedWorkerGlobalScope(ScriptState*)
« no previous file with comments | « Source/core/inspector/InjectedScriptManager.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698