Bug 1481585 [wpt PR 12344] - Fix some minor feature policy parsing issues, a=testonly
commite37fc84c4e56046701ad86eca10c9ad6aa934d08
authorEhsan Karamad <ekaramad@chromium.org>
Fri, 30 Nov 2018 18:03:09 +0000 (30 18:03 +0000)
committerJames Graham <james@hoppipolla.co.uk>
Tue, 11 Dec 2018 15:49:50 +0000 (11 15:49 +0000)
treed87072a22f2fba6a48acfc846b4b32045e6dd562
parent12ce64c268537d1fc83b40243941885a6ce9a246
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
testing/web-platform/tests/feature-policy/feature-policy-header-policy-allowed-for-some.https.sub.html
testing/web-platform/tests/feature-policy/feature-policy-header-policy-declined.https.sub.html