{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react-native/pulls/comments/222849359","pull_request_review_id":161837975,"id":222849359,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjg0OTM1OQ==","diff_hunk":"@@ -0,0 +1,95 @@\n+/**\n+ * Copyright (c) Facebook, Inc. and its affiliates.\n+ *\n+ * This source code is licensed under the MIT license found in the\n+ * LICENSE file in the root directory of this source tree.\n+ *\n+ * @format\n+ * @emails oncall+react_native\n+ */\n+'use strict';\n+\n+describe('Map polyfill', () => {\n+  jest.setMock(\n+    '../../vendor/core/_shouldPolyfillES6Collection',\n+    () => true\n+  );\n+\n+  const Map = require(\"Map\");","path":"Libraries/Core/__tests__/MapAndSetPolyfills-test.js","position":18,"original_position":18,"commit_id":"cefd098e79e05a7253ba41d82f2ad1622945294f","original_commit_id":"cefd098e79e05a7253ba41d82f2ad1622945294f","user":{"login":"analysis-bot","id":43188587,"node_id":"MDQ6VXNlcjQzMTg4NTg3","avatar_url":"https://avatars3.githubusercontent.com/u/43188587?v=4","gravatar_id":"","url":"https://api.github.com/users/analysis-bot","html_url":"https://github.com/analysis-bot","followers_url":"https://api.github.com/users/analysis-bot/followers","following_url":"https://api.github.com/users/analysis-bot/following{/other_user}","gists_url":"https://api.github.com/users/analysis-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/analysis-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/analysis-bot/subscriptions","organizations_url":"https://api.github.com/users/analysis-bot/orgs","repos_url":"https://api.github.com/users/analysis-bot/repos","events_url":"https://api.github.com/users/analysis-bot/events{/privacy}","received_events_url":"https://api.github.com/users/analysis-bot/received_events","type":"User","site_admin":false},"body":"prettier/prettier: Replace `\"Map\"` with `'Map'`","created_at":"2018-10-04T22:43:35Z","updated_at":"2018-10-04T22:43:39Z","html_url":"https://github.com/facebook/react-native/pull/21492#discussion_r222849359","pull_request_url":"https://api.github.com/repos/facebook/react-native/pulls/21492","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments/222849359"},"html":{"href":"https://github.com/facebook/react-native/pull/21492#discussion_r222849359"},"pull_request":{"href":"https://api.github.com/repos/facebook/react-native/pulls/21492"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/21492","id":220538520,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNTM4NTIw","html_url":"https://github.com/facebook/react-native/pull/21492","diff_url":"https://github.com/facebook/react-native/pull/21492.diff","patch_url":"https://github.com/facebook/react-native/pull/21492.patch","issue_url":"https://api.github.com/repos/facebook/react-native/issues/21492","number":21492,"state":"open","locked":false,"title":"Critical improvements for Map and Set polyfills.","user":{"login":"benjamn","id":5750,"node_id":"MDQ6VXNlcjU3NTA=","avatar_url":"https://avatars0.githubusercontent.com/u/5750?v=4","gravatar_id":"","url":"https://api.github.com/users/benjamn","html_url":"https://github.com/benjamn","followers_url":"https://api.github.com/users/benjamn/followers","following_url":"https://api.github.com/users/benjamn/following{/other_user}","gists_url":"https://api.github.com/users/benjamn/gists{/gist_id}","starred_url":"https://api.github.com/users/benjamn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjamn/subscriptions","organizations_url":"https://api.github.com/users/benjamn/orgs","repos_url":"https://api.github.com/users/benjamn/repos","events_url":"https://api.github.com/users/benjamn/events{/privacy}","received_events_url":"https://api.github.com/users/benjamn/received_events","type":"User","site_admin":false},"body":"Test Plan:\r\n---\r\nSee included tests.\r\n\r\nRelease Notes:\r\n---\r\n* [POLYFILL] [SPEC] The `Map` and `Set` polyfills no longer reject non-extensible object keys, through a combination of tagging objects _before_ they become non-extensible, and falling back to a linear `Array#indexOf` lookup when there is no other option.\r\n* [POLYFILL] [BUGFIX] Fixed a critical bug that caused `Map` and `Set` object hashes to collide with the hashes of other objects in their prototype chains.\r\n\r\nDetails\r\n---\r\nWhen I first discovered these bugs in the course of investigating https://github.com/apollographql/react-apollo/issues/2442, I was disappointed and disheartened, and I was tempted to recommend that Apollo developers find a replacement for the React Native `Map` and `Set` polyfills.\r\n\r\nHowever, as I dug into the code and investigated alternative polyfills, I realized that this `Map` polyfill has the potential to be one of the fastest and best polyfills available, since almost every other polyfill avoids tagging object keys, and instead resorts to linear lookup. I hope this PR demonstrates that we can provide constant-time lookup in (almost) all cases, even for frozen object keys.\r\n\r\nWhile I can certainly provide more creative solutions to developers who use my libraries, from monkey-patching `Map.prototype` to using the `react-native` override field in `package.json`, I think the best solution is simply to improve the official polyfills, which is what I've tried to do in this PR.\r\n\r\nPlease read the commit messages and the comments that I've added to the code for more explanation, and thanks for your consideration!","created_at":"2018-10-04T22:42:16Z","updated_at":"2018-10-04T22:43:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"03faba4a5ba93f263a69d03db0c500a16798393f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":196858975,"node_id":"MDU6TGFiZWwxOTY4NTg5NzU=","url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react-native/pulls/21492/commits","review_comments_url":"https://api.github.com/repos/facebook/react-native/pulls/21492/comments","review_comment_url":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/21492/comments","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/cefd098e79e05a7253ba41d82f2ad1622945294f","head":{"label":"apollographql:fix-map-and-set-polyfills","ref":"fix-map-and-set-polyfills","sha":"cefd098e79e05a7253ba41d82f2ad1622945294f","user":{"login":"apollographql","id":17189275,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTg5Mjc1","avatar_url":"https://avatars0.githubusercontent.com/u/17189275?v=4","gravatar_id":"","url":"https://api.github.com/users/apollographql","html_url":"https://github.com/apollographql","followers_url":"https://api.github.com/users/apollographql/followers","following_url":"https://api.github.com/users/apollographql/following{/other_user}","gists_url":"https://api.github.com/users/apollographql/gists{/gist_id}","starred_url":"https://api.github.com/users/apollographql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollographql/subscriptions","organizations_url":"https://api.github.com/users/apollographql/orgs","repos_url":"https://api.github.com/users/apollographql/repos","events_url":"https://api.github.com/users/apollographql/events{/privacy}","received_events_url":"https://api.github.com/users/apollographql/received_events","type":"Organization","site_admin":false},"repo":{"id":151628439,"node_id":"MDEwOlJlcG9zaXRvcnkxNTE2Mjg0Mzk=","name":"react-native","full_name":"apollographql/react-native","private":false,"owner":{"login":"apollographql","id":17189275,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE3MTg5Mjc1","avatar_url":"https://avatars0.githubusercontent.com/u/17189275?v=4","gravatar_id":"","url":"https://api.github.com/users/apollographql","html_url":"https://github.com/apollographql","followers_url":"https://api.github.com/users/apollographql/followers","following_url":"https://api.github.com/users/apollographql/following{/other_user}","gists_url":"https://api.github.com/users/apollographql/gists{/gist_id}","starred_url":"https://api.github.com/users/apollographql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apollographql/subscriptions","organizations_url":"https://api.github.com/users/apollographql/orgs","repos_url":"https://api.github.com/users/apollographql/repos","events_url":"https://api.github.com/users/apollographql/events{/privacy}","received_events_url":"https://api.github.com/users/apollographql/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/apollographql/react-native","description":"A framework for building native apps with React.","fork":true,"url":"https://api.github.com/repos/apollographql/react-native","forks_url":"https://api.github.com/repos/apollographql/react-native/forks","keys_url":"https://api.github.com/repos/apollographql/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apollographql/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apollographql/react-native/teams","hooks_url":"https://api.github.com/repos/apollographql/react-native/hooks","issue_events_url":"https://api.github.com/repos/apollographql/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/apollographql/react-native/events","assignees_url":"https://api.github.com/repos/apollographql/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/apollographql/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/apollographql/react-native/tags","blobs_url":"https://api.github.com/repos/apollographql/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apollographql/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apollographql/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/apollographql/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apollographql/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/apollographql/react-native/languages","stargazers_url":"https://api.github.com/repos/apollographql/react-native/stargazers","contributors_url":"https://api.github.com/repos/apollographql/react-native/contributors","subscribers_url":"https://api.github.com/repos/apollographql/react-native/subscribers","subscription_url":"https://api.github.com/repos/apollographql/react-native/subscription","commits_url":"https://api.github.com/repos/apollographql/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/apollographql/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/apollographql/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/apollographql/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/apollographql/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/apollographql/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apollographql/react-native/merges","archive_url":"https://api.github.com/repos/apollographql/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apollographql/react-native/downloads","issues_url":"https://api.github.com/repos/apollographql/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/apollographql/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/apollographql/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/apollographql/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apollographql/react-native/labels{/name}","releases_url":"https://api.github.com/repos/apollographql/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/apollographql/react-native/deployments","created_at":"2018-10-04T19:57:25Z","updated_at":"2018-10-04T19:57:39Z","pushed_at":"2018-10-04T22:24:18Z","git_url":"git://github.com/apollographql/react-native.git","ssh_url":"git@github.com:apollographql/react-native.git","clone_url":"https://github.com/apollographql/react-native.git","svn_url":"https://github.com/apollographql/react-native","homepage":"https://facebook.github.io/react-native/","size":272663,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"7536c9bdee27419ba21a46831de72edcad64dabc","user":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":29028775,"node_id":"MDEwOlJlcG9zaXRvcnkyOTAyODc3NQ==","name":"react-native","full_name":"facebook/react-native","private":false,"owner":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/facebook/react-native","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/facebook/react-native","forks_url":"https://api.github.com/repos/facebook/react-native/forks","keys_url":"https://api.github.com/repos/facebook/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react-native/teams","hooks_url":"https://api.github.com/repos/facebook/react-native/hooks","issue_events_url":"https://api.github.com/repos/facebook/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react-native/events","assignees_url":"https://api.github.com/repos/facebook/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react-native/tags","blobs_url":"https://api.github.com/repos/facebook/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react-native/languages","stargazers_url":"https://api.github.com/repos/facebook/react-native/stargazers","contributors_url":"https://api.github.com/repos/facebook/react-native/contributors","subscribers_url":"https://api.github.com/repos/facebook/react-native/subscribers","subscription_url":"https://api.github.com/repos/facebook/react-native/subscription","commits_url":"https://api.github.com/repos/facebook/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react-native/merges","archive_url":"https://api.github.com/repos/facebook/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react-native/downloads","issues_url":"https://api.github.com/repos/facebook/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react-native/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react-native/deployments","created_at":"2015-01-09T18:10:16Z","updated_at":"2018-10-04T22:33:14Z","pushed_at":"2018-10-04T22:42:16Z","git_url":"git://github.com/facebook/react-native.git","ssh_url":"git@github.com:facebook/react-native.git","clone_url":"https://github.com/facebook/react-native.git","svn_url":"https://github.com/facebook/react-native","homepage":"https://facebook.github.io/react-native/","size":272723,"stargazers_count":69377,"watchers_count":69377,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":15568,"mirror_url":null,"archived":false,"open_issues_count":867,"license":{"key":"other","name":"NOASSERTION","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":15568,"open_issues":867,"watchers":69377,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/21492"},"html":{"href":"https://github.com/facebook/react-native/pull/21492"},"issue":{"href":"https://api.github.com/repos/facebook/react-native/issues/21492"},"comments":{"href":"https://api.github.com/repos/facebook/react-native/issues/21492/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react-native/pulls/21492/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react-native/pulls/21492/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react-native/statuses/cefd098e79e05a7253ba41d82f2ad1622945294f"}},"author_association":"NONE"}}
{"actor":{"display_login":"analysis-bot"}}