From 343f2ccbe7d2a454dd32e0bea5d82e8cbe3ee67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 3 Mar 2022 01:52:39 +0100 Subject: [PATCH] Don't access entities from Object.prototype --- packages/babel-parser/src/plugins/jsx/xhtml.js | 3 ++- .../jsx/html-entities/no-object-prototype/output.json | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/babel-parser/src/plugins/jsx/xhtml.js b/packages/babel-parser/src/plugins/jsx/xhtml.js index 101fdebfc7dc..197665044343 100644 --- a/packages/babel-parser/src/plugins/jsx/xhtml.js +++ b/packages/babel-parser/src/plugins/jsx/xhtml.js @@ -1,6 +1,7 @@ // @flow -const entities: { [name: string]: string } = { +const entities: { [name: string]: string, __proto__: null } = { + __proto__: null, quot: "\u0022", amp: "&", apos: "\u0027", diff --git a/packages/babel-parser/test/fixtures/jsx/html-entities/no-object-prototype/output.json b/packages/babel-parser/test/fixtures/jsx/html-entities/no-object-prototype/output.json index 17fcd9d95ac2..fc708cc1f446 100644 --- a/packages/babel-parser/test/fixtures/jsx/html-entities/no-object-prototype/output.json +++ b/packages/babel-parser/test/fixtures/jsx/html-entities/no-object-prototype/output.json @@ -38,10 +38,10 @@ "type": "JSXText", "start":3,"end":12,"loc":{"start":{"line":1,"column":3,"index":3},"end":{"line":1,"column":12,"index":12}}, "extra": { - "rawValue": "function valueOf() { [native code] }", + "rawValue": "&valueOf;", "raw": "&valueOf;" }, - "value": "function valueOf() { [native code] }" + "value": "&valueOf;" } ] }