You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
stream: replace instanceof with cross-realm-safe type checks
Replace all instanceof checks in the `stream/iter` implementation
with cross-realm-safe alternatives from `internal/util/types` and
`internal/util`. Objects created in different VM contexts have
different prototypes, causing `instanceof` to return `false`.
- `instanceof Uint8Array` -> `isUint8Array` (`internal/util/types`)
- `instanceof ArrayBuffer` -> `isArrayBuffer` (`internal/util/types`)
- `instanceof Promise` -> `isPromise` (`internal/util/types`)
- `error instanceof Error` -> `isError` (`internal/util`)
Note: `Error.isError` cannot be used via primordials because V8
flag-gated features (`InitializeGlobal_js_error_iserror` in
`bootstrapper.cc`) are installed after `primordials.js` captures
`Error`'s static methods during snapshot build.
Adds cross-realm tests verifying correct handling of `Uint8Array`,
`ArrayBuffer`, `Uint8Array[]`, `Promise`, and typed array views created
via `vm.runInNewContext`
0 commit comments