46 bytes, text/x-phabricator-request
|Details | Review|
Although `await 42;` works as expected in the Web Console, the Browser Toolbox, and the Browser Content Toolbox (printing 42), in the Browser Console it returns the error "SyntaxError: await is only valid in async functions and async generators". STR: 1. Open the Browser Console (Tools > Web Developer > Browser Console, or Ctrl+Shift+J on Linux) 2. Type "await 42;" and press enter. Expected: The console prints "42". Actual: The console prints an error. This might be a dupe of bug 1494726, but I'm not sure where the error happened in that bug.
This isn't a dupe of bug 1494726, it's a separate issue. The problem is that the parser worker is fetched through the toolbox object, and when we are in the Browser Console there's no toolbox available. I hope that we can expose parser-worker as a separate module that could be accessed from the webconsole (or any other tool that wants to use it) directly. Nicolas, is there a technical reason the parserService needs to be exposed through the toolbox and couldn't be used by a window like the Browser Console directly? https://searchfox.org/mozilla-central/rev/1ce4e8a5601da8e744ca6eda69e782318afab54d/devtools/client/framework/toolbox.js#691. IOW: do we need the debugger frontend or backend to be available for that to work, or is it independent?
We don't need the debugger frontend at all, only the parser worker. It was put on the toolbox as `parserService` so it could be use across all panels, but as you say, the browser console does not have a toolbox. I think this could be fixed, I'll have a look soon.
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: -- → P1
This patch moves the parserService from the toolbox, which isn't accessible in the case of the Browser Console, to the console itself. A lightweight test is added to ensure top-level await is supported in the browser console.
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/21f2d2802b18 Add top-level await support to the Browser Console; r=bgrins.
Status: ASSIGNED → RESOLVED
Last Resolved: 5 months ago
status-firefox64: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
You need to log in before you can comment on or make changes to this bug.