From aaf9c5e598996ab17bce9579c8bfe63628b6620e Mon Sep 17 00:00:00 2001 From: Jeff Cross Date: Wed, 20 Aug 2014 16:23:13 -0700 Subject: [PATCH] fix(minErr): encode btstrpd error input to strip angle brackets The $sanitize service was returning an empty string to the error page because the input was usually a single html tag (sometimes it could be `document`). This fix replaces angle brackets with html entities. Closes #8683 --- src/Angular.js | 6 +++++- test/AngularSpec.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Angular.js b/src/Angular.js index 9d047ae04643..461c5266ba19 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -1345,7 +1345,11 @@ function bootstrap(element, modules) { if (element.injector()) { var tag = (element[0] === document) ? 'document' : startingTag(element); - throw ngMinErr('btstrpd', "App Already Bootstrapped with this Element '{0}'", tag); + //Encode angle brackets to prevent input from being sanitized to empty string #8683 + throw ngMinErr( + 'btstrpd', + "App Already Bootstrapped with this Element '{0}'", + tag.replace(//,'>')); } modules = modules || []; diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 148f80f29a80..33ce03b18c6c 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -822,7 +822,7 @@ describe('angular', function() { expect(function () { angular.bootstrap(element); }).toThrowMatching( - /\[ng:btstrpd\] App Already Bootstrapped with this Element '
'/i + /\[ng:btstrpd\] App Already Bootstrapped with this Element '<div class="?ng\-scope"?( ng[0-9]+="?[0-9]+"?)?>'/i ); dealoc(element);