From abcc4b010f6fc733036e775fc52bde32457ac22c Mon Sep 17 00:00:00 2001 From: dionisnote Date: Fri, 18 Sep 2020 19:46:54 +0400 Subject: [PATCH 1/2] fix: Added check for specific symbols in polyfills/symbols --- src/polyfills/symbols.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/polyfills/symbols.js b/src/polyfills/symbols.js index f7e532e45b..4e7c9a26c9 100644 --- a/src/polyfills/symbols.js +++ b/src/polyfills/symbols.js @@ -1,13 +1,19 @@ // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_ITERATOR: string = - typeof Symbol === 'function' ? Symbol.iterator : '@@iterator'; + typeof Symbol === 'function' && Boolean(Symbol.iterator) + ? Symbol.iterator + : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_ASYNC_ITERATOR: string = - typeof Symbol === 'function' ? Symbol.asyncIterator : '@@asyncIterator'; + typeof Symbol === 'function' && Boolean(Symbol.asyncIterator) + ? Symbol.asyncIterator + : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_TO_STRING_TAG: string = - typeof Symbol === 'function' ? Symbol.toStringTag : '@@toStringTag'; + typeof Symbol === 'function' && Boolean(Symbol.toStringTag) + ? Symbol.toStringTag + : '@@toStringTag'; From 007f17e850d83313d94d6a5ec829576bf2de82fd Mon Sep 17 00:00:00 2001 From: Ivan Goncharov Date: Sun, 20 Sep 2020 16:17:26 +0300 Subject: [PATCH 2/2] review fixes --- src/polyfills/symbols.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/polyfills/symbols.js b/src/polyfills/symbols.js index 4e7c9a26c9..e13d8b4f3a 100644 --- a/src/polyfills/symbols.js +++ b/src/polyfills/symbols.js @@ -1,19 +1,19 @@ // In ES2015 (or a polyfilled) environment, this will be Symbol.iterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_ITERATOR: string = - typeof Symbol === 'function' && Boolean(Symbol.iterator) + typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_ASYNC_ITERATOR: string = - typeof Symbol === 'function' && Boolean(Symbol.asyncIterator) + typeof Symbol === 'function' && Symbol.asyncIterator != null ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317') export const SYMBOL_TO_STRING_TAG: string = - typeof Symbol === 'function' && Boolean(Symbol.toStringTag) + typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag';