| Index: Source/bindings/dart/DartApplicationLoader.cpp
|
| diff --git a/Source/bindings/dart/DartApplicationLoader.cpp b/Source/bindings/dart/DartApplicationLoader.cpp
|
| index 18e6d0f7e0e4a1039a01394d9ba129710e4e8a61..f63b87d28d84c80c872b331af14eaf59b375613c 100644
|
| --- a/Source/bindings/dart/DartApplicationLoader.cpp
|
| +++ b/Source/bindings/dart/DartApplicationLoader.cpp
|
| @@ -267,23 +267,29 @@ void DartApplicationLoader::load(PassRefPtr<DartErrorEventDispatcher> errorEvent
|
|
|
| DartIsolateScope isolateScope(m_isolate);
|
| DartApiScope dartApiScope;
|
| + bool completeFutures = false;
|
|
|
| - // Indicate to the VM that all outstanding load requests are done. This
|
| - // call will finalize all the classes loaded so far and complete all
|
| - // deferred library load futures.
|
| + // Finalize classes and complete futures if there are any deferred loads.
|
| + if (!m_mainInvoked) {
|
| + RELEASE_ASSERT(m_state == Ready);
|
| + } else {
|
| + // We have already invoked the entry point on the main script URL at
|
| + // this point we will start running dart code again.
|
| + RELEASE_ASSERT(m_state == DeferredReady);
|
| + m_state = Running;
|
| + completeFutures = true;
|
| + }
|
| {
|
| V8Scope v8scope(DartDOMData::current());
|
| - Dart_Handle result = Dart_FinalizeLoading(true);
|
| + Dart_Handle result = Dart_FinalizeLoading(completeFutures);
|
| if (Dart_IsError(result)) {
|
| reportDartError(result);
|
| return;
|
| }
|
| }
|
| -
|
| // Invoke the entry point on the main script URL if it has not yet been
|
| // invoked.
|
| if (!m_mainInvoked) {
|
| - RELEASE_ASSERT(m_state == Ready);
|
| // Call the entry point on the main script URL.
|
| callEntryPoint();
|
| }
|
|
|