| Index: lib/unittest/test_controller.js
|
| diff --git a/lib/unittest/test_controller.js b/lib/unittest/test_controller.js
|
| index 988bfe10fd704039b33116d3ed407854c6d99ca7..85e2b94338576ee93c8be22cd5d55da3606f1955 100644
|
| --- a/lib/unittest/test_controller.js
|
| +++ b/lib/unittest/test_controller.js
|
| @@ -31,15 +31,45 @@ if (window.layoutTestController) {
|
| }
|
| window.addEventListener("message", onReceive, false);
|
|
|
| -function onLoad(e) {
|
| - // needed for dartium compilation errors.
|
| - if (window.compilationError) {
|
| +function showErrorAndExit(message) {
|
| + if (message) {
|
| var element = document.createElement('pre');
|
| - element.innerHTML = window.compilationError;
|
| + element.innerHTML = message;
|
| document.body.appendChild(element);
|
| + }
|
| + if (window.layoutTestController) {
|
| window.layoutTestController.notifyDone();
|
| - return;
|
| + }
|
| +}
|
| +
|
| +function onLoad(e) {
|
| + // needed for dartium compilation errors.
|
| + if (window.compilationError) {
|
| + showErrorAndExit(window.compilationError);
|
| }
|
| }
|
|
|
| window.addEventListener("DOMContentLoaded", onLoad, false);
|
| +
|
| +// If nobody intercepts the error, finish the test.
|
| +window.addEventListener("error", function(e) {
|
| + // needed for dartium compilation errors.
|
| + showErrorAndExit(e && e.message);
|
| +}, false);
|
| +
|
| +document.onreadystatechange = function() {
|
| + if (document.readyState != "loaded") return;
|
| + // If 'startedDartTest' is not set, that means that the test did not have
|
| + // a chance to load. This will happen when a load error occurs in the VM.
|
| + // Give the machine time to start up.
|
| + setTimeout(function() {
|
| + // A window.postMessage might have been enqueued after this timeout.
|
| + // Just sleep another time to give the browser the time to process the
|
| + // posted message.
|
| + setTimeout(function() {
|
| + if (layoutTestController && !layoutTestController.startedDartTest) {
|
| + layoutTestController.notifyDone();
|
| + }
|
| + }, 0);
|
| + }, 50);
|
| +};
|
|
|