| Index: Source/bindings/core/dart/DartScriptDebugServer.cpp
|
| diff --git a/Source/bindings/core/dart/DartScriptDebugServer.cpp b/Source/bindings/core/dart/DartScriptDebugServer.cpp
|
| index 47f4d271f80a4ae22600c6abf556999d2468e5fc..a0d168b952e528341b6dd41dc586d94891c53b28 100644
|
| --- a/Source/bindings/core/dart/DartScriptDebugServer.cpp
|
| +++ b/Source/bindings/core/dart/DartScriptDebugServer.cpp
|
| @@ -208,6 +208,10 @@ String DartPageDebug::setBreakpoint(const String& sourceID, const ScriptBreakpoi
|
| DartIsolateScope scope(isolate);
|
| DartApiScope apiScope;
|
| Dart_Handle exception = 0;
|
| + if (!DartDOMData::current()->hasApplicationLoader()) {
|
| + // TODO(jacobr): why are we still hitting this case?
|
| + break;
|
| + }
|
| if (!DartDOMData::current()->applicationLoader()->running()) {
|
| // Skip until the loader is actually running. We'll set the breakpoint at that point.
|
| break;
|
| @@ -314,11 +318,15 @@ void DartPageDebug::dispatchDidParseSource(intptr_t libraryId, Dart_Handle scrip
|
| break;
|
| }
|
| }
|
| - Dart_Handle exception = 0;
|
| - lastLineNumber = DartUtilities::toInteger(Dart_ListGetAt(info, lastLineStart + 1), exception);
|
| - ASSERT(!exception);
|
| - lastColumnNumber = DartUtilities::toInteger(Dart_ListGetAt(info, infoLength - 1), exception);
|
| - ASSERT(!exception);
|
| + // we shouldn't crash even if a script has zero valid Dart tokens.
|
| + // TODO(jacobr): I don't know why this occurs.
|
| + if (lastLineStart + 1 < infoLength && infoLength > 0) {
|
| + Dart_Handle exception = 0;
|
| + lastLineNumber = DartUtilities::toInteger(Dart_ListGetAt(info, lastLineStart + 1), exception);
|
| + ASSERT(!exception);
|
| + lastColumnNumber = DartUtilities::toInteger(Dart_ListGetAt(info, infoLength - 1), exception);
|
| + ASSERT(!exception);
|
| + }
|
|
|
| script.startLine = 0;
|
| script.startColumn = 0;
|
| @@ -605,10 +613,14 @@ String DartScriptDebugServer::getScriptId(const String& url, Dart_Isolate isolat
|
|
|
| void DartScriptDebugServer::registerIsolate(Dart_Isolate isolate, Page* page)
|
| {
|
| - threadSafeIsolateTracker().add(isolate);
|
| -
|
| DartIsolateScope scope(isolate);
|
| DartApiScope apiScope;
|
| + // Check whether this is an isolate we really want to debug.
|
| + if (DartDOMData::current() == NULL || !DartDOMData::current()->hasApplicationLoader()) {
|
| + return;
|
| + }
|
| +
|
| + threadSafeIsolateTracker().add(isolate);
|
|
|
| DartPageDebug* pageDebug = lookupPageDebug(page);
|
| pageDebug->registerIsolate(isolate);
|
|
|