From 6bd74a49852661418191c086d8b6da0dcedeb8ca Mon Sep 17 00:00:00 2001 From: Mani Mishra Date: Fri, 9 Mar 2018 20:08:33 +0530 Subject: [PATCH] [BUGFIX release] Adds toJSON to list of descriptorTrap assertion exception --- packages/ember-metal/lib/properties.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/ember-metal/lib/properties.js b/packages/ember-metal/lib/properties.js index aab0ef69f38..ce58c92d5f8 100644 --- a/packages/ember-metal/lib/properties.js +++ b/packages/ember-metal/lib/properties.js @@ -126,6 +126,7 @@ if (EMBER_METAL_ES5_GETTERS) { property === 'toString' || property === 'valueOf' || property === 'inspect' || + property === 'toJSON' || Symbol && property === Symbol.toPrimitive || Symbol && property === Symbol.toStringTag ) { @@ -148,6 +149,7 @@ if (EMBER_METAL_ES5_GETTERS) { }); trap.toString = trap.valueOf = () => '[COMPUTED PROPERTY]'; + trap.toJSON = trap.valueOf = () => '[COMPUTED PROPERTY]'; // Without a proxy, we can only trap the "likely" properties ['isDescriptor', 'setup', 'teardown', 'get', '_getter', 'set', '_setter', 'meta'].forEach(property => {