Skip to content

Commit 95c4972

Browse files
committed
vfs: restore sea.js to match upstream main
sea.js was treating isSea as a boolean property, but the C++ binding was restored to expose isSea as a function. This mismatch caused getAssetKeys() to crash with a C++ assertion failure when called outside a SEA, because the JS guard `if (!isSeaFlag)` never triggered (a function reference is always truthy). Restore sea.js from upstream/main to use isSea() as a function call.
1 parent 58ddce9 commit 95c4972

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

lib/sea.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const {
33
ArrayBufferPrototypeSlice,
44
} = primordials;
55

6-
const { isSea: isSeaFlag, getAsset: getAssetInternal, getAssetKeys: getAssetKeysInternal } = internalBinding('sea');
6+
const { isSea, getAsset: getAssetInternal, getAssetKeys: getAssetKeysInternal } = internalBinding('sea');
77
const { TextDecoder } = require('internal/encoding');
88
const { validateString } = require('internal/validators');
99
const {
@@ -23,7 +23,7 @@ const { Blob } = require('internal/blob');
2323
function getRawAsset(key) {
2424
validateString(key, 'key');
2525

26-
if (!isSeaFlag) {
26+
if (!isSea()) {
2727
throw new ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION();
2828
}
2929

@@ -74,17 +74,13 @@ function getAssetAsBlob(key, options) {
7474
* @returns {string[]}
7575
*/
7676
function getAssetKeys() {
77-
if (!isSeaFlag) {
77+
if (!isSea()) {
7878
throw new ERR_NOT_IN_SINGLE_EXECUTABLE_APPLICATION();
7979
}
8080

8181
return getAssetKeysInternal() || [];
8282
}
8383

84-
function isSea() {
85-
return isSeaFlag;
86-
}
87-
8884
module.exports = {
8985
isSea,
9086
getAsset,

0 commit comments

Comments
 (0)