From 029b0a53d5511d213189f6bfdd497f8ed0d9a40e Mon Sep 17 00:00:00 2001 From: James Graham Date: Fri, 29 May 2015 17:27:14 +0100 Subject: [PATCH] Fix marionette executor's use of postMessage events to get test results --- wptrunner/executors/testharness_marionette.js | 30 +++++++++++-------- wptrunner/testharnessreport.js | 3 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/wptrunner/executors/testharness_marionette.js b/wptrunner/executors/testharness_marionette.js index 9c462d881053c7..f5eb9fa920ab51 100644 --- a/wptrunner/executors/testharness_marionette.js +++ b/wptrunner/executors/testharness_marionette.js @@ -5,23 +5,27 @@ window.wrappedJSObject.timeout_multiplier = %(timeout_multiplier)d; window.wrappedJSObject.explicit_timeout = %(explicit_timeout)d; -window.wrappedJSObject.addEventListener("message", function(event) { - var tests = event.data[0]; - var status = event.data[1]; - clearTimeout(timer); - marionetteScriptFinished({test:"%(url)s", - tests: tests, - status: status.status, - message: status.message, - stack: status.stack}); +window.wrappedJSObject.addEventListener("message", function listener(event) { + if (event.data.type != "complete") { + return; + } + window.wrappedJSObject.removeEventListener("message", listener); + clearTimeout(timer); + var tests = event.data.tests; + var status = event.data.status; + marionetteScriptFinished({test:"%(url)s", + tests: tests, + status: status.status, + message: status.message, + stack: status.stack}); }, false); window.wrappedJSObject.win = window.open("%(abs_url)s", "%(window_id)s"); var timer = null; if (%(timeout)s) { - timer = setTimeout(function() { - log("Timeout fired"); - window.wrappedJSObject.win.timeout(); - }, %(timeout)s); + timer = setTimeout(function() { + log("Timeout fired"); + window.wrappedJSObject.win.timeout(); + }, %(timeout)s); } diff --git a/wptrunner/testharnessreport.js b/wptrunner/testharnessreport.js index 6fa7df1570b5dc..6a79caf753a82a 100644 --- a/wptrunner/testharnessreport.js +++ b/wptrunner/testharnessreport.js @@ -3,7 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ var props = {output:%(output)d, - explicit_timeout: true}; + explicit_timeout: true, + message_events: ["completion"]}; if (window.opener && "timeout_multiplier" in window.opener) { props["timeout_multiplier"] = window.opener.timeout_multiplier;