Skip to content

Commit

Permalink
Fix xhr check in setup function of functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dsilhavy committed Jun 21, 2021
1 parent 7172093 commit 0150631
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions test/functional/tests/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,31 @@ module.exports = {
},

checkIfFileExits: function (url, done) {
var xhr = new XMLHttpRequest();
xhr.open('GET', url, false);
xhr.onload = function() {
if (xhr.status >= 200 && xhr.status <= 299) {
try {
var xhr = new XMLHttpRequest();

xhr.addEventListener("load", transferComplete);
xhr.addEventListener("error", transferFailed);
xhr.addEventListener("abort", transferCanceled);

xhr.open("GET", url);
xhr.send();


function transferComplete() {
done(true);
} else {
}

function transferFailed() {
done(false);
}

function transferCanceled() {
done(false);
}
} catch (e) {
done(false);
}
xhr.send();
},

generateSeekPos: function(duration) {
Expand Down

0 comments on commit 0150631

Please sign in to comment.