Prevent "ReferenceError: window is not defined" errors, from web/ui_utils.js
, when running the unit-tests in Node.js/Travis
This commit is contained in:
parent
2921cc0eba
commit
dcc7f33ee7
@ -681,6 +681,13 @@ function waitOnEventOrTimeout({ target, name, delay = 0, }) {
|
||||
* Promise that is resolved when DOM window becomes visible.
|
||||
*/
|
||||
let animationStarted = new Promise(function (resolve) {
|
||||
if ((typeof PDFJSDev !== 'undefined' && PDFJSDev.test('LIB')) &&
|
||||
typeof window === 'undefined') {
|
||||
// Prevent "ReferenceError: window is not defined" errors when running the
|
||||
// unit-tests in Node.js/Travis.
|
||||
setTimeout(resolve, 20);
|
||||
return;
|
||||
}
|
||||
window.requestAnimationFrame(resolve);
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user