-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(sax): Only use own properties in entityMap (#374)
- Loading branch information
Showing
3 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`entity replacement ignores js prototype chain should not pick up 'entities' from the prototype chain 1`] = ` | ||
Object { | ||
"actual": " | ||
<xml> | ||
<hasOwnProperty>&hasOwnProperty;</hasOwnProperty> | ||
<proto>&__proto__;</proto> | ||
<constructor>&constructor;</constructor> | ||
</xml>", | ||
"error": Array [ | ||
"[xmldom error] entity not found:&hasOwnProperty; | ||
@#[line:3,col:4]", | ||
"[xmldom error] entity not found:&__proto__; | ||
@#[line:4,col:4]", | ||
"[xmldom error] entity not found:&constructor; | ||
@#[line:5,col:4]", | ||
], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict' | ||
|
||
const { getTestParser } = require('../get-test-parser') | ||
const { MIME_TYPE } = require('../../lib/conventions') | ||
|
||
describe('entity replacement ignores js prototype chain', () => { | ||
it("should not pick up 'entities' from the prototype chain", () => { | ||
const source = ` | ||
<xml> | ||
<hasOwnProperty>&hasOwnProperty;</hasOwnProperty> | ||
<proto>&__proto__;</proto> | ||
<constructor>&constructor;</constructor> | ||
</xml> | ||
` | ||
const { errors, parser } = getTestParser() | ||
|
||
const actual = parser.parseFromString(source, MIME_TYPE.XML_TEXT).toString() | ||
|
||
expect({ actual, ...errors }).toMatchSnapshot() | ||
}) | ||
}) |