| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include <wtf/HashSet.h> | 7 #include <wtf/HashSet.h> |
| 8 #include <wtf/RefPtr.h> | 8 #include <wtf/RefPtr.h> |
| 9 #include <wtf/Vector.h> | 9 #include <wtf/Vector.h> |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 v8::Handle<v8::Value> args[] = { | 158 v8::Handle<v8::Value> args[] = { |
| 159 function_name_wrapper, | 159 function_name_wrapper, |
| 160 json_args_wrapper, | 160 json_args_wrapper, |
| 161 call_id_wrapper | 161 call_id_wrapper |
| 162 }; | 162 }; |
| 163 | 163 |
| 164 v8::TryCatch try_catch; | 164 v8::TryCatch try_catch; |
| 165 v8::Handle<v8::Value> res_obj = function->Call(context->Global(), 3, args); | 165 v8::Handle<v8::Value> res_obj = function->Call(context->Global(), 3, args); |
| 166 if (try_catch.HasCaught()) { | 166 if (try_catch.HasCaught()) { |
| 167 *exception = WebCore::toWebCoreString(try_catch.Message()->Get()); | 167 v8::Local<v8::Message> message = try_catch.Message(); |
| 168 if (message.IsEmpty()) |
| 169 *exception = "Unknown exception"; |
| 170 else |
| 171 *exception = WebCore::toWebCoreString(message->Get()); |
| 168 return ""; | 172 return ""; |
| 169 } else { | 173 } else { |
| 170 return WebCore::toWebCoreStringWithNullCheck(res_obj); | 174 return WebCore::toWebCoreStringWithNullCheck(res_obj); |
| 171 } | 175 } |
| 172 } | 176 } |
| 173 | 177 |
| 174 void DebuggerAgentImpl::ExecuteVoidJavaScript(v8::Handle<v8::Context> context) { | 178 void DebuggerAgentImpl::ExecuteVoidJavaScript(v8::Handle<v8::Context> context) { |
| 175 v8::HandleScope scope; | 179 v8::HandleScope scope; |
| 176 ASSERT(!context.IsEmpty()); | 180 ASSERT(!context.IsEmpty()); |
| 177 v8::Context::Scope context_scope(context); | 181 v8::Context::Scope context_scope(context); |
| 178 DebuggerAgentManager::UtilityContextScope utility_scope; | 182 DebuggerAgentManager::UtilityContextScope utility_scope; |
| 179 | 183 |
| 180 v8::Handle<v8::Value> function = | 184 v8::Handle<v8::Value> function = |
| 181 context->Global()->Get(v8::String::New("devtools$$void")); | 185 context->Global()->Get(v8::String::New("devtools$$void")); |
| 182 ASSERT(function->IsFunction()); | 186 ASSERT(function->IsFunction()); |
| 183 v8::Handle<v8::Value> args[] = { | 187 v8::Handle<v8::Value> args[] = { |
| 184 v8::Local<v8::Value>() | 188 v8::Local<v8::Value>() |
| 185 }; | 189 }; |
| 186 v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args); | 190 v8::Handle<v8::Function>::Cast(function)->Call(context->Global(), 0, args); |
| 187 } | 191 } |
| 188 | 192 |
| 189 WebCore::Page* DebuggerAgentImpl::GetPage() { | 193 WebCore::Page* DebuggerAgentImpl::GetPage() { |
| 190 return web_view_impl_->page(); | 194 return web_view_impl_->page(); |
| 191 } | 195 } |
| OLD | NEW |