Bug 1024668 - Wait for initial payload event in healthreport_testRemoteCommands.html. r=wchen

This commit is contained in:
Birunthan Mohanathas 2014-07-14 12:35:30 -07:00
parent 783094e166
commit 441a41885e

View File

@ -5,8 +5,19 @@
<script>
function init() {
window.addEventListener("message", function process(e) {doTest(e)}, false);
doTest();
window.addEventListener("message", function process(e) {
// The init function of abouthealth.js schedules an initial payload event,
// which will be sent after the payload data has been collected. This extra
// event can cause unexpected successes/failures in this test, so we wait
// for the extra event to arrive here before progressing with the actual
// test.
if (e.data.type == "payload") {
window.removeEventListener("message", process, false);
window.addEventListener("message", doTest, false);
doTest();
}
}, false);
}
function checkSubmissionValue(payload, expectedValue) {