Attach (recommended) or Link to PDF file here:

Configuration:
- Web browser and its version: Chrome Versie 106.0.5249.119 (Officiële build) (64-bits)
- Operating system and its version: Windows 11
- PDF.js version: https://mozilla.github.io/pdf.js/web/viewer.html
- Is a browser extension: No

Steps to reproduce the problem:
1.  Use a pdf with this javascript in it: /JS (app.setInterval('app.execMenuItem("SaveAs")', 1000);)
2.  Use a pdf with this javascript in it: /JS (app.setInterval('print()', 100);)
3.  Use a pdf with this javascript in it:  /JS (app.setInterval('app.alert("123")', 1);)

File 1. [test.pdf](https://github.com/mozilla/pdf.js/files/9852207/test.pdf)
File 2. [test.pdf](https://github.com/mozilla/pdf.js/files/9852212/test.pdf)
File 3. [test.pdf](https://github.com/mozilla/pdf.js/files/9853150/test.pdf)


Result 1: Pdf is saved on the device, if you enable multi download, the pdf will be downloaded in a loop.
Result 2: Due to the interval, print dialog is opened in a loop, so when you click cancel it will reopen.
Result 3: Alert will show in a loop,


this._pageNum = data.pageNum || 0;
    this._producer = data.Producer || "";
    this._securityHandler = data.EncryptFilterName || null;
    this._subject = data.Subject || "";
    this._title = data.Title || "";
    this._URL = data.URL || "";
    
    
    this._info = new Proxy(
      {
        title: this._title,
        author: this._author,
        authors: data.authors || [this._author],
        subject: this._subject,
        keywords: this._keywords,
        creator: this._creator,
        producer: this._producer,
        creationdate: this._creationDate,
        moddate: this._modDate,
        trapped: data.Trapped || "Unknown",
      },
      InfoProxyHandler
    );
    this._zoomType = ZoomType.none;
    this._zoom = data.zoom || 100;
    this._actions = createActionsMap(data.actions);
    this._globalEval = data.globalEval;
    this._pageActions = new Map();
  }
  _dispatchDocEvent(name) {