| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 v8::Local<v8::Value> V8FunctionCall::call() | 85 v8::Local<v8::Value> V8FunctionCall::call() |
| 86 { | 86 { |
| 87 bool hadException = false; | 87 bool hadException = false; |
| 88 return call(hadException); | 88 return call(hadException); |
| 89 } | 89 } |
| 90 | 90 |
| 91 v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() | 91 v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() |
| 92 { | 92 { |
| 93 // TODO(dgozman): get rid of this check. |
| 94 if (!m_debugger->client()->isExecutionAllowed()) |
| 95 return v8::Local<v8::Value>(); |
| 96 |
| 93 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); | 97 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); |
| 94 v8::Local<v8::Value> value; | 98 v8::Local<v8::Value> value; |
| 95 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) | 99 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) |
| 96 return v8::Local<v8::Value>(); | 100 return v8::Local<v8::Value>(); |
| 97 | 101 |
| 98 ASSERT(value->IsFunction()); | 102 ASSERT(value->IsFunction()); |
| 99 | 103 |
| 100 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); | 104 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(value); |
| 101 OwnPtr<v8::Local<v8::Value>[]> info = adoptArrayPtr(new v8::Local<v8::Value>
[m_arguments.size()]); | 105 OwnPtr<v8::Local<v8::Value>[]> info = adoptArrayPtr(new v8::Local<v8::Value>
[m_arguments.size()]); |
| 102 for (size_t i = 0; i < m_arguments.size(); ++i) { | 106 for (size_t i = 0; i < m_arguments.size(); ++i) { |
| 103 info[i] = m_arguments[i]; | 107 info[i] = m_arguments[i]; |
| 104 ASSERT(!info[i].IsEmpty()); | 108 ASSERT(!info[i].IsEmpty()); |
| 105 } | 109 } |
| 106 | 110 |
| 111 v8::MicrotasksScope microtasksScope(m_context->GetIsolate(), v8::MicrotasksS
cope::kDoNotRunMicrotasks); |
| 107 v8::Local<v8::Value> result; | 112 v8::Local<v8::Value> result; |
| 108 if (!m_debugger->callFunction(function, m_context, thisObject, m_arguments.s
ize(), info.get()).ToLocal(&result)) | 113 if (!function->Call(m_context, thisObject, m_arguments.size(), info.get()).T
oLocal(&result)) |
| 109 return v8::Local<v8::Value>(); | 114 return v8::Local<v8::Value>(); |
| 110 return result; | 115 return result; |
| 111 } | 116 } |
| 112 | 117 |
| 113 v8::Local<v8::Function> V8FunctionCall::function() | 118 v8::Local<v8::Function> V8FunctionCall::function() |
| 114 { | 119 { |
| 115 v8::TryCatch tryCatch(m_context->GetIsolate()); | 120 v8::TryCatch tryCatch(m_context->GetIsolate()); |
| 116 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); | 121 v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value); |
| 117 v8::Local<v8::Value> value; | 122 v8::Local<v8::Value> value; |
| 118 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) | 123 if (!thisObject->Get(m_context, m_name).ToLocal(&value)) |
| 119 return v8::Local<v8::Function>(); | 124 return v8::Local<v8::Function>(); |
| 120 | 125 |
| 121 ASSERT(value->IsFunction()); | 126 ASSERT(value->IsFunction()); |
| 122 return v8::Local<v8::Function>::Cast(value); | 127 return v8::Local<v8::Function>::Cast(value); |
| 123 } | 128 } |
| 124 | 129 |
| 125 } // namespace blink | 130 } // namespace blink |
| OLD | NEW |