MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / $SceDelegateProvider

Function $SceDelegateProvider

code/songhop/www/lib/angular/angular.js:14944–15190  ·  view source on GitHub ↗

* @ngdoc provider * @name $sceDelegateProvider * @description * * The `$sceDelegateProvider` provider allows developers to configure the ng.$sceDelegate * $sceDelegate service. This allows one to get/set the whitelists and blacklists used to ensure * that the URLs used for sourcing An

()

Source from the content-addressed store, hash-verified

14942 */
14943
14944function $SceDelegateProvider() {
14945 this.SCE_CONTEXTS = SCE_CONTEXTS;
14946
14947 // Resource URLs can also be trusted by policy.
14948 var resourceUrlWhitelist = ['self'],
14949 resourceUrlBlacklist = [];
14950
14951 /**
14952 * @ngdoc method
14953 * @name $sceDelegateProvider#resourceUrlWhitelist
14954 * @kind function
14955 *
14956 * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
14957 * provided. This must be an array or null. A snapshot of this array is used so further
14958 * changes to the array are ignored.
14959 *
14960 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
14961 * allowed in this array.
14962 *
14963 * Note: **an empty whitelist array will block all URLs**!
14964 *
14965 * @return {Array} the currently set whitelist array.
14966 *
14967 * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
14968 * same origin resource requests.
14969 *
14970 * @description
14971 * Sets/Gets the whitelist of trusted resource URLs.
14972 */
14973 this.resourceUrlWhitelist = function(value) {
14974 if (arguments.length) {
14975 resourceUrlWhitelist = adjustMatchers(value);
14976 }
14977 return resourceUrlWhitelist;
14978 };
14979
14980 /**
14981 * @ngdoc method
14982 * @name $sceDelegateProvider#resourceUrlBlacklist
14983 * @kind function
14984 *
14985 * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
14986 * provided. This must be an array or null. A snapshot of this array is used so further
14987 * changes to the array are ignored.
14988 *
14989 * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
14990 * allowed in this array.
14991 *
14992 * The typical usage for the blacklist is to **block
14993 * [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
14994 * these would otherwise be trusted but actually return content from the redirected domain.
14995 *
14996 * Finally, **the blacklist overrides the whitelist** and has the final say.
14997 *
14998 * @return {Array} the currently set blacklist array.
14999 *
15000 * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
15001 * is no blacklist.)

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
adjustMatchersFunction · 0.70
generateHolderTypeFunction · 0.70

Tested by

no test coverage detected