ReactiveX / ReactiveX/rxjs

Polyfill refuses to initialize when AbortController is a subclass

Open
#7,638 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

Replacing globalThis.AbortController with a subclass of the native constructor makes importing rxjs throw, even though AbortController.prototype.abort is inherited and callable.

Expected behavior

Save the following as repro.mjs in an empty directory, then run:

npm install rxjs@9.0.0-beta.0
node repro.mjs

This reproduction does not require happy-dom.

const Native = globalThis.AbortController
class WindowAbortController extends Native {}
globalThis.AbortController = WindowAbortController

console.log(Object.getOwnPropertyDescriptor(WindowAbortController.prototype, "abort")) // undefined
console.log(typeof WindowAbortController.prototype.abort)                              // "function"

await import("rxjs")

Output (stack trace omitted):

undefined
function
TypeError: Cannot initialize @rxjs/observable-polyfill: AbortController.prototype.abort is unavailable

Expected: importing rxjs succeeds when AbortController.prototype.abort is inherited and callable.

Reproduction code

Reproduction URL

No response

Version

@rxjs/observable-polyfill 9.0.0-beta.0 via rxjs 9.0.0-beta.0

Environment

Node 26.8.2

Additional context

Also observed under vitest 5 with environment: "happy-dom" (happy-dom 20.14.5).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run repro.mjs with rxjs@9.0.0-beta.0 and start at the @rxjs/observable-polyfill initialization reached by importing rxjs. Trace the AbortController.prototype.abort check and verify that an inherited callable method allows the import to succeed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
Half a day
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.