| 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);
|
|
|