Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: lib/src/runner/browser/browser_manager.dart

Issue 1228943005: Avoid an uncaught error. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/browser_manager.dart
diff --git a/lib/src/runner/browser/browser_manager.dart b/lib/src/runner/browser/browser_manager.dart
index 0442d82bd35819400cdce2c802d588f962c6142b..4504f86b7c9cfc79a071158effc6acd851ad8a46 100644
--- a/lib/src/runner/browser/browser_manager.dart
+++ b/lib/src/runner/browser/browser_manager.dart
@@ -48,12 +48,17 @@ class BrowserManager {
/// across the client and server.
int _suiteId = 0;
+ /// Whether the channel to the browser has closed.
+ bool _closed;
+
/// Creates a new BrowserManager that communicates with [browser] over
/// [webSocket].
BrowserManager(this.browser, CompatibleWebSocket webSocket)
: _channel = new MultiChannel(
webSocket.map(JSON.decode),
- mapSink(webSocket, JSON.encode));
+ mapSink(webSocket, JSON.encode)) {
+ _channel.stream.listen(null, onDone: () => _closed = true);
kevmoo 2015/07/14 23:33:38 feels weird, but I guess Stream doesn't have a don
+ }
/// Tells the browser the load a test suite from the URL [url].
///
@@ -77,6 +82,7 @@ class BrowserManager {
var suiteChannel;
closeIframe() {
+ if (_closed) return;
suiteChannel.sink.close();
_channel.sink.add({
"command": "closeSuite",
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698