feat(anatomy): text and output caps, hostile corpus through the shipped wasm within budgets; SheetSession poisons on non-closed throws
This commit is contained in:
1 parent
842797b440
commit
43a370aed1
8 files changed
+227
-6
No files matched your search
@@ -143,5 +143,29 @@ describe('core runtime', () => {
|
||||
expect(outcome).toMatchObject({ ok: false, kind: 'invalid_sheet' })
|
||||
expect(runtime.status).toBe('ready')
|
||||
expect(runtime.sheet(BUNDLE).open()).toEqual({ ok: true, value: null })
|
||||
// Not JSON at all: a closed refusal too (invalid_json), not a poison.
|
||||
expect(runtime.sheet('not json').open()).toMatchObject({ ok: false, kind: 'invalid_sheet' })
|
||||
expect(runtime.status).toBe('ready')
|
||||
})
|
||||
|
||||
it('poisons the instance when the handle constructor throws anything but a closed refusal', async () => {
|
||||
const inner = nodeCoreSource('pkg')
|
||||
const source: CoreSource = {
|
||||
compile: () => inner.compile(),
|
||||
importGlue: async (n) => {
|
||||
const glue = await inner.importGlue(n)
|
||||
// An engine stack overflow reaches JavaScript as a RangeError (V8).
|
||||
class ThrowingHandle {
|
||||
constructor() {
|
||||
throw new RangeError('Maximum call stack size exceeded')
|
||||
}
|
||||
}
|
||||
return n === 1 ? ({ ...glue, SheetHandle: ThrowingHandle } as unknown as GlueModule) : glue
|
||||
},
|
||||
}
|
||||
const runtime = new CoreRuntime(source)
|
||||
await runtime.ready()
|
||||
expect(runtime.sheet(BUNDLE).open()).toMatchObject({ ok: false, kind: 'internal' })
|
||||
expect(runtime.status).not.toBe('ready')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user