Bug 1359725 - add timeout to LoadInitData() in eme.js. r=gerald

So we can cancel the bad test as soon as possible and give a better description about the error.

MozReview-Commit-ID: ExKIK2HqJkN

--HG--
extra : rebase_source : 26391dfea33ab792cc5f0dc58fa42e6309e0c699
extra : source : 138125800895658a6feb88e3f90487d62b955f6a
This commit is contained in:
JW Wang 2017-04-26 16:22:08 +08:00
Родитель 54ae314fcc
Коммит 1915d358a7
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -320,12 +320,18 @@ function LoadInitData(v, test, token) {
let p = new EMEPromise;
let initDataQueue = [];
// Call SimpleTest._originalSetTimeout() to bypass the flaky timeout checker.
let timer = SimpleTest._originalSetTimeout.call(window, () => {
p.reject(`${token} Timed out in waiting for the init data.`);
}, 60000);
function onencrypted(ev) {
initDataQueue.push(ev);
Log(token, `got encrypted(${ev.initDataType}, ` +
`${StringToHex(ArrayBufferToString(ev.initData))}) event.`);
if (test.sessionCount == initDataQueue.length) {
p.resolve(initDataQueue);
clearTimeout(timer);
}
}