void InjectedScriptHost::discardInjectedScripts()
{
    IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end();
    for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it)
        discardInjectedScript(it->second.scriptState());
    m_idToInjectedScript.clear();
}
예제 #2
0
void InjectedScriptManager::discardInjectedScriptsFor(DOMWindow* window)
{
    if (m_scriptStateToId.isEmpty())
        return;

    Vector<long> idsToRemove;
    IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end();
    for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it) {
        ScriptState* scriptState = it->second.scriptState();
        if (window != domWindowFromScriptState(scriptState))
            continue;
        discardInjectedScript(scriptState);
        m_scriptStateToId.remove(scriptState);
        idsToRemove.append(it->first);
    }

    for (size_t i = 0; i < idsToRemove.size(); i++)
        m_idToInjectedScript.remove(idsToRemove[i]);

    // 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->first;
        if (window == domWindowFromScriptState(scriptState))
            scriptStatesToRemove.append(scriptState);
    }
    for (size_t i = 0; i < scriptStatesToRemove.size(); i++)
        m_scriptStateToId.remove(scriptStatesToRemove[i]);
}
예제 #3
0
void InjectedScriptManager::discardInjectedScriptsFor(DOMWindow* window)
{
    Vector<long> idsToRemove;
    IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end();
    for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it != end; ++it) {
        ScriptState* scriptState = it->second.scriptState();
        if (window != domWindowFromScriptState(scriptState))
            continue;
        discardInjectedScript(scriptState);
        idsToRemove.append(it->first);
    }

    for (size_t i = 0; i < idsToRemove.size(); i++)
        m_idToInjectedScript.remove(idsToRemove[i]);
}