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

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

Issue 1055243005: Detect an old PhantomJS and emit a nice error. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 8 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 | « no previous file | lib/src/runner/browser/server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/phantom_js.dart
diff --git a/lib/src/runner/browser/phantom_js.dart b/lib/src/runner/browser/phantom_js.dart
index b4e2f4a40e44ce8326e3be1f6f7a5ffb08d53e9d..0eadafb4512d767c8558ae00c2a476508469f4da 100644
--- a/lib/src/runner/browser/phantom_js.dart
+++ b/lib/src/runner/browser/phantom_js.dart
@@ -9,7 +9,9 @@ import 'dart:io';
import 'package:path/path.dart' as p;
+import '../../util/exit_codes.dart' as exit_codes;
import '../../util/io.dart';
+import '../application_exception.dart';
import 'browser.dart';
/// The PhantomJS script that opens the host page.
@@ -17,6 +19,9 @@ final _script = """
var system = require('system');
var page = require('webpage').create();
+// PhantomJS versions older than 2.0.0 don't support the latest WebSocket spec.
+if (phantom.version.major < 2) phantom.exit(${exit_codes.protocol});
+
// Pipe browser messages to the process's stdout. This isn't used by default,
// but it can be useful for debugging.
page.onConsoleMessage = function(message) {
@@ -73,6 +78,10 @@ class PhantomJS implements Browser {
return _process.exitCode;
});
}).then((exitCode) {
+ if (exitCode == exit_codes.protocol) {
+ throw new ApplicationException(
+ "Only PhantomJS version 2.0.0 or greater is supported.");
+ }
if (exitCode != 0) throw "PhantomJS failed with exit code $exitCode.";
}).then(_onExitCompleter.complete)
.catchError(_onExitCompleter.completeError);
« no previous file with comments | « no previous file | lib/src/runner/browser/server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698