nl_tokens: @ngdoc method @name $sceDelegate#getTrusted
pl_tokens: function getTrusted ( type , maybeTrusted ) { if ( maybeTrusted === null || isUndefined ( maybeTrusted ) || maybeTrusted === '' ) { return maybeTrusted ; } var constructor = ( byType . hasOwnProperty ( type ) ? byType [ type ] : null ) ; // If maybeTrusted is a trusted class instance or subclass instance, then unwrap and return // as-is. if ( constructor && maybeTrusted instanceof constructor ) { return maybeTrusted . $$unwrapTrustedValue ( ) ; } // If maybeTrusted is a trusted class instance but not of the correct trusted type // then unwrap it and allow it to pass through to the rest of the checks if ( isFunction ( maybeTrusted . $$unwrapTrustedValue ) ) { maybeTrusted = maybeTrusted . $$unwrapTrustedValue ( ) ; } // If we get here, then we will either sanitize the value or throw an exception. if ( type === SCE_CONTEXTS . MEDIA_URL || type === SCE_CONTEXTS . URL ) { // we attempt to sanitize non-resource URLs return $$sanitizeUri ( maybeTrusted . toString ( ) , type === SCE_CONTEXTS . MEDIA_URL ) ; } else if ( type === SCE_CONTEXTS . RESOURCE_URL ) { if ( isResourceUrlAllowedByPolicy ( maybeTrusted ) ) { return maybeTrusted ; } else { throw $sceMinErr ( 'insecurl' , 'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}' , maybeTrusted . toString ( ) ) ; } } else if ( type === SCE_CONTEXTS . <mask> ) { // htmlSanitizer throws its own error when no sanitizer is available. return htmlSanitizer ( maybeTrusted ) ; } // Default error when the $sce service has no way to make the input safe. throw $sceMinErr ( 'unsafe' , 'Attempting to use an unsafe value in a safe context.' ) ; }