Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($sceDelegate): make resourceUrlWhitelist() is identical `truste…
Browse files Browse the repository at this point in the history
…dResourceUrlList()`

In commit a206e26, `$sceDelegateProvider`'s
`resourceUrlWhitelist()` was deprecated in favor of the new
`trustedResourceUrlList()`. However, although both properties were
assigned the same value, it was possible for an app to break if one of
the properties was overwritten in one part of the app (or a 3rd-party
library) while another part of the app interacts with the other,
non-overwritten property.

This commit fixes it by making `resourceUrlWhitelist()` a getter/setter
that delegates to `trustedResourceUrlList()`, ensuring that the two
properties will remain in sync. This, also, makes it consistent with
other similar deprecated properties, such as `$sceDelegateProvider`'s
`resourceUrlBlacklist()`.

Closes #17090
  • Loading branch information
gkalpak committed Oct 14, 2020
1 parent 71d19f1 commit e41f018
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/ng/sce.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,26 @@ function $SceDelegateProvider() {
}
return trustedResourceUrlList;
};
this.resourceUrlWhitelist = this.trustedResourceUrlList;

/**
* @ngdoc method
* @name $sceDelegateProvider#resourceUrlWhitelist
* @kind function
*
* @deprecated
* sinceVersion="1.8.1"
*
* This method is deprecated. Use {@link $sceDelegateProvider#trustedResourceUrlList
* trustedResourceUrlList} instead.
*/
Object.defineProperty(this, 'resourceUrlWhitelist', {
get: function() {
return this.trustedResourceUrlList;
},
set: function(value) {
this.trustedResourceUrlList = value;
}
});

/**
* @ngdoc method
Expand Down

0 comments on commit e41f018

Please sign in to comment.