Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(zone.js): read
Symbol.species
safely (#45369)
We must read `Symbol.species` safely because `this` may be anything. For instance, `this` may be an object without a prototype (created through `Object.create(null)`); thus `this.constructor` will be undefined. One of the use cases is SystemJS creating prototype-less objects (modules) via `Object.create(null)`. The SystemJS creates an empty object and copies promise properties into that object (within the `getOrCreateLoad` function). The zone.js then checks if the resolved value has the `then` method and invokes it with the `value` context. Otherwise, this will throw an error: `TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.species)')`. PR Close #45369
- Loading branch information
Showing
2 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters