feat(core): add Trusted Types workaround for Function constructor (#39209)
feat(core): add Trusted Types workaround for Function constructor (#39209)

Chrome currently does not support passing TrustedScript to the Function
constructor, and instead fails with a Trusted Types violation when
called. As the Function constructor is used in a handful of places
within Angular, such as in the JIT compiler and named_array_type, the
workaround proposed on the following page is implemented:
https://github.com/w3c/webappsec-trusted-types/wiki/Trusted-Types-for-function-constructor

To be precise, it constructs a string representing an anonymous function
in a way that is equivalent to what the Function constructor does,
promotes it to a TrustedScript and then calls eval.

To facilitate backwards compatibility, new Function is used directly in
environments that do not support Trusted Types.

PR Close #39209

gkalpak/angular,ocombe/angular,alxhub/angular,IdeaBlade/angular,manekinekko/angular,JiaLiPassion/angular,blesh/angular,alxhub/angular,shairez/angular,IdeaBlade/angular,manekinekko/angular,mgechev/angular,angular/angular,brandonroberts/angular,shairez/angular,blesh/angular,angular/angular,blesh/angular,JiaLiPassion/angular,alxhub/angular,alxhub/angular,brandonroberts/angular,angular/angular,IdeaBlade/angular,angular-indonesia/angular,blesh/angular,manekinekko/angular,gkalpak/angular,brandonroberts/angular,gnomeontherun/angular,IdeaBlade/angular,mgechev/angular,alxhub/angular,brandonroberts/angular,brandonroberts/angular,shairez/angular,ocombe/angular,ocombe/angular,manekinekko/angular,angular-indonesia/angular,gkalpak/angular,mgechev/angular,blesh/angular,angular-indonesia/angular,gkalpak/angular,shairez/angular,mgechev/angular,JiaLiPassion/angular,angular-indonesia/angular,manekinekko/angular,brandonroberts/angular,gnomeontherun/angular,JiaLiPassion/angular,ocombe/angular,gnomeontherun/angular,mgechev/angular,manekinekko/angular,gnomeontherun/angular,ocombe/angular,IdeaBlade/angular,shairez/angular,ocombe/angular,angular/angular