[TASK] Support FLAG_USE_TOP_WINDOW for ESM instructions

Implement top-frame-module loading for ES6 modules.
With RequireJS we could simply invoke top.require(), but
for native ES modules and dynamic import() statements
top.import() is not possible, as import is not a function
but a statement, and therefore not invokable on `top.`.

This has been marked as todo in #96510 as it is a
non trival change that is better implemented in a
separately testable patch.

An event is used that is dispatched on the top document.
It is filled by a global event handler with a promise
that reveals the result of the import() statement
performed in the context of the top frame.

Top frame module loading is used when modals
or notifications are shown in the outer-frame,
therefore EXT:redirect and EXT:install are adapted
to make use of this feture and avoid the prior
RequireJS indirection.

Resolves: #96610
Related: #96510
Related: #96323
Releases: main
Change-Id: I699a7a39beb788c843e3c8292e29bf3db97e8cd9
51 jobs for main.73025.3 in 13 minutes and 57 seconds (queued for 7 seconds)
latest