diff --git a/src/ng/sce.js b/src/ng/sce.js index 2d2a8faa..5d107577 100644 --- a/src/ng/sce.js +++ b/src/ng/sce.js @@ -722,7 +722,7 @@ function $SceProvider() { $document, $parse, $sceDelegate) { // Prereq: Ensure that we're not running in IE<11 quirks mode. In that mode, IE < 11 allow // the "expression(javascript expression)" syntax which is insecure. - if (enabled && $document[0].documentMode < 8) { + if (enabled && msie < 8) { throw $sceMinErr('iequirks', 'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' + 'mode. You can fix this by adding the text to the top of your HTML ' + diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js index b54d3a5b..e9f7f192 100644 --- a/test/ng/sceSpecs.js +++ b/test/ng/sceSpecs.js @@ -27,11 +27,20 @@ describe('SCE', function() { }); describe('IE<11 quirks mode', function() { + /* global msie: true */ + var msieBackup; + + beforeEach(function() { + msieBackup = msie; + }); + + afterEach(function() { + msie = msieBackup; + }); + function runTest(enabled, documentMode, expectException) { + msie = documentMode; module(function($provide) { - $provide.value('$document', [{ - documentMode: documentMode - }]); $provide.value('$sceDelegate', {trustAs: null, valueOf: null, getTrusted: null}); }); diff --git a/test/ng/windowSpec.js b/test/ng/windowSpec.js index 3b847146..97edd02e 100644 --- a/test/ng/windowSpec.js +++ b/test/ng/windowSpec.js @@ -4,4 +4,9 @@ describe('$window', function() { it("should inject $window", inject(function($window) { expect($window).toBe(window); })); + + it('should be able to mock $window without errors', function() { + module({$window: {}}); + inject(['$sce', angular.noop]); + }); });