Send firefox-dev mailing list submissions to
firef...@mozilla.org
To subscribe or unsubscribe via the World Wide Web, visit
https://mail.mozilla.org/listinfo/firefox-dev
or, via email, send a message with subject or body 'help' to
firefox-d...@mozilla.org
You can reach the person managing the list at
firefox-...@mozilla.org
When replying, please edit your Subject line so it is more specific
than "Re: Contents of firefox-dev digest..."
Today's Topics:
1. Intent to Prototype: Top-Level Await (Yulia Startsev)
----------------------------------------------------------------------
Message: 1
Date: Wed, 2 Dec 2020 18:53:49 +0100
From: Yulia Startsev <
yu...@mozilla.com>
To:
firef...@mozilla.org
Subject: Intent to Prototype: Top-Level Await
Message-ID:
<CAPxDkP-47kt8Jt_Cch8=
VXYKJ8NXnJ4-uZp...@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Summary: Top-level await enables modules to act as big async functions:
With top-level await, ECMAScript Modules (ESM) can await resources, causing
other modules who import them to wait before they start evaluating their
body.
Bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1519100
Standard:
https://tc39.es/proposal-top-level-await/
Platform coverage: All Platforms
Preference: javascript.options.experimental.top_level_await
Other browsers:
* Chrome: intent emailed [1]
* JSC: bug open [2]
web-platform-tests: HTML Integration patch hasn't landed yet [3], and the
tests may need adjustment [4]. This is tracked in the following bug [5].
There are test262 tests [6].
DevTools bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1680259
Link to standards-positions discussion:
https://github.com/mozilla/standards-positions/issues/444
Security & Privacy Concerns: The feature does not expose any new user
information or information about the origin. Modules continue to behave as
before, with the modification that they can now be asynchronous.
How stable is the spec: Stable. Some spec text still needs to be added on
the ECMA-262 side regarding the responsibility of hosts, but this was
covered in test262 tests.
Web designer / developer use-cases AKA Why a developer would use Feature
X?: This feature is only available on modules. Top-level await allows you
to write async code at the top level of a module. This is useful for
developers who use modules on the web (currently a small population) and
especially for those working in local environments like Node. In the
future, it is likely to have more uptake on the web as issues around
bundling are resolved. It may also be useful for Firefox internal usage, as
it cleans up module code for async use cases.
Example: More detailed examples may be found in the explainer [7].
Fetching at the top level of a module might looks like this:
let jQuery;try {
jQuery = await import('
https://cdn-a.com/jQuery');} catch {
jQuery = await import('
https://cdn-b.com/jQuery');}
Please let me know if you run into any issues testing this feature,
and thanks in advance to everyone who has the time to check it/test
it/break it!
Best,
Yulia
----
Links:
1:
https://groups.google.com/u/1/a/chromium.org/g/blink-dev/c/nAkEvjsqQbE/m/ilxfKaQ2CAAJ
2:
https://bugs.webkit.org/show_bug.cgi?id=202484
3:
https://github.com/whatwg/html/pull/4352
4:
https://github.com/whatwg/html/pull/4352
5:
https://bugzilla.mozilla.org/show_bug.cgi?id=1676612
6:
https://github.com/tc39/test262/issues/2218
7:
https://github.com/tc39/proposal-top-level-await#use-cases
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
http://mail.mozilla.org/pipermail/firefox-dev/attachments/20201202/31fc3e60/attachment-0001.html>
------------------------------
Subject: Digest Footer
_______________________________________________
firefox-dev mailing list
firef...@mozilla.org
https://mail.mozilla.org/listinfo/firefox-dev
------------------------------
End of firefox-dev Digest, Vol 96, Issue 3
******************************************