From 4fb3484285d174ac23a1da4432af4de5a87928ba Mon Sep 17 00:00:00 2001 From: johnjbarton Date: Thu, 8 Mar 2018 17:02:54 -0800 Subject: [PATCH] fix(common): Proxy function toString does not contain Proxy. Recent change (https://www.chromestatus.com/feature/5666372071718912) means Proxied functions no longer throw TypeError. Change the test to conform to the new reality. --- common/stringify.js | 4 ++-- test/client/stringify.spec.js | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/common/stringify.js b/common/stringify.js index 6df1d3e97..192a4847a 100644 --- a/common/stringify.js +++ b/common/stringify.js @@ -25,8 +25,8 @@ var stringify = function stringify (obj, depth) { return obj.toString().replace(/\{[\s\S]*\}/, '{ ... }') } catch (err) { if (err instanceof TypeError) { - // Proxy(function abc(...) { ... }) - return 'Proxy(function ' + (obj.name || '') + '(...) { ... })' + // Support older browsers + return 'function ' + (obj.name || '') + '() { ... }' } else { throw err } diff --git a/test/client/stringify.spec.js b/test/client/stringify.spec.js index 603c2df03..e51c85d37 100644 --- a/test/client/stringify.spec.js +++ b/test/client/stringify.spec.js @@ -40,11 +40,8 @@ describe('stringify', function () { // http://caniuse.com/#feat=proxy if (window.Proxy) { it('should serialize proxied functions', function () { - var abcProxy = new Proxy(function abc (a, b, c) { return 'whatever' }, {}) var defProxy = new Proxy(function (d, e, f) { return 'whatever' }, {}) - - assert.deepEqual(stringify(abcProxy), 'Proxy(function abc(...) { ... })') - assert.deepEqual(stringify(defProxy), 'Proxy(function (...) { ... })') + assert.deepEqual(stringify(defProxy), 'function () { ... }') }) }