aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/sce.js
diff options
context:
space:
mode:
authorTobias Bosch2013-11-19 20:42:38 -0800
committerPete Bacon Darwin2013-11-20 23:12:39 +0000
commitec3c4f94c79e23c29abcde6e1d2f6eaf05e0664c (patch)
treeb012206a97beda4a868f2a27a243a643a4f6cd74 /src/ng/sce.js
parent6b8bbe4d90640542eed5607a8c91f6b977b1d6c0 (diff)
downloadangular.js-ec3c4f94c79e23c29abcde6e1d2f6eaf05e0664c.tar.bz2
refactor($sce): Use $sniffer instead of $document for feature detection.
Also adds `$sniffer.msieDocumentMode` property. Closes #4931 Closes #5045
Diffstat (limited to 'src/ng/sce.js')
-rw-r--r--src/ng/sce.js20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ng/sce.js b/src/ng/sce.js
index b1b571c6..24b94c83 100644
--- a/src/ng/sce.js
+++ b/src/ng/sce.js
@@ -199,8 +199,7 @@ function $SceDelegateProvider() {
return resourceUrlBlacklist;
};
- this.$get = ['$log', '$document', '$injector', function(
- $log, $document, $injector) {
+ this.$get = ['$injector', function($injector) {
var htmlSanitizer = function htmlSanitizer(html) {
throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
@@ -731,18 +730,15 @@ function $SceProvider() {
* sce.js and sceSpecs.js would need to be aware of this detail.
*/
- this.$get = ['$parse', '$document', '$sceDelegate', function(
- $parse, $document, $sceDelegate) {
+ this.$get = ['$parse', '$sniffer', '$sceDelegate', function(
+ $parse, $sniffer, $sceDelegate) {
// Prereq: Ensure that we're not running in IE8 quirks mode. In that mode, IE allows
// the "expression(javascript expression)" syntax which is insecure.
- if (enabled && msie) {
- var documentMode = $document[0].documentMode;
- if (documentMode !== undefined && documentMode < 8) {
- 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 ' +
- 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
- }
+ if (enabled && $sniffer.msie && $sniffer.msieDocumentMode < 8) {
+ 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 ' +
+ 'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
}
var sce = copy(SCE_CONTEXTS);