Skip to content

Conversation

@samhocevar
Copy link
Contributor

The first fix is also present upstream: see js_fs.go. According to the comment, it is here because Node.js 8 fs.utimes() can call the callback without arguments.

The first fix also protects against the BrowserFS project’s almost 50 code locations where a callback is called without arguments:

The second commit is an additional safety against the callback argument being undefined instead of null. Again, this happens in the BrowserFS project: FS.close() creates a callback that passes its argument to the GopherJS-provided callback, however since the underlying NoSyncFile.close() calls cb() instead of cb(null), this becomes undefined back in GopherJS’s fsCall() and the call to mapJSError() will throw.

@nevkontakte
Copy link
Member

Hehe, I distinctly remember not including this fix into our overlays because there's no way anyone would be using Node 8 these days. Oh well :)

Could you please add a brief comment to the if condition about BrowserFS and referencing this PR? Git blame gets difficult to trace after a while and overlay code tends to get updated fairly regularly. Other than that, this change looks good to me.

@samhocevar
Copy link
Contributor Author

I added an explanatory comment to the code section.

@nevkontakte nevkontakte merged commit 1497816 into gopherjs:master May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants