| Index: Source/bindings/dart/DartUtilities.cpp
|
| diff --git a/Source/bindings/dart/DartUtilities.cpp b/Source/bindings/dart/DartUtilities.cpp
|
| index 8a3d43ba6daea83bd820a7ddc635a43fe8d1ff37..bc6a943294205a25e1f749e6e40f5a8b3662b0d7 100644
|
| --- a/Source/bindings/dart/DartUtilities.cpp
|
| +++ b/Source/bindings/dart/DartUtilities.cpp
|
| @@ -942,6 +942,11 @@ DOMWindow* DartUtilities::domWindowForCurrentIsolate()
|
| return document->domWindow();
|
| }
|
|
|
| +V8ScriptState* DartUtilities::v8ScriptStateForCurrentIsolate()
|
| +{
|
| + return V8ScriptState::forMainWorld(domWindowForCurrentIsolate()->frame());
|
| +}
|
| +
|
| ExecutionContext* DartUtilities::scriptExecutionContext()
|
| {
|
| if (Dart_CurrentIsolate())
|
| @@ -1033,6 +1038,47 @@ static PassRefPtr<ScriptCallStack> createScriptCallStackFromStackTrace(Dart_Stac
|
| return ScriptCallStack::create(scriptCallStackFrames);
|
| }
|
|
|
| +ScriptCallFrame DartUtilities::getTopFrame(Dart_StackTrace stackTrace, Dart_Handle& exception)
|
| +{
|
| + {
|
| + uintptr_t frameCount = 0;
|
| + Dart_Handle result = Dart_StackTraceLength(stackTrace, reinterpret_cast<intptr_t*>(&frameCount));
|
| + if (Dart_IsError(result)) {
|
| + exception = result;
|
| + goto fail;
|
| + }
|
| + if (!frameCount) {
|
| + exception = Dart_NewStringFromCString("Empty stack trace");
|
| + goto fail;
|
| + }
|
| + Dart_ActivationFrame frame = 0;
|
| + result = Dart_GetActivationFrame(stackTrace, 0, &frame);
|
| + if (Dart_IsError(result)) {
|
| + exception = result;
|
| + goto fail;
|
| + }
|
| + ASSERT(frame);
|
| + return toScriptCallFrame(frame, exception);
|
| + }
|
| +fail:
|
| + return ScriptCallFrame("undefined", "undefined", "undefined", 0, 0);
|
| +}
|
| +
|
| +ScriptCallFrame DartUtilities::toScriptCallFrame(Dart_ActivationFrame frame, Dart_Handle& exception)
|
| +{
|
| + ASSERT(frame);
|
| + Dart_Handle functionName;
|
| + Dart_Handle scriptUrl;
|
| + intptr_t lineNumber = 0;
|
| + intptr_t columnNumber = 0;
|
| + Dart_Handle result = Dart_ActivationFrameInfo(frame, &functionName, &scriptUrl, &lineNumber, &columnNumber);
|
| + if (Dart_IsError(result)) {
|
| + exception = result;
|
| + return ScriptCallFrame("undefined", "undefined", "undefined", 0, 0);
|
| + }
|
| + return ScriptCallFrame(DartUtilities::toString(functionName), "undefined", DartUtilities::toString(scriptUrl), lineNumber, columnNumber);
|
| +}
|
| +
|
| PassRefPtr<ScriptCallStack> DartUtilities::createScriptCallStack()
|
| {
|
| Dart_StackTrace trace = 0;
|
|
|