Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ Language Improvements:

- enh(matlab) Add new R2019b `arguments` keyword and fix `enumeration` keyword (#2619) [Andrew Janke][]
- fix(kotlin) Remove very old keywords and update example code (#2623) [kageru][]
- fix(night) Prevent object prototypes method values from being returned in `getLanguage` (#2636) [night][]

[Andrew Janke]: https://github.com/apjanke
[Samia Ali]: https://github.com/samiaab1990
[kageru]: https://github.com/kageru
[night]: https://github.com/night


## Version 10.1.1
Expand Down
4 changes: 2 additions & 2 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const HLJS = function(hljs) {

// Global internal variables used within the highlight.js library.
/** @type {Record<string, Language>} */
var languages = {};
var languages = Object.create(null);
/** @type {Record<string, string>} */
var aliases = {};
var aliases = Object.create(null);
/** @type {HLJSPlugin[]} */
var plugins = [];

Expand Down
12 changes: 12 additions & 0 deletions test/api/getLanguage.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,16 @@ describe('.getLanguage()', () => {
result.should.have.property('aliases').with.containEql('cs');
should.strictEqual(result, hljs.getLanguage('csharp'))
});

it('should not succeed for constructor', () => {
const result = hljs.getLanguage('constructor');

should.strictEqual(result, undefined);
});

it('should not succeed for __proto__', () => {
const result = hljs.getLanguage('__proto__');

should.strictEqual(result, undefined);
});
});