Bug 1359725 - add timeout to LoadInitData() in eme.js.
So we can cancel the bad test as soon as possible and give a better description about the error.
MozReview-Commit-ID: ExKIK2HqJkN
--- a/dom/media/test/eme.js
+++ b/dom/media/test/eme.js
@@ -315,22 +315,28 @@ function CreateAndSetMediaKeys(v, test,
* Collect the init data from 'encrypted' events.
* Return a promise which will be resolved with the init data when collection
* is completed (specified by test.sessionCount).
*/
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);
}
}
v.addEventListener("encrypted", onencrypted);
return p.promise;
}
/*