Vector<RefPtr<ScriptState> > scriptStatesToRemove;
for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scriptStateToId.end(); ++it) {
RefPtr<ScriptState> scriptState = it->key;
- if (scriptState->contextIsValid() || window == scriptState->domWindow()) {
+ if (!scriptState->contextIsValid() || window == scriptState->domWindow()) {
scriptStatesToRemove.append(scriptState);
m_frontend->executionContextDestroyed(it->value);
}
}
m_scriptStateToId.removeAll(scriptStatesToRemove);
+ injectedScriptManager()->discardInjectedScriptsFor(window);
}
} // namespace blink