Skip to content

Commit 4fd87c1

Browse files
rmacnak-googlecommit-bot@chromium.org
authored andcommitted
[vm] Delay completing deferredPrefix.loadLibrary even if the prefix is already loaded.
c5a94db unintentionally changed the behavior of loadLibrary on a prefix that was already loaded from completing in a future turn of the message loop to completing in the same turn. Completing in the same turn is a legal behavior for loadLibrary, but consistently completing in a later turn helps to prevent code that works on accident. Bug: #41974 Change-Id: Ib18d16f6b5517c882248f39b486e58e2635f24a1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155101 Reviewed-by: Alexander Markov <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 47ac03f commit 4fd87c1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sdk/lib/_internal/vm/lib/lib_prefix.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ Future<void> _loadLibrary(_LibraryPrefix prefix) async {
5858
}
5959
await load.future;
6060
}
61-
// Ensure the prefix's future does not complete until the next Turn even
62-
// when loading is a no-op or synchronous. Helps applications avoid writing
63-
// code that only works when loading isn't really deferred.
64-
await new Future<void>(() {
65-
prefix._setLoaded();
66-
});
6761
}
62+
// Ensure the prefix's future does not complete until the next Turn even
63+
// when loading is a no-op or synchronous. Helps applications avoid writing
64+
// code that only works when loading isn't really deferred.
65+
await new Future<void>(() {
66+
prefix._setLoaded();
67+
});
6868
}
6969

7070
@pragma("vm:entry-point")

0 commit comments

Comments
 (0)