From 85505fdd3ecb042a12d16beb3a8eb3491306b2cf Mon Sep 17 00:00:00 2001 From: Riley Dulin Date: Mon, 17 Sep 2018 14:54:21 -0700 Subject: [PATCH] Fix map polyfill to use a deterministic key for the hash Summary: Prepack does not understand how to use a random key as an object property. Instead, at build time, it generates a deterministic property name based on a deterministic seed for `Math.random()`. Prepack would like to move away from this, and keep all the `Math.random()` unevaluated and left in the bundle. Since this is the only usage of `Math.random()` that can't be handled by the abstract interpreter, it should be changed. Note that the randomness is not required here at all, it just has to be *some* unique key. Reviewed By: davidaurelio Differential Revision: D9882757 fbshipit-source-id: 21c213db9716d2faeb8745d811a620b088a83781 --- Libraries/vendor/core/Map.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/vendor/core/Map.js b/Libraries/vendor/core/Map.js index 14a948861..481b33220 100644 --- a/Libraries/vendor/core/Map.js +++ b/Libraries/vendor/core/Map.js @@ -553,7 +553,7 @@ module.exports = (function(global, undefined) { const getHash = (function() { const propIsEnumerable = Object.prototype.propertyIsEnumerable; - const hashProperty = guid(); + const hashProperty = '__MAP_POLYFILL_INTERNAL_HASH__'; let hashCounter = 0; /**