From 90160a3f3199a35d98e5e9ca3907fc2052d778dc Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 13 Oct 2020 17:37:38 +0300 Subject: [PATCH] fix($sceDelegate): make `resourceUrlWhitelist()` is identical `trustedResourceUrlList()` In commit a206e2675c351c3cdcde, `$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 --- src/ng/sce.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/ng/sce.js b/src/ng/sce.js index ffe98fa7b222..56d59a51c516 100644 --- a/src/ng/sce.js +++ b/src/ng/sce.js @@ -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