|
2 | 2 |
|
3 | 3 | describe('SCE', function() {
|
4 | 4 |
|
| 5 | + // Work around an IE8 bug. Though window.inject === angular.mock.inject, if it's invoked the |
| 6 | + // window scope, IE8 loses the exception object that bubbles up and replaces it with a TypeError. |
| 7 | + // By using a local alias, it gets invoked on the global scope instead of window. |
| 8 | + // Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813 |
| 9 | + var inject = angular.mock.inject; |
| 10 | + |
5 | 11 | describe('when disabled', function() {
|
6 | 12 | beforeEach(function() {
|
7 | 13 | module(function($sceProvider) {
|
@@ -262,9 +268,7 @@ describe('SCE', function() {
|
262 | 268 | $sceDelegateProvider.resourceUrlBlacklist(cfg.blackList);
|
263 | 269 | }
|
264 | 270 | });
|
265 |
| - // This needs to be angular.mock.inject even though it's === window.inject. |
266 |
| - // Ref: https://github.com/angular/angular.js/pull/4221#/issuecomment-25515813 |
267 |
| - angular.mock.inject(testFn); |
| 271 | + inject(testFn); |
268 | 272 | }
|
269 | 273 | }
|
270 | 274 |
|
@@ -399,20 +403,13 @@ describe('SCE', function() {
|
399 | 403 | expect($sce.getTrustedResourceUrl('http://example.com/foo:1/2.3?4&5-6')).toEqual('http://example.com/foo:1/2.3?4&5-6');
|
400 | 404 | }));
|
401 | 405 |
|
402 |
| - // TODO(chirayu): This throws a very helpful TypeError exception - "Object doesn't support |
403 |
| - // this property or method". Tracing using the debugger on IE8 developer tools shows me one |
404 |
| - // catch(e) block where the exception is correct, but jumping up to the parent catch block has |
405 |
| - // the TypeError exception. I've been unable to repro this outside this snippet or figure out |
406 |
| - // why this is happening. Until then, this test doesn't run on IE8. |
407 |
| - if (!msie || msie > 8) { |
408 |
| - it('should not accept *** in the string', function() { |
409 |
| - expect(function() { |
410 |
| - runTest({whiteList: ['http://***']}, null)(); |
411 |
| - }).toThrowMinErr('$injector', 'modulerr', new RegExp( |
412 |
| - /Failed to instantiate module function ?\(\$sceDelegateProvider\) due to:\n/.source + |
413 |
| - /[^[]*\[\$sce:iwcard\] Illegal sequence \*\*\* in string matcher\. String: http:\/\/\*\*\*/.source)); |
414 |
| - }); |
415 |
| - } |
| 406 | + it('should not accept *** in the string', function() { |
| 407 | + expect(function() { |
| 408 | + runTest({whiteList: ['http://***']}, null)(); |
| 409 | + }).toThrowMinErr('$injector', 'modulerr', new RegExp( |
| 410 | + /Failed to instantiate module function ?\(\$sceDelegateProvider\) due to:\n/.source + |
| 411 | + /[^[]*\[\$sce:iwcard\] Illegal sequence \*\*\* in string matcher\. String: http:\/\/\*\*\*/.source)); |
| 412 | + }); |
416 | 413 | });
|
417 | 414 |
|
418 | 415 | describe('"self" matcher', function() {
|
|
0 commit comments