Bug 1481585 [wpt PR 12344] - Fix some minor feature policy parsing issues, a=testonly

Automatic update from web-platform-tests
Fix some minor feature policy parsing issues

This CL makes the following changes to the feature policy parsing code:

  1- ParsedFeaturePolicyDeclaration holds a sorted vector of unique
     |origins|.
  2- AllowList uses std::set instead of std::vector.
  3- When parsing for list of origins, in case of matching all origins
     (*), the current set of origins is cleared.
  4- When comparing ParsedFeaturePolicyDeclaration, if both
     declarations include '*' then the set of origins are not compared.

The noticeable outcome of the CL is that parsed policy will ignore
repeated origins and will be sorted. This would make the feature lookup
algorithm more efficient.

Bug: 710324
Change-Id: I5c67ee2d6cff891304781bea0998e07739006a2e
Reviewed-on: https://chromium-review.googlesource.com/c/1161753
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Ian Clelland <iclelland@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#610887}

--

wpt-commits: e6c06e195cb0c9170dbd67c1aec2091fa2c687b4
wpt-pr: 12344
This commit is contained in:
Ehsan Karamad 2018-11-30 18:03:09 +00:00 коммит произвёл moz-wptsync-bot
Родитель 1e5a826250
Коммит b8444e20ce
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -16,8 +16,8 @@
// Test that fullscreen's allowlist is [same_origin, cross_origin, 'https://www.example.com']
test(function() {
assert_array_equals(
document.policy.getAllowlistForFeature('fullscreen'),
[same_origin, cross_origin, 'https://www.example.com']);
document.policy.getAllowlistForFeature('fullscreen').sort(),
[same_origin, cross_origin, 'https://www.example.com'].sort());
}, header_policy + ' -- test allowlist is [same_origin, cross_origin, https://www.example.com]');
// Test that fullscreen is allowed on same_origin, some cross_origin subframes.

Просмотреть файл

@ -17,7 +17,7 @@
test(function() {
assert_array_equals(
document.policy.getAllowlistForFeature('fullscreen'),
[cross_origin, 'https://www.example.com']);
[cross_origin, 'https://www.example.com'].sort());
}, header_policy + ' -- test allowlist is [cross_origin, https://www.example.com]');
// Test that fullscreen is disallowed on same_origin, allowed on some cross_origin subframes.