| 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 12 matching lines...) Expand all Loading... |
| 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "core/inspector/v8/InjectedScriptManager.h" | 31 #include "core/inspector/v8/InjectedScriptManager.h" |
| 32 | 32 |
| 33 #include "core/InjectedScriptSource.h" |
| 33 #include "core/inspector/v8/InjectedScript.h" | 34 #include "core/inspector/v8/InjectedScript.h" |
| 34 #include "core/inspector/v8/InjectedScriptHost.h" | 35 #include "core/inspector/v8/InjectedScriptHost.h" |
| 35 #include "core/inspector/v8/InjectedScriptNative.h" | 36 #include "core/inspector/v8/InjectedScriptNative.h" |
| 36 #include "core/inspector/v8/RemoteObjectId.h" | 37 #include "core/inspector/v8/RemoteObjectId.h" |
| 37 #include "core/inspector/v8/V8Debugger.h" | 38 #include "core/inspector/v8/V8Debugger.h" |
| 38 #include "core/inspector/v8/V8DebuggerClient.h" | 39 #include "core/inspector/v8/V8DebuggerClient.h" |
| 39 #include "core/inspector/v8/V8InjectedScriptHost.h" | 40 #include "core/inspector/v8/V8InjectedScriptHost.h" |
| 40 #include "core/inspector/v8/V8StringUtil.h" | 41 #include "core/inspector/v8/V8StringUtil.h" |
| 41 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
| 42 #include "public/platform/WebData.h" | 43 #include "public/platform/WebData.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 129 |
| 129 IdToInjectedScriptMap::iterator it = m_idToInjectedScript.find(contextId); | 130 IdToInjectedScriptMap::iterator it = m_idToInjectedScript.find(contextId); |
| 130 if (it != m_idToInjectedScript.end()) | 131 if (it != m_idToInjectedScript.end()) |
| 131 return it->value.get(); | 132 return it->value.get(); |
| 132 | 133 |
| 133 v8::Local<v8::Context> callingContext = context->GetIsolate()->GetCallingCon
text(); | 134 v8::Local<v8::Context> callingContext = context->GetIsolate()->GetCallingCon
text(); |
| 134 if (!callingContext.IsEmpty() && !m_client->callingContextCanAccessContext(c
allingContext, context)) | 135 if (!callingContext.IsEmpty() && !m_client->callingContextCanAccessContext(c
allingContext, context)) |
| 135 return nullptr; | 136 return nullptr; |
| 136 | 137 |
| 137 RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScr
iptNative(context->GetIsolate())); | 138 RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScr
iptNative(context->GetIsolate())); |
| 138 | 139 String injectedScriptSource(reinterpret_cast<const char*>(InjectedScriptSour
ce_js), sizeof(InjectedScriptSource_js)); |
| 139 const WebData& injectedScriptSourceResource = Platform::current()->loadResou
rce("InjectedScriptSource.js"); | |
| 140 String injectedScriptSource(injectedScriptSourceResource.data(), injectedScr
iptSourceResource.size()); | |
| 141 | 140 |
| 142 v8::Local<v8::Object> object = createInjectedScript(injectedScriptSource, co
ntext, contextId, injectedScriptNative.get()); | 141 v8::Local<v8::Object> object = createInjectedScript(injectedScriptSource, co
ntext, contextId, injectedScriptNative.get()); |
| 143 OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(this, context, o
bject, m_client, injectedScriptNative.release(), contextId)); | 142 OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(this, context, o
bject, m_client, injectedScriptNative.release(), contextId)); |
| 144 InjectedScript* resultPtr = result.get(); | 143 InjectedScript* resultPtr = result.get(); |
| 145 if (m_customObjectFormatterEnabled) | 144 if (m_customObjectFormatterEnabled) |
| 146 result->setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled); | 145 result->setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled); |
| 147 m_idToInjectedScript.set(contextId, result.release()); | 146 m_idToInjectedScript.set(contextId, result.release()); |
| 148 return resultPtr; | 147 return resultPtr; |
| 149 } | 148 } |
| 150 | 149 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 179 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number:
:New(context->GetIsolate(), id) }; | 178 v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number:
:New(context->GetIsolate(), id) }; |
| 180 v8::Local<v8::Value> injectedScriptValue; | 179 v8::Local<v8::Value> injectedScriptValue; |
| 181 if (!m_client->callInternalFunction(v8::Local<v8::Function>::Cast(value), wi
ndowGlobal, WTF_ARRAY_LENGTH(info), info).ToLocal(&injectedScriptValue)) | 180 if (!m_client->callInternalFunction(v8::Local<v8::Function>::Cast(value), wi
ndowGlobal, WTF_ARRAY_LENGTH(info), info).ToLocal(&injectedScriptValue)) |
| 182 return v8::Local<v8::Object>(); | 181 return v8::Local<v8::Object>(); |
| 183 if (!injectedScriptValue->IsObject()) | 182 if (!injectedScriptValue->IsObject()) |
| 184 return v8::Local<v8::Object>(); | 183 return v8::Local<v8::Object>(); |
| 185 return injectedScriptValue.As<v8::Object>(); | 184 return injectedScriptValue.As<v8::Object>(); |
| 186 } | 185 } |
| 187 | 186 |
| 188 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |