From 71b851fed484389ec15fa19e937d11a006bbe14c Mon Sep 17 00:00:00 2001 From: justinrknowles Date: Sun, 18 Aug 2013 14:01:34 -0400 Subject: [PATCH 1/3] Update sce.js Changed to 7 to support IE 8 in IE 7 standards mode while still protecting against quirks mode. documentMode returns the following values: 5 - quirks mode, 7 - IE 7 standards mode, 8 - IE 8 standards mode. --- src/ng/sce.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/sce.js b/src/ng/sce.js index 4441bbc89212..5fc2c6f094a6 100644 --- a/src/ng/sce.js +++ b/src/ng/sce.js @@ -620,7 +620,7 @@ function $SceProvider() { // the "expression(javascript expression)" syntax which is insecure. if (enabled && msie) { var documentMode = $document[0].documentMode; - if (documentMode !== undefined && documentMode < 8) { + if (documentMode !== undefined && documentMode < 7) { throw $sceMinErr('iequirks', 'Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks ' + 'mode. You can fix this by adding the text to the top of your HTML ' + From 3ee8eeeb254ba863e3d28f6076213f54528fd62d Mon Sep 17 00:00:00 2001 From: justinrknowles Date: Sun, 18 Aug 2013 14:30:25 -0400 Subject: [PATCH 2/3] Update sceSpecs.js 'documentMode' is being used to test for quirks mode. This property was introduced in IE 8 and returns one of the following values: 5 - quirks mode, 7 - IE 7 standards mode, 8 - IE 8 standards mode. Test should return 5 not 7 for quirks mode. --- test/ng/sceSpecs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js index 75c1fbaa156b..9bf9b3bd87ee 100644 --- a/test/ng/sceSpecs.js +++ b/test/ng/sceSpecs.js @@ -58,7 +58,7 @@ describe('SCE', function() { } it('should throw an exception when sce is enabled in quirks mode', function() { - runTest(true, 7, true); + runTest(true, 5, true); }); it('should NOT throw an exception when sce is enabled and in standards mode', function() { @@ -70,7 +70,7 @@ describe('SCE', function() { }); it('should NOT throw an exception when sce is disabled even when in quirks mode', function() { - runTest(false, 7, false); + runTest(false, 5, false); }); it('should NOT throw an exception when sce is disabled and in standards mode', function() { From 587c4fbc5cc62b84b34a5700d3d64b7f2e3c8ff3 Mon Sep 17 00:00:00 2001 From: justinrknowles Date: Sun, 18 Aug 2013 14:36:59 -0400 Subject: [PATCH 3/3] Update sceSpecs.js Added tests for IE8 in IE7 standards mode. --- test/ng/sceSpecs.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/ng/sceSpecs.js b/test/ng/sceSpecs.js index 9bf9b3bd87ee..c10a77cb693c 100644 --- a/test/ng/sceSpecs.js +++ b/test/ng/sceSpecs.js @@ -60,6 +60,10 @@ describe('SCE', function() { it('should throw an exception when sce is enabled in quirks mode', function() { runTest(true, 5, true); }); + + it('should NOT throw an exception when sce is enabled and in IE7 standards mode', function() { + runTest(true, 7, false); + }); it('should NOT throw an exception when sce is enabled and in standards mode', function() { runTest(true, 8, false); @@ -72,6 +76,10 @@ describe('SCE', function() { it('should NOT throw an exception when sce is disabled even when in quirks mode', function() { runTest(false, 5, false); }); + + it('should NOT throw an exception when sce is disabled and in IE7 standards mode', function() { + runTest(false, 7, false); + }); it('should NOT throw an exception when sce is disabled and in standards mode', function() { runTest(false, 8, false);