fix($sce): allow IE7 standards mode to pass non-quirks mode test

Changes documentMode test version to 7 in order 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.

Closes #3633
Closes #3646
This commit is contained in:
justinrknowles 2013-08-18 14:01:34 -04:00 committed by Igor Minar
parent ad77d67cb7
commit 637c9b1611
2 changed files with 10 additions and 2 deletions

View file

@ -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 <!doctype html> to the top of your HTML ' +

View file

@ -58,7 +58,11 @@ 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 IE7 standards mode', function() {
runTest(true, 7, false);
});
it('should NOT throw an exception when sce is enabled and in standards mode', function() {
@ -70,6 +74,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);
});