Description
oxide-browser/src/engine.rs defines WasmEngine and SandboxPolicy — the core compilation and sandboxing layer. It currently has no tests.
This module is critical for security (fuel limits, memory bounds), so test coverage would catch regressions early.
Suggested test cases
- SandboxPolicy defaults — verify
SandboxPolicy::default() returns expected fuel (500M) and memory page limits (256)
- Engine creation —
WasmEngine::new() succeeds with a valid policy
- Module compilation — compile a minimal valid
.wasm module (can use wat::parse_str to create one inline)
- Fuel limit enforcement — a module with an infinite loop should trap after fuel is exhausted
- Memory limit enforcement — a module that tries to grow memory beyond the limit should fail
- Invalid WASM — compiling garbage bytes should return an error, not panic
Files involved
oxide-browser/src/engine.rs — add a #[cfg(test)] mod tests { ... } block
Helpful references
Difficulty
Intermediate — requires basic understanding of wasmtime and WebAssembly concepts.
Description
oxide-browser/src/engine.rsdefinesWasmEngineandSandboxPolicy— the core compilation and sandboxing layer. It currently has no tests.This module is critical for security (fuel limits, memory bounds), so test coverage would catch regressions early.
Suggested test cases
SandboxPolicy::default()returns expected fuel (500M) and memory page limits (256)WasmEngine::new()succeeds with a valid policy.wasmmodule (can usewat::parse_strto create one inline)Files involved
oxide-browser/src/engine.rs— add a#[cfg(test)] mod tests { ... }blockHelpful references
Difficulty
Intermediate — requires basic understanding of wasmtime and WebAssembly concepts.