Closed
Bug 1498300
Opened 7 years ago
Closed 7 years ago
await does not work in Browser Console
Categories
(DevTools :: General, defect, P1)
Tracking
(firefox64 fixed)
RESOLVED
FIXED
Firefox 64
Tracking | Status | |
---|---|---|
firefox64 | --- | fixed |
People
(Reporter: mythmon, Assigned: nchevobbe)
References
Details
(Whiteboard: [good first verify])
Attachments
(1 file)
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.
Comment 1•7 years ago
|
||
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?
Flags: needinfo?(nchevobbe)
Assignee | ||
Comment 2•7 years ago
|
||
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.
Flags: needinfo?(nchevobbe)
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Priority: -- → P1
Assignee | ||
Comment 3•7 years ago
|
||
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 nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/21f2d2802b18
Add top-level await support to the Browser Console; r=bgrins.
Comment 5•7 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
Updated•7 years ago
|
Whiteboard: [good first verify]
You need to log in
before you can comment on or make changes to this bug.
Description
•