Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Add SharedArrayBuffer/COOP-COEP verification for WASM streaming #13

Description

@noahgift

Problem

WASM applications using SharedArrayBuffer (required for multi-threaded WASM) need Cross-Origin-Opener-Policy (COOP) and Cross-Origin-Embedder-Policy (COEP) headers. Currently there's no way to:

  1. Verify COOP/COEP headers are correctly set
  2. Test that SharedArrayBuffer is available in the page context
  3. Validate Web Worker communication works

Proposed Solution

Add WasmCapabilities verification:

pub struct WasmCapabilities {
    pub shared_array_buffer: bool,
    pub atomics: bool,
    pub threads: bool,
    pub simd: bool,
}

impl WasmCapabilities {
    /// Check browser capabilities via CDP
    pub async fn detect(page: &Page) -> ProbarResult<Self>;
    
    /// Assert required capabilities are available
    pub fn assert_streaming_ready(&self) -> ProbarResult<()> {
        if !self.shared_array_buffer {
            return Err(ProbarError::MissingCapability(
                "SharedArrayBuffer not available. Check COOP/COEP headers."
            ));
        }
        Ok(())
    }
}

Use Cases

  1. Streaming WASM Apps: whisper.apr requires SharedArrayBuffer for audio processing
  2. COOP/COEP Header Validation: Ensure server is correctly configured
  3. Capability Detection: Skip tests that require unavailable features

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions