[Representation] Trust template URLs

Trust resource URLs to skip SCE-checking (which profiling
flags as a performance problem) for mct-include and
mct-representation; these URLs are pulled from bundles and
not user-entered, so should be trusted. WTD-1256.
This commit is contained in:
Victor Woeltjen
2015-06-18 14:43:14 -07:00
parent dc85d3c191
commit 275ca01692
5 changed files with 61 additions and 17 deletions

View File

@ -53,17 +53,17 @@ define(
* @param {TemplateDefinition[]} templates an array of
* template extensions
*/
function MCTInclude(templates) {
function MCTInclude(templates, $sce) {
var templateMap = {};
// Prepopulate templateMap for easy look up by key
templates.forEach(function (template) {
var key = template.key,
path = [
path = $sce.trustAsResourceUrl([
template.bundle.path,
template.bundle.resources,
template.templateUrl
].join("/");
].join("/"));
// First found should win (priority ordering)
templateMap[key] = templateMap[key] || path;
});
@ -91,4 +91,4 @@ define(
return MCTInclude;
}
);
);