| Index: pkg/unittest/html_config.dart
|
| ===================================================================
|
| --- pkg/unittest/html_config.dart (revision 12649)
|
| +++ pkg/unittest/html_config.dart (working copy)
|
| @@ -20,22 +20,35 @@
|
| // TODO(rnystrom): Get rid of this if we get canonical closures for methods.
|
| EventListener _onErrorClosure;
|
|
|
| + void _installErrorHandler() {
|
| + if (_onErrorClosure == null) {
|
| + _onErrorClosure =
|
| + (e) => handleExternalError(e, '(DOM callback has errors)');
|
| + // Listen for uncaught errors.
|
| + window.on.error.add(_onErrorClosure);
|
| + }
|
| + }
|
| +
|
| + void _uninstallErrorHandler() {
|
| + if (_onErrorClosure != null) {
|
| + window.on.error.remove(_onErrorClosure);
|
| + _onErrorClosure = null;
|
| + }
|
| + }
|
| +
|
| void onInit() {
|
| - _onErrorClosure =
|
| - (e) => handleExternalError(e, '(DOM callback has errors)');
|
| + _installErrorHandler();
|
| }
|
|
|
| void onStart() {
|
| window.postMessage('unittest-suite-wait-for-done', '*');
|
| - // Listen for uncaught errors.
|
| - window.on.error.add(_onErrorClosure);
|
| }
|
|
|
| void onTestResult(TestCase testCase) {}
|
|
|
| void onDone(int passed, int failed, int errors, List<TestCase> results,
|
| String uncaughtError) {
|
| - window.on.error.remove(_onErrorClosure);
|
| + _uninstallErrorHandler();
|
| _showResultsInPage(passed, failed, errors, results, _isLayoutTest,
|
| uncaughtError);
|
| window.postMessage('unittest-suite-done', '*');
|
|
|