File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,3 +98,9 @@ test('invalid MML', () => {
9898 const mml = '<input name="test" value=1 />' ;
9999 expect ( ( ) => SourceToXML ( mml ) ) . toThrowError ( / A t t r i b u t e v a l u e e x p e c t e d / ) ;
100100} ) ;
101+
102+ test ( 'forbid access to object prototype props in mml' , ( ) => {
103+ const mml = '<constructor />' ;
104+ const nodes = SourceToXML ( mml ) ;
105+ expect ( ( ) => XMLtoMMLTree ( nodes ) ) . toThrowError ( / C o n v e r t e r n o t f o u n d f o r t a g c o n s t r u c t o r .+ / ) ;
106+ } ) ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export class Tree {
3636
3737 ( parent . children || [ ] ) . forEach ( ( child , i ) => {
3838 const converter = this . converters [ child . name ] ;
39- if ( ! converter ) {
39+ if ( ! converter || ! Object . hasOwnProperty . call ( this . converters , child . name ) ) {
4040 throw Error (
4141 `Converter not found for tag ${ child . name } , Available converters are ${ Object . keys ( this . converters ) } ` ,
4242 ) ;
You can’t perform that action at this time.
0 commit comments