| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 v8::TryCatch tryCatch(m_context->GetIsolate()); | 77 v8::TryCatch tryCatch(m_context->GetIsolate()); |
| 78 tryCatch.SetVerbose(reportExceptions); | 78 tryCatch.SetVerbose(reportExceptions); |
| 79 | 79 |
| 80 v8::Local<v8::Value> result = callWithoutExceptionHandling(); | 80 v8::Local<v8::Value> result = callWithoutExceptionHandling(); |
| 81 hadException = tryCatch.HasCaught(); | 81 hadException = tryCatch.HasCaught(); |
| 82 return result; | 82 return result; |
| 83 } | 83 } |
| 84 | 84 |
| 85 v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() | 85 v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() |
| 86 { | 86 { |
| 87 // TODO(dgozman): get rid of this check. |
| 88 if (!m_debugger->client()->isExecutionAllowed()) |
| 89 return v8::Local<v8::Value>(); |
| 90 |
| 87 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); | 91 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); |
| 88 v8::Local<v8::Value> value; | 92 v8::Local<v8::Value> value; |
| 89 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) | 93 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) |
| 90 return v8::Local<v8::Value>(); | 94 return v8::Local<v8::Value>(); |
| 91 | 95 |
| 92 ASSERT(value->IsFunction()); | 96 ASSERT(value->IsFunction()); |
| 93 | 97 |
| 94 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); | 98 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); |
| 95 OwnPtr<v8::Local<v8::Value>[]> info = adoptArrayPtr(new v8::Local<v8::Value>
[m_arguments.size()]); | 99 OwnPtr<v8::Local<v8::Value>[]> info = adoptArrayPtr(new v8::Local<v8::Value>
[m_arguments.size()]); |
| 96 for (size_t i = 0; i < m_arguments.size(); ++i) { | 100 for (size_t i = 0; i < m_arguments.size(); ++i) { |
| 97 info[i] = m_arguments[i]; | 101 info[i] = m_arguments[i]; |
| 98 ASSERT(!info[i].IsEmpty()); | 102 ASSERT(!info[i].IsEmpty()); |
| 99 } | 103 } |
| 100 | 104 |
| 105 v8::MicrotasksScope microtasksScope(m_context->GetIsolate(), v8::MicrotasksS
cope::kDoNotRunMicrotasks); |
| 101 v8::Local<v8::Value> result; | 106 v8::Local<v8::Value> result; |
| 102 if (!m_debugger->callFunction(function, m_context, thisObject, m_arguments.s
ize(), info.get()).ToLocal(&result)) | 107 if (!function->Call(m_context, thisObject, m_arguments.size(), info.get()).T
oLocal(&result)) |
| 103 return v8::Local<v8::Value>(); | 108 return v8::Local<v8::Value>(); |
| 104 return result; | 109 return result; |
| 105 } | 110 } |
| 106 | 111 |
| 107 v8::Local<v8::Function> V8FunctionCall::function() | 112 v8::Local<v8::Function> V8FunctionCall::function() |
| 108 { | 113 { |
| 109 v8::TryCatch tryCatch(m_context->GetIsolate()); | 114 v8::TryCatch tryCatch(m_context->GetIsolate()); |
| 110 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); | 115 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); |
| 111 v8::Local<v8::Value> value; | 116 v8::Local<v8::Value> value; |
| 112 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) | 117 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) |
| 113 return v8::Local<v8::Function>(); | 118 return v8::Local<v8::Function>(); |
| 114 | 119 |
| 115 ASSERT(value->IsFunction()); | 120 ASSERT(value->IsFunction()); |
| 116 return v8::Local<v8::Function>::Cast(value); | 121 return v8::Local<v8::Function>::Cast(value); |
| 117 } | 122 } |
| 118 | 123 |
| 119 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |