deno icon indicating copy to clipboard operation
deno copied to clipboard

fix(ext/timers): create primordial `eval`

Open vimirage opened this issue 3 years ago • 2 comments

Includes eval in primordials; this was needed to prevent user modification of timers execution. Alternatively it could've used Deno.core.evalContext?

vimirage avatar Jul 06 '22 22:07 vimirage

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?

vimirage avatar Jul 07 '22 00:07 vimirage

@ry May you review this again?

vimirage avatar Jul 26 '22 04:07 vimirage

@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?

bartlomieju avatar Jul 31 '22 20:07 bartlomieju

@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?

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?)

vimirage avatar Jul 31 '22 23:07 vimirage

Checks pass, this should be clear to merge.

vimirage avatar Sep 02 '22 15:09 vimirage