Skip to content

Polyfill refuses to initialize when AbortController is a subclass #7638

Description

@MaXal

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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