fix: more hardens
MODIFY
packages/captp/src/atomics.js
packages/captp/src/atomics.js
@@ -44,7 +44,7 @@ const splitTransferBuffer = transferBuffer => {
databuf.byteLength >= MIN_DATA_BUFFER_LENGTH,
X`Transfer buffer of size ${transferBuffer.byteLength} only supports ${databuf.byteLength} data bytes; need at least ${MIN_DATA_BUFFER_LENGTH}`,
);
- return { statusbuf, lenbuf, databuf };
+ return harden({ statusbuf, lenbuf, databuf });
};
/**

MODIFY
packages/promise-kit/src/memo-race.js
packages/promise-kit/src/memo-race.js
@@ -79,7 +79,7 @@ const getMemoRecord = value => {
// weakmap would throw an error. Luckily, it is safe to call
// `Promise.resolve(contender).then` on a primitive value multiple times
// because the promise fulfills immediately. So we fake a settled record.
- return { settled: true };
+ return harden({ settled: true });
}
let record = knownPromises.get(value);

MODIFY
packages/promise-kit/src/promise-executor-kit.js
packages/promise-kit/src/promise-executor-kit.js
@@ -51,6 +51,6 @@ export const makeReleasingExecutorKit = () => {
internalReject = rej;
};
- return { resolve, reject, executor };
+ return harden({ resolve, reject, executor });
};
harden(makeReleasingExecutorKit);

MODIFY
packages/ses/src/tame-function-constructors.js
packages/ses/src/tame-function-constructors.js
@@ -49,7 +49,7 @@ export default function tameFunctionConstructors() {
FERAL_FUNCTION.prototype.constructor('return 1');
} catch (ignore) {
// Throws, no need to patch.
- return {};
+ return harden({});
}
const newIntrinsics = {};

MODIFY
packages/static-module-record/src/transform-analyze.js
packages/static-module-record/src/transform-analyze.js
@@ -160,7 +160,7 @@ export const makeModuleTransformer = (babel, importer) => {
? maybeSource.slice(0, -1)
: maybeSource;
- return { ...ss, endowments, src: actualSource };
+ return harden({ ...ss, endowments, src: actualSource });
},
};
};

fix: more hardens (#1241)