File tree 2 files changed +15
-0
lines changed
2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -754,6 +754,7 @@ Parser.prototype = {
754
754
}
755
755
var fnPtr = fn ( scope , locals , context ) || noop ;
756
756
757
+ ensureSafeObject ( context , parser . text ) ;
757
758
ensureSafeObject ( fnPtr , parser . text ) ;
758
759
759
760
// 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() {
730
730
'$parse' , 'isecdom' , 'Referencing DOM nodes in Angular expressions is ' +
731
731
'disallowed! Expression: getDoc()' ) ;
732
732
} ) ) ;
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
+ } ) ) ;
733
747
} ) ;
734
748
} ) ;
735
749
You can’t perform that action at this time.
0 commit comments