Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / inspector / PageRuntimeAgent.cpp
index 5dccc13..9c1d5a2 100644 (file)
@@ -170,12 +170,13 @@ void PageRuntimeAgent::frameWindowDiscarded(LocalDOMWindow* window)
     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