Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firefox doesn't support comments in provided async function #32

Open
JamesMilnerUK opened this issue May 25, 2018 · 2 comments

Comments

@JamesMilnerUK
Copy link

commented May 25, 2018

More just an observation than a bug; Firefox doesn't appear to handle comments inside of the passed async function. This appears to be because it puts all the code onto one line which causes the parsing to break via a SyntaxError i.e.:

SyntaxError: missing } after function body
data:$$=async%20(data,%20stringify)%20=>%20{//%20Commentif%20(stringify)%20{data%20=%20JSON.parse(da:1:416
note: { opened at line 1, column 30

in short, this will cause an error:

	const exampleAsyncFunc = async (data) => {
            // A wild comment appears
 	    return data
	}

but this does not:

	const exampleAsyncFunc = async (data) => {
 	    return data
	}

@JamesMilnerUK JamesMilnerUK changed the title Firefox doesn't support comments in async function Firefox doesn't support comments in provided async function May 25, 2018

@developit

This comment has been minimized.

Copy link
Owner

commented Jun 5, 2018

Looks like the fix here is to just manually encode the URI instead of letting the browser do it.
We could potentially even just apply it to asyncFunction here:

'data:,$$='+asyncFunction+';onmessage='+(e => {

@developit

This comment has been minimized.

Copy link
Owner

commented Sep 3, 2018

Update: if we switch back to Blob URLs to address the CSP issues, this error goes away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.