@@ -698,6 +698,56 @@ describe('parser', function() {
698
698
} ) ;
699
699
} ) ;
700
700
701
+ describe ( 'Function prototype functions' , function ( ) {
702
+ it ( 'should NOT allow invocation to Function.call' , function ( ) {
703
+ scope . fn = Function . prototype . call ;
704
+
705
+ expect ( function ( ) {
706
+ scope . $eval ( '$eval.call()' )
707
+ } ) . toThrowMinErr (
708
+ '$parse' , 'isecff' , 'Referencing call, apply or bind in Angular expressions is disallowed! ' +
709
+ 'Expression: $eval.call()' ) ;
710
+
711
+ expect ( function ( ) {
712
+ scope . $eval ( 'fn()' )
713
+ } ) . toThrowMinErr (
714
+ '$parse' , 'isecff' , 'Referencing call, apply or bind in Angular expressions is disallowed! ' +
715
+ 'Expression: fn()' ) ;
716
+ } ) ;
717
+
718
+ it ( 'should NOT allow invocation to Function.apply' , function ( ) {
719
+ scope . apply = Function . prototype . apply ;
720
+
721
+ expect ( function ( ) {
722
+ scope . $eval ( '$eval.apply()' )
723
+ } ) . toThrowMinErr (
724
+ '$parse' , 'isecff' , 'Referencing call, apply or bind in Angular expressions is disallowed! ' +
725
+ 'Expression: $eval.apply()' ) ;
726
+
727
+ expect ( function ( ) {
728
+ scope . $eval ( 'apply()' )
729
+ } ) . toThrowMinErr (
730
+ '$parse' , 'isecff' , 'Referencing call, apply or bind in Angular expressions is disallowed! ' +
731
+ 'Expression: apply()' ) ;
732
+ } ) ;
733
+
734
+ it ( 'should NOT allow invocation to Function.bind' , function ( ) {
735
+ scope . bind = Function . prototype . bind ;
736
+
737
+ expect ( function ( ) {
738
+ scope . $eval ( '$eval.bind()' )
739
+ } ) . toThrowMinErr (
740
+ '$parse' , 'isecff' , 'Referencing call, apply or bind in Angular expressions is disallowed! ' +
741
+ 'Expression: $eval.bind()' ) ;
742
+
743
+ expect ( function ( ) {
744
+ scope . $eval ( 'bind()' )
745
+ } ) . toThrowMinErr (
746
+ '$parse' , 'isecff' , 'Referencing call, apply or bind in Angular expressions is disallowed! ' +
747
+ 'Expression: bind()' ) ;
748
+ } ) ;
749
+ } ) ;
750
+
701
751
describe ( 'Object constructor' , function ( ) {
702
752
703
753
it ( 'should NOT allow access to Object constructor that has been aliased' , function ( ) {
@@ -1053,7 +1103,7 @@ describe('parser', function() {
1053
1103
} ) ) ;
1054
1104
} ) ;
1055
1105
1056
-
1106
+
1057
1107
describe ( 'constant' , function ( ) {
1058
1108
it ( 'should mark scalar value expressions as constant' , inject ( function ( $parse ) {
1059
1109
expect ( $parse ( '12.3' ) . constant ) . toBe ( true ) ;
0 commit comments