Skip to content
Branch: master
Find file History
mleibman and mhevery feat(core): Add an option '__Zone_symbol_prefix' to set symbol prefix…
… used in Zone.__symbol__(). (#1219)

* feat(core): Add an option '__Zone_symbol_prefix' to set symbol prefix used in Zone.__symbol__().

Add a global environment option `__Zone_symbol_prefix` to allow configuring the symbol prefix Zone.js uses to store its state data on objects.

This is needed in situations where multiple instances of Zone.js may 'touch' the same object or DOM node, accessing and clobbering the other instance's data stored there, and causing unpredictable behavior. Ultimately, it would be nice if Zone.js used proper ES6 symbols or some unique idetifier as a prefix, but many products rely on being able to access the data stored by it.

This change adds the env option and cleans up all hard-coded references to '__zone_symbol_XXX' to go through `Zone.__symbol__()`. In order to test the changes and protect against regressions, the tests are run with the symbol prefix changed to `__zone_symbol_test__`.

While the primary purpose of this change is to be able to isolate data stored on the objects & DOM nodes, some global environment options are also specified with the `__zone_symbol__` prefix and not the usual `__Zone_` one. The current API for providing env options isn't very consistent. For example, disabling 'on<X>' property patching is done via `__Zone_ignore_on_properties`, w/o using the symbol prefix, while disabling event patching is done via `__zone_symbol__UNPATCHED_EVENTS`, using the symbol prefix. This change only affects the options that are prefixed with `__zone_symbol__`.

* Fix failing karma test.

* Remove trailing whitespace.

* Bump up the file size limiit.
Latest commit 22b9937 May 13, 2019
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
browser feat(core): Add an option '__Zone_symbol_prefix' to set symbol prefix… May 14, 2019
closure fix(core): remove unreadable short names Jan 10, 2018
common feat(core): Add an option '__Zone_symbol_prefix' to set symbol prefix… May 14, 2019
extra fix(bluebird): fix #1112, bluebird chained callback should return a B… Jul 27, 2018
jasmine feat(core): Add an option '__Zone_symbol_prefix' to set symbol prefix… May 14, 2019
mix fix(patch): fix #744, add namespace to load patch name (#774) May 19, 2017
mocha fix(test): fix #1155, try/catch modify error.message (#1157) Mar 12, 2019
node build: seperate zone.js into evergreen only and legacy included bundles. Feb 24, 2019
rxjs build: upgrade to typescript 3.2.2 (#1199) Mar 12, 2019
testing
zone-spec fix: fakeAsyncTest requestAnimationFrame should pass timestamp as par… Apr 9, 2019
zone.ts feat(core): Add an option '__Zone_symbol_prefix' to set symbol prefix… May 14, 2019
You can’t perform that action at this time.