| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2010, Google Inc. All rights reserved. | 2 * Copyright (c) 2010, 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); | 123 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); |
| 124 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 124 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 125 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeChain"))); | 125 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeChain"))); |
| 126 v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(func->Call(m_is
olate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 126 v8::Local<v8::Array> scopeChain = v8::Local<v8::Array>::Cast(func->Call(m_is
olate->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); |
| 127 v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length()
); | 127 v8::Local<v8::Array> result = v8::Array::New(m_isolate, scopeChain->Length()
); |
| 128 for (uint32_t i = 0; i < scopeChain->Length(); i++) | 128 for (uint32_t i = 0; i < scopeChain->Length(); i++) |
| 129 result->Set(i, scopeChain->Get(i)); | 129 result->Set(i, scopeChain->Get(i)); |
| 130 return result; | 130 return result; |
| 131 } | 131 } |
| 132 | 132 |
| 133 int JavaScriptCallFrame::scopeType(int scopeIndex) const | 133 v8::Local<v8::String> JavaScriptCallFrame::scopeType(int scopeIndex) const |
| 134 { | 134 { |
| 135 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); | 135 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); |
| 136 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 136 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 137 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeType"))); | 137 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeType"))); |
| 138 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 138 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); |
| 139 return scopeType->Get(scopeIndex)->Int32Value(); | 139 return scopeType->Get(scopeIndex)->ToString(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const | 142 v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const |
| 143 { | 143 { |
| 144 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); | 144 v8::MicrotasksScope microtasks(m_isolate, v8::MicrotasksScope::kDoNotRunMicr
otasks); |
| 145 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); | 145 v8::Local<v8::Object> callFrame = v8::Local<v8::Object>::New(m_isolate, m_ca
llFrame); |
| 146 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeName"))); | 146 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(
toV8StringInternalized(m_isolate, "scopeName"))); |
| 147 v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); | 147 v8::Local<v8::Array> scopeName = v8::Local<v8::Array>::Cast(func->Call(m_iso
late->GetCurrentContext(), callFrame, 0, nullptr).ToLocalChecked()); |
| 148 return scopeType->Get(scopeIndex)->ToString(); | 148 return scopeName->Get(scopeIndex)->ToString(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 v8::Local<v8::Value> JavaScriptCallFrame::scopeStartLocation(int scopeIndex) con
st | 151 v8::Local<v8::Value> JavaScriptCallFrame::scopeStartLocation(int scopeIndex) con
st |
| 152 { | 152 { |
| 153 return callScopeLocationFunction("scopeStartLocation", scopeIndex); | 153 return callScopeLocationFunction("scopeStartLocation", scopeIndex); |
| 154 } | 154 } |
| 155 | 155 |
| 156 v8::Local<v8::Value> JavaScriptCallFrame::scopeEndLocation(int scopeIndex) const | 156 v8::Local<v8::Value> JavaScriptCallFrame::scopeEndLocation(int scopeIndex) const |
| 157 { | 157 { |
| 158 return callScopeLocationFunction("scopeEndLocation", scopeIndex); | 158 return callScopeLocationFunction("scopeEndLocation", scopeIndex); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>::
Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue"))); | 217 v8::Local<v8::Function> setVariableValueFunction = v8::Local<v8::Function>::
Cast(callFrame->Get(toV8StringInternalized(m_isolate, "setVariableValue"))); |
| 218 v8::Local<v8::Value> argv[] = { | 218 v8::Local<v8::Value> argv[] = { |
| 219 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), | 219 v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)), |
| 220 variableName, | 220 variableName, |
| 221 newValue | 221 newValue |
| 222 }; | 222 }; |
| 223 return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFr
ame, WTF_ARRAY_LENGTH(argv), argv); | 223 return setVariableValueFunction->Call(m_isolate->GetCurrentContext(), callFr
ame, WTF_ARRAY_LENGTH(argv), argv); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace blink | 226 } // namespace blink |
| OLD | NEW |