Skip to content

Request constructor ignores non-null window option instead of throwing #5209

@HiteshShonak

Description

@HiteshShonak

Describe the bug
new Request() silently accepts any value for the window option instead of throwing a TypeError. the Fetch Standard says window must be null - anything else should throw.

To Reproduce

new Request("https://example.com", { window: 1 })
// no error in Boa, expected TypeError

new Request("https://example.com", { window: "test" })
// no error in Boa, expected TypeError

From repo root:

cargo run --bin boa -- -e 'try { new Request("https://example.com", { window: 1 }); console.log("OK"); } catch (e) { console.log(e.name + ": " + e.message); }'

Boa output:

OK

Node.js output:

node -e 'try { new Request("https://example.com", { window: 1 }); console.log("OK"); } catch (e) { console.log(e.name + ": " + e.message); }'
# TypeError: 'window' option 'client' must be null

Expected behavior
new Request() should throw a TypeError when window is any non-null value. window: null and omitting window should still work fine.

Build environment:

  • OS: Windows 11
  • Version: 10.0.26200
  • Target triple: x86_64-pc-windows-msvc
  • Rustc version: rustc 1.94.0 (4a4ef493e 2026-03-02)

Additional context
Root cause is in core/runtime/src/fetch/request.rs - RequestInit has no window field so any value passed is silently ignored.

Spec reference: https://fetch.spec.whatwg.org/#dom-request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions