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

Commit e41f018

Browse files
committed
fix($sceDelegate): make resourceUrlWhitelist() is identical trustedResourceUrlList()
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
1 parent 71d19f1 commit e41f018

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/ng/sce.js

+20-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,26 @@ function $SceDelegateProvider() {
215215
}
216216
return trustedResourceUrlList;
217217
};
218-
this.resourceUrlWhitelist = this.trustedResourceUrlList;
218+
219+
/**
220+
* @ngdoc method
221+
* @name $sceDelegateProvider#resourceUrlWhitelist
222+
* @kind function
223+
*
224+
* @deprecated
225+
* sinceVersion="1.8.1"
226+
*
227+
* This method is deprecated. Use {@link $sceDelegateProvider#trustedResourceUrlList
228+
* trustedResourceUrlList} instead.
229+
*/
230+
Object.defineProperty(this, 'resourceUrlWhitelist', {
231+
get: function() {
232+
return this.trustedResourceUrlList;
233+
},
234+
set: function(value) {
235+
this.trustedResourceUrlList = value;
236+
}
237+
});
219238

220239
/**
221240
* @ngdoc method

0 commit comments

Comments
 (0)