mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-21 23:58:07 +02:00
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
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue