Keep checked browser runtime versions independent of authority upgrades
This commit is contained in:
@@ -104,7 +104,7 @@ export async function readCandidateMetadata(
|
||||
path: string,
|
||||
scope: CandidateMetadataScope,
|
||||
limit: number,
|
||||
): Promise<{ bytes: Uint8Array; releaseInput: () => void }> {
|
||||
): Promise<{ bytes: Uint8Array; releaseInput: () => void; releaseTree: () => void }> {
|
||||
const handle = await open(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
|
||||
let releaseInput: (() => void) | undefined;
|
||||
try {
|
||||
@@ -123,8 +123,8 @@ export async function readCandidateMetadata(
|
||||
if (offset !== stat.size) throw Error("CANDIDATE_METADATA_CHANGED");
|
||||
const content = bytes.subarray(0, offset);
|
||||
// No JSON.parse/decoded tree exists until its shape-based charge succeeds.
|
||||
scope.charge(jsonAllocation(content));
|
||||
return { bytes: content, releaseInput };
|
||||
const releaseTree = scope.reserve(jsonAllocation(content));
|
||||
return { bytes: content, releaseInput, releaseTree };
|
||||
} catch (error) {
|
||||
releaseInput?.();
|
||||
throw error;
|
||||
|
||||
Reference in New Issue
Block a user