2d21ca796a
Feature-test for `self` and `globalThis`, and cache the result. The cached access has smaller minified code size than either `self` or `globalThis`. All older browsers that we have supported that don't have `globalThis` do have `self`. We prioritize `self` over `globalThis`. They are usually the same but it is possible that there are programs which run in an environment that has replaced `self`, for example, a test might do that. We don't want to break existing tests. Bug: #59982 Change-Id: I11d19183d85a73e9552b66a2f49ac99be10c3c83 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417912 Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Stephen Adams <sra@google.com>