| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2012 Google Inc. All rights reserved. | 4 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 Vector<long> idsToRemove; | 121 Vector<long> idsToRemove; |
| 122 IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end(); | 122 IdToInjectedScriptMap::iterator end = m_idToInjectedScript.end(); |
| 123 for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it !
= end; ++it) { | 123 for (IdToInjectedScriptMap::iterator it = m_idToInjectedScript.begin(); it !
= end; ++it) { |
| 124 NewScriptState* scriptState = it->value.scriptState(); | 124 NewScriptState* scriptState = it->value.scriptState(); |
| 125 if (window != scriptState->domWindow()) | 125 if (window != scriptState->domWindow()) |
| 126 continue; | 126 continue; |
| 127 m_scriptStateToId.remove(scriptState); | 127 m_scriptStateToId.remove(scriptState); |
| 128 idsToRemove.append(it->key); | 128 idsToRemove.append(it->key); |
| 129 } | 129 } |
| 130 | 130 m_idToInjectedScript.removeAll(idsToRemove); |
| 131 for (size_t i = 0; i < idsToRemove.size(); i++) | |
| 132 m_idToInjectedScript.remove(idsToRemove[i]); | |
| 133 | 131 |
| 134 // Now remove script states that have id but no injected script. | 132 // Now remove script states that have id but no injected script. |
| 135 Vector<NewScriptState*> scriptStatesToRemove; | 133 Vector<NewScriptState*> scriptStatesToRemove; |
| 136 for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scrip
tStateToId.end(); ++it) { | 134 for (ScriptStateToId::iterator it = m_scriptStateToId.begin(); it != m_scrip
tStateToId.end(); ++it) { |
| 137 NewScriptState* scriptState = it->key; | 135 NewScriptState* scriptState = it->key; |
| 138 if (window == scriptState->domWindow()) | 136 if (window == scriptState->domWindow()) |
| 139 scriptStatesToRemove.append(scriptState); | 137 scriptStatesToRemove.append(scriptState); |
| 140 } | 138 } |
| 141 for (size_t i = 0; i < scriptStatesToRemove.size(); i++) | 139 m_scriptStateToId.removeAll(scriptStatesToRemove); |
| 142 m_scriptStateToId.remove(scriptStatesToRemove[i]); | |
| 143 } | 140 } |
| 144 | 141 |
| 145 bool InjectedScriptManager::canAccessInspectedWorkerGlobalScope(NewScriptState*) | 142 bool InjectedScriptManager::canAccessInspectedWorkerGlobalScope(NewScriptState*) |
| 146 { | 143 { |
| 147 return true; | 144 return true; |
| 148 } | 145 } |
| 149 | 146 |
| 150 void InjectedScriptManager::releaseObjectGroup(const String& objectGroup) | 147 void InjectedScriptManager::releaseObjectGroup(const String& objectGroup) |
| 151 { | 148 { |
| 152 Vector<int> keys; | 149 Vector<int> keys; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 177 | 174 |
| 178 int id = injectedScriptIdFor(inspectedScriptState); | 175 int id = injectedScriptIdFor(inspectedScriptState); |
| 179 ScriptObject injectedScriptObject = createInjectedScript(injectedScriptSourc
e(), inspectedScriptState, id); | 176 ScriptObject injectedScriptObject = createInjectedScript(injectedScriptSourc
e(), inspectedScriptState, id); |
| 180 InjectedScript result(injectedScriptObject, m_inspectedStateAccessCheck); | 177 InjectedScript result(injectedScriptObject, m_inspectedStateAccessCheck); |
| 181 m_idToInjectedScript.set(id, result); | 178 m_idToInjectedScript.set(id, result); |
| 182 return result; | 179 return result; |
| 183 } | 180 } |
| 184 | 181 |
| 185 } // namespace WebCore | 182 } // namespace WebCore |
| 186 | 183 |
| OLD | NEW |