fix(ext/timers): create primordial `eval`
Includes eval in primordials; this was needed to prevent user modification of timers execution.
Alternatively it could've used Deno.core.evalContext?
could you add a test?
Sure!
I'm trying to write a test case that has a string which simply resolves a globalPromise: Deferred variable, but I'm not sure how to assert that it actually resolves within the testcase. May I have any suggestions from yourself?
I wouldn't want to introduce a flaky test, and I'm not sure if Promise.race against another timeout would be reliable, considering the tests, well.. test the timers?
@ry May you review this again?
@Phosra any chance you could update prefer-primordials rule in deno_lint, so we are guarded against accidental mistakes of using eval from a global scope?
@Phosra any chance you could update
prefer-primordialsrule indeno_lint, so we are guarded against accidental mistakes of usingevalfrom a global scope?
I opened an issue about it there about a week ago: https://github.com/denoland/deno_lint/issues/1062.
I wasn't certain how rules such as Set -> primordials.SafeSet were handled, so I held off, but sure - I can make an attempt anyways.
(Nonetheless, must that hold off this bug fix?)
Checks pass, this should be clear to merge.