File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -754,6 +754,7 @@ Parser.prototype = {
754754 }
755755 var fnPtr = fn ( scope , locals , context ) || noop ;
756756
757+ ensureSafeObject ( context , parser . text ) ;
757758 ensureSafeObject ( fnPtr , parser . text ) ;
758759
759760 // IE stupidity! (IE doesn't have apply for some native functions)
Original file line number Diff line number Diff line change @@ -730,6 +730,20 @@ describe('parser', function() {
730730 '$parse' , 'isecdom' , 'Referencing DOM nodes in Angular expressions is ' +
731731 'disallowed! Expression: getDoc()' ) ;
732732 } ) ) ;
733+
734+ it ( 'should NOT allow calling functions on Window or DOM' , inject ( function ( $window , $document ) {
735+ scope . a = { b : { win : $window , doc : $document } } ;
736+ expect ( function ( ) {
737+ scope . $eval ( 'a.b.win.alert(1)' , scope ) ;
738+ } ) . toThrowMinErr (
739+ '$parse' , 'isecwindow' , 'Referencing the Window in Angular expressions is ' +
740+ 'disallowed! Expression: a.b.win.alert(1)' ) ;
741+ expect ( function ( ) {
742+ scope . $eval ( 'a.b.doc.on("click")' , scope ) ;
743+ } ) . toThrowMinErr (
744+ '$parse' , 'isecdom' , 'Referencing DOM nodes in Angular expressions is ' +
745+ 'disallowed! Expression: a.b.doc.on("click")' ) ;
746+ } ) ) ;
733747 } ) ;
734748 } ) ;
735749
You can’t perform that action at this time.
0 commit comments