Skip to content

Commit 05a4534

Browse files
committed
Disable userActivation before executing a setTimeout/setInterval callback
Fixes issue #19850.
1 parent 63e6566 commit 05a4534

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/scripting_api/app.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ class App extends PDFObject {
8888
}
8989

9090
_evalCallback({ callbackId, interval }) {
91+
const documentObj = this._document.obj;
9192
if (callbackId === USERACTIVATION_CALLBACKID) {
9293
// Special callback id for userActivation stuff.
93-
this._document.obj._userActivation = false;
94+
documentObj._userActivation = false;
9495
return;
9596
}
9697
const expr = this._timeoutCallbackIds.get(callbackId);
@@ -99,7 +100,12 @@ class App extends PDFObject {
99100
}
100101

101102
if (expr) {
103+
const saveUserActivation = documentObj._userActivation;
104+
// A setTimeout/setInterval callback is executed so it can't be a user
105+
// choice.
106+
documentObj._userActivation = false;
102107
this._globalEval(expr);
108+
documentObj._userActivation = saveUserActivation;
103109
}
104110
}
105111

0 commit comments

Comments
 (0)