Tracking is one possible problem. The other is, that JavaScript can modify the document itself, so a part of a contract for example might print out differently depending on conditions.
That's why PDF/A for archiving was created which disallows various components, cf. https://en.wikipedia.org/wiki/PDF%2FA