mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 17:30:09 +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.
|
* Promise that is resolved when DOM window becomes visible.
|
||||||
*/
|
*/
|
||||||
let animationStarted = new Promise(function (resolve) {
|
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);
|
window.requestAnimationFrame(resolve);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue