From 008e549933afa05d4849925f503839fd51e5b758 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Mon, 30 Oct 2017 11:49:22 -0700 Subject: [PATCH] Move Map/Set polyfills to top MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Moves initialization of `Map` and `Set` polyfills to the top of `InitializeCore` to avoid problems with JSC versions that don’t accept (or silently ignore) iterables as constructor arguments. Reviewed By: mjesun Differential Revision: D6185632 fbshipit-source-id: 3abe4baeb3a08c328d8c6b3bb1b2e01716c2c95c --- Libraries/Core/InitializeCore.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index 0006ee12ce..90e9360cb9 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -38,6 +38,15 @@ if (global.window === undefined) { const defineLazyObjectProperty = require('defineLazyObjectProperty'); +// Set up collections +const _shouldPolyfillCollection = require('_shouldPolyfillES6Collection'); +if (_shouldPolyfillCollection('Map')) { + polyfillGlobal('Map', () => require('Map')); +} +if (_shouldPolyfillCollection('Set')) { + polyfillGlobal('Set', () => require('Set')); +} + /** * Sets an object's property. If a property with the same name exists, this will * replace it but maintain its descriptor configuration. The property will be @@ -120,15 +129,6 @@ if (!global.__fbDisableExceptionsManager) { const ReactNativeVersionCheck = require('ReactNativeVersionCheck'); ReactNativeVersionCheck.checkVersions(); -// Set up collections -const _shouldPolyfillCollection = require('_shouldPolyfillES6Collection'); -if (_shouldPolyfillCollection('Map')) { - polyfillGlobal('Map', () => require('Map')); -} -if (_shouldPolyfillCollection('Set')) { - polyfillGlobal('Set', () => require('Set')); -} - // Set up Promise // The native Promise implementation throws the following error: // ERROR: Event loop not supported.