| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 InjectedScriptManager::~InjectedScriptManager() | 58 InjectedScriptManager::~InjectedScriptManager() |
| 59 { | 59 { |
| 60 m_injectedScriptHost->disconnect(); | 60 m_injectedScriptHost->disconnect(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 InjectedScriptHost* InjectedScriptManager::injectedScriptHost() | 63 InjectedScriptHost* InjectedScriptManager::injectedScriptHost() |
| 64 { | 64 { |
| 65 return m_injectedScriptHost.get(); | 65 return m_injectedScriptHost.get(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 InjectedScript* InjectedScriptManager::findInjectedScript(int id) const | 68 InjectedScript* InjectedScriptManager::findInjectedScript(ErrorString* errorStri
ng, int id) const |
| 69 { | 69 { |
| 70 IdToInjectedScriptMap::const_iterator it = m_idToInjectedScript.find(id); | 70 IdToInjectedScriptMap::const_iterator it = m_idToInjectedScript.find(id); |
| 71 if (it != m_idToInjectedScript.end()) | 71 if (it != m_idToInjectedScript.end()) |
| 72 return it->second; | 72 return it->second; |
| 73 *errorString = "Inspected frame has gone"; |
| 73 return nullptr; | 74 return nullptr; |
| 74 } | 75 } |
| 75 | 76 |
| 76 InjectedScript* InjectedScriptManager::findInjectedScript(ErrorString* errorStri
ng, RemoteObjectIdBase* objectId) const | 77 InjectedScript* InjectedScriptManager::findInjectedScript(ErrorString* errorStri
ng, RemoteObjectIdBase* objectId) const |
| 77 { | 78 { |
| 78 InjectedScript* injectedScript = nullptr; | 79 return objectId ? findInjectedScript(errorString, objectId->contextId()) : n
ullptr; |
| 79 if (objectId) { | |
| 80 injectedScript = findInjectedScript(objectId->contextId()); | |
| 81 if (!injectedScript) | |
| 82 *errorString = "Inspected frame has gone"; | |
| 83 } | |
| 84 return injectedScript; | |
| 85 } | 80 } |
| 86 | 81 |
| 87 void InjectedScriptManager::discardInjectedScripts() | 82 void InjectedScriptManager::discardInjectedScripts() |
| 88 { | 83 { |
| 89 m_idToInjectedScript.clear(); | 84 m_idToInjectedScript.clear(); |
| 90 } | 85 } |
| 91 | 86 |
| 92 int InjectedScriptManager::discardInjectedScriptFor(v8::Local<v8::Context> conte
xt) | 87 int InjectedScriptManager::discardInjectedScriptFor(v8::Local<v8::Context> conte
xt) |
| 93 { | 88 { |
| 94 int contextId = V8Debugger::contextId(context); | 89 int contextId = V8Debugger::contextId(context); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 m_globals[i]->ToObject(m_context).ToLocalChecked()->Delete(m_context, m_
symbol); | 206 m_globals[i]->ToObject(m_context).ToLocalChecked()->Delete(m_context, m_
symbol); |
| 212 } | 207 } |
| 213 | 208 |
| 214 void InjectedScriptManager::ScopedGlobalObjectExtension::setOnGlobal(v8::Local<v
8::Object> global, v8::Local<v8::Object> extension) | 209 void InjectedScriptManager::ScopedGlobalObjectExtension::setOnGlobal(v8::Local<v
8::Object> global, v8::Local<v8::Object> extension) |
| 215 { | 210 { |
| 216 if (global->Set(m_context, m_symbol, extension).FromMaybe(false)) | 211 if (global->Set(m_context, m_symbol, extension).FromMaybe(false)) |
| 217 m_globals.append(global); | 212 m_globals.append(global); |
| 218 } | 213 } |
| 219 | 214 |
| 220 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |