Skip to content

Commit

Permalink
Move Map/Set polyfills to top
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidaurelio authored and facebook-github-bot committed Oct 30, 2017
1 parent a5550a5 commit 008e549
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Libraries/Core/InitializeCore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 008e549

Please sign in to comment.