@@ -10138,8 +10138,7 @@ describe('$compile', function() {
10138
10138
} ) ;
10139
10139
} ) ;
10140
10140
10141
-
10142
- describe ( 'img[src] sanitization' , function ( ) {
10141
+ describe ( '*[src] context requirement' , function ( ) {
10143
10142
10144
10143
it ( 'should NOT require trusted values for img src' , inject ( function ( $rootScope , $compile , $sce ) {
10145
10144
element = $compile ( '<img src="{{testUrl}}"></img>' ) ( $rootScope ) ;
@@ -10152,17 +10151,24 @@ describe('$compile', function() {
10152
10151
expect ( element . attr ( 'src' ) ) . toEqual ( 'http://example.com/image2.png' ) ;
10153
10152
} ) ) ;
10154
10153
10155
- it ( 'should NOT require trusted values for video / audio / track src' , inject ( function ( $rootScope , $compile , $sce ) {
10156
- element = $compile ( '<video src="{{testUrl}}"></video>' ) ( $rootScope ) ;
10157
- $rootScope . testUrl = 'http://example.com/image.mp4' ;
10158
- $rootScope . $digest ( ) ;
10159
- expect ( element . attr ( 'src' ) ) . toEqual ( 'http://example.com/image.mp4' ) ;
10154
+ // Older IEs seem to reject the video tag with "Error: Not implemented"
10155
+ if ( ! msie || msie > 9 ) {
10156
+ it ( 'should NOT require trusted values for video src' ,
10157
+ inject ( function ( $rootScope , $compile , $sce ) {
10158
+ element = $compile ( '<video src="{{testUrl}}"></video>' ) ( $rootScope ) ;
10159
+ $rootScope . testUrl = 'http://example.com/image.mp4' ;
10160
+ $rootScope . $digest ( ) ;
10161
+ expect ( element . attr ( 'src' ) ) . toEqual ( 'http://example.com/image.mp4' ) ;
10160
10162
10161
- // But it should accept trusted values anyway.
10162
- $rootScope . testUrl = $sce . trustAsUrl ( 'http://example.com/image2.mp4' ) ;
10163
- $rootScope . $digest ( ) ;
10164
- expect ( element . attr ( 'src' ) ) . toEqual ( 'http://example.com/image2.mp4' ) ;
10165
- } ) ) ;
10163
+ // But it should accept trusted values anyway.
10164
+ $rootScope . testUrl = $sce . trustAsUrl ( 'http://example.com/image2.mp4' ) ;
10165
+ $rootScope . $digest ( ) ;
10166
+ expect ( element . attr ( 'src' ) ) . toEqual ( 'http://example.com/image2.mp4' ) ;
10167
+ } ) ) ;
10168
+ }
10169
+ } ) ;
10170
+
10171
+ describe ( 'img[src] sanitization' , function ( ) {
10166
10172
10167
10173
it ( 'should not sanitize attributes other than src' , inject ( function ( $compile , $rootScope ) {
10168
10174
element = $compile ( '<img title="{{testUrl}}"></img>' ) ( $rootScope ) ;
0 commit comments