From 3c645951c91329517ed5ea3807a93174dde9764c Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 13 Oct 2020 17:35:21 +0300 Subject: [PATCH 1/3] docs(*): fix docs on recently deprecated properties/methods In commits 9679e58ec4e9d9e4b743..3dd42cea688a7b6f7789, some properties and methods names including the terms whitelist/blacklist were deprecated in favor of new ones not including the terms. This commit fixes some typos in docs related to these changes and adds links to the new properties/methods in the changelog for easier access. Fixes #17088 --- CHANGELOG.md | 15 ++++++++++----- docs/content/guide/migration.ngdoc | 2 +- src/ng/compile.js | 12 ++++++------ src/ng/http.js | 2 +- src/ng/sce.js | 3 +-- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1256b7405b48..91b87b03e497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,11 +16,16 @@ ## Deprecation Notices -- Deprecated ~~`aHrefSanitizationWhitelist`~~. It is now `aHrefSanitizationTrustedUri` -- Deprecated ~~`imgSrcSanitizationWhitelist`~~. It is now `imgSrcSanitizationTrustedUri` -- Deprecated ~~`xsrfWhitelistedOrigins`~~. It is now `xsrfTrustedOrigins` -- Deprecated ~~`resourceUrlWhitelist`~~. It is now `trustedResourceUrlList` -- Deprecated ~~`resourceUrlBlacklist`~~. It is now `bannedResourceUrlList` +- Deprecated ~~`$compileProvider.aHrefSanitizationWhitelist`~~. + It is now [aHrefSanitizationTrustedUrlList](https://docs.angularjs.org/api/ng/provider/$compileProvider#aHrefSanitizationTrustedUrlList)`. +- Deprecated ~~`$compileProvider.imgSrcSanitizationWhitelist`~~. + It is now [imgSrcSanitizationTrustedUrlList](https://docs.angularjs.org/api/ng/provider/$compileProvider#imgSrcSanitizationTrustedUrlList). +- Deprecated ~~`$httpProvider.xsrfWhitelistedOrigins`~~. + It is now [xsrfTrustedOrigins](https://docs.angularjs.org/api/ng/provider/$httpProvider#xsrfTrustedOrigins). +- Deprecated ~~`$sceDelegateProvider.resourceUrlWhitelist`~~. + It is now [trustedResourceUrlList](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#trustedResourceUrlList). +- Deprecated ~~`$sceDelegateProvider.resourceUrlBlacklist`~~. + It is now [bannedResourceUrlList](https://docs.angularjs.org/api/ng/provider/$sceDelegateProvider#bannedResourceUrlList). For the purposes of backward compatibility, the previous symbols are aliased to their new symbol. diff --git a/docs/content/guide/migration.ngdoc b/docs/content/guide/migration.ngdoc index 9d5f85dc9106..7abf5b33ce54 100644 --- a/docs/content/guide/migration.ngdoc +++ b/docs/content/guide/migration.ngdoc @@ -2663,7 +2663,7 @@ $scope.findTemplate = function(templateName) { return templateCache[templateName]; }; -// Alternatively, use `$sceDelegateProvider..resourceUrlWhitelist()` (called +// Alternatively, use `$sceDelegateProvider.resourceUrlWhitelist()` (called // `trustedResourceUrlList()` from 1.8.1 onwards), which means you don't // have to use `$sce.trustAsResourceUrl()` at all: diff --git a/src/ng/compile.js b/src/ng/compile.js index 1ea8ecd71b6a..e48b5a98b6c5 100644 --- a/src/ng/compile.js +++ b/src/ng/compile.js @@ -1734,15 +1734,15 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { * @deprecated * sinceVersion="1.8.1" * - * This function is deprecated. Use {@link $compileProvider#aHrefSanitizationTrustedUrlList + * This method is deprecated. Use {@link $compileProvider#aHrefSanitizationTrustedUrlList * aHrefSanitizationTrustedUrlList} instead. */ Object.defineProperty(this, 'aHrefSanitizationWhitelist', { get: function() { return this.aHrefSanitizationTrustedUrlList; }, - set: function(regexp) { - this.aHrefSanitizationTrustedUrlList = regexp; + set: function(value) { + this.aHrefSanitizationTrustedUrlList = value; } }); @@ -1785,15 +1785,15 @@ function $CompileProvider($provide, $$sanitizeUriProvider) { * @deprecated * sinceVersion="1.8.1" * - * This function is deprecated. Use {@link $compileProvider#imgSrcSanitizationTrustedUrlList + * This method is deprecated. Use {@link $compileProvider#imgSrcSanitizationTrustedUrlList * imgSrcSanitizationTrustedUrlList} instead. */ Object.defineProperty(this, 'imgSrcSanitizationWhitelist', { get: function() { return this.imgSrcSanitizationTrustedUrlList; }, - set: function(regexp) { - this.imgSrcSanitizationTrustedUrlList = regexp; + set: function(value) { + this.imgSrcSanitizationTrustedUrlList = value; } }); diff --git a/src/ng/http.js b/src/ng/http.js index 15654d3ed550..aa179d584e52 100644 --- a/src/ng/http.js +++ b/src/ng/http.js @@ -436,7 +436,7 @@ function $HttpProvider() { * @deprecated * sinceVersion="1.8.1" * - * This function is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins} + * This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins} * instead. */ Object.defineProperty(this, 'xsrfWhitelistedOrigins', { diff --git a/src/ng/sce.js b/src/ng/sce.js index c0d18a501977..ffe98fa7b222 100644 --- a/src/ng/sce.js +++ b/src/ng/sce.js @@ -242,7 +242,6 @@ function $SceDelegateProvider() { * The **default value** when no trusted resource URL list has been explicitly set is the empty * array (i.e. there is no `bannedResourceUrlList`.) */ - this.bannedResourceUrlList = function(value) { if (arguments.length) { bannedResourceUrlList = adjustMatchers(value); @@ -258,7 +257,7 @@ function $SceDelegateProvider() { * @deprecated * sinceVersion="1.8.1" * - * This function is deprecated. Use {@link $sceDelegateProvider#bannedResourceUrlList + * This method is deprecated. Use {@link $sceDelegateProvider#bannedResourceUrlList * bannedResourceUrlList} instead. */ Object.defineProperty(this, 'resourceUrlBlacklist', { From a5371cf23d3547527d9f6c0bb19392c3dabff3ee Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 13 Oct 2020 23:58:49 +0300 Subject: [PATCH 2/3] fixup! docs(*): fix docs on recently deprecated properties/methods --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91b87b03e497..88d503632cae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,11 @@ ## Refactorings - **SanitizeUriProvider:** remove usages of whitelist - ([76738102](https:github.com/angular/angular.js/commit/767381020d88bda2855ac87ca6f00748907e14ff)) + ([76738102](https://github.com/angular/angular.js/commit/767381020d88bda2855ac87ca6f00748907e14ff)) - **httpProvider:** remove usages of whitelist and blacklist - ([c953af6b](https:github.com/angular/angular.js/commit/c953af6b8cfeefe4acc0ca358550eed5da8cfe00)) + ([c953af6b](https://github.com/angular/angular.js/commit/c953af6b8cfeefe4acc0ca358550eed5da8cfe00)) - **sceDelegateProvider:** remove usages of whitelist and blacklist - ([a206e267](https:github.com/angular/angular.js/commit/a206e2675c351c3cdcde3402978126774c1c5df9)) + ([a206e267](https://github.com/angular/angular.js/commit/a206e2675c351c3cdcde3402978126774c1c5df9)) ## Deprecation Notices From 527a2aef127583fda6879f4ab1d310b4e06c0632 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Tue, 13 Oct 2020 17:37:38 +0300 Subject: [PATCH 3/3] 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()`. --- 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