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

Simplify wasmfs ErrnoError. NFC #23725

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/lib/libfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ FS.staticInit();
#if FS_DEBUG
trackingDelegate: {},
#endif
ErrnoError: null, // set during init
filesystems: null,
syncFSRequests: 0, // we warn if there are multiple in flight at once
#if expectToReceiveOnModule('logReadFiles')
Expand Down
22 changes: 6 additions & 16 deletions src/lib/libwasmfs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ addToLibrary({
$wasmFSDevices: {},
$wasmFSDeviceStreams: {},

$FS__postset: `
FS.init();
`,
$FS__deps: [
'$MEMFS',
'$wasmFSPreloadedFiles',
Expand Down Expand Up @@ -74,10 +71,13 @@ FS.init();
#endif
],
$FS : {
init() {
FS.ensureErrnoError();
ErrnoError: class extends Error {
name = 'ErrnoError';
message = 'FS error';
constructor(code) {
this.code = code
}
},
ErrnoError: null,
handleError(returnValue) {
// Assume errors correspond to negative returnValues
// since some functions like _wasmfs_open() return positive
Expand All @@ -88,16 +88,6 @@ FS.init();

return returnValue;
},
ensureErrnoError() {
if (FS.ErrnoError) return;
FS.ErrnoError = /** @this{Object} */ function ErrnoError(code) {
this.errno = code;
this.message = 'FS error';
this.name = "ErrnoError";
}
FS.ErrnoError.prototype = new Error();
FS.ErrnoError.prototype.constructor = FS.ErrnoError;
},
createDataFile(parent, name, fileData, canRead, canWrite, canOwn) {
FS_createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
},
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9269
9271
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9277
9276