mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 02:40:22 -10:00
This patch makes the parser-worker available at the toolbox level. This way, the console does not have to rely on the debugger being open to map top-level await expression. In order to make the worker works in the toolbox, some changes are required (passing a window object, checking inToolbox differently). We take this as an opportunity to *not* display the async iife result, a promise, in the console. This is made by checking if the input was mapped, and if so, ignoring the result we get from the server. A couple tests are added to ensure the basic usage works as expected. This patch should be considered as a v0 for top-level await evaluation as there are things that are not perfect here. Since we rely on console.log the result are treated differently from other evaluation results: - the style is different - the result gets added to the log cache (when restarting the console, the results will still be displayed, but not the commands). - the results can be filtered, although evaluation results should not - `$_` after a top-level await evaluation returns the Promise created by the async iife, not the result that was displayed in the console. All those should be addressed in Bug 1410820. Differential Revision: https://phabricator.services.mozilla.com/D6038