[Trusted Types] Support eval(TT) when TT Is enforced.

Reintroduce the modifying hook with the new signature. Scripts are executed if both TT and CSP allow them, otherwise throw an EvalError and send reports as side-effects.

Non-string, non-trusted values are passed through, and skip any TT default policy.

eval(TT) still returns the object if TT enforcement is disabled, for now. This is because unconditional codegen from strings overrides our callback.

Bug: 940927
Change-Id: I718694cc050cf071a2ccf9669543628cf568cbdc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768427
Commit-Queue: Stefano Sanfilippo <[email protected]>
Reviewed-by: Mike West <[email protected]>
Reviewed-by: Daniel Vogelheim <[email protected]>
Cr-Commit-Position: refs/heads/master@{#714283}
10 files changed