Commit ad77da0e authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[WPT/referrer-policy] Rename delivery_method to delivery_type

To align spec.src.json with other parts of common/security-features/
such as common.js.

Generated files will be updated after some more changes, not now.

Bug: 906850
Change-Id: I87479bcf8ec6cdbf08e10a38a79885940b51e457
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1716109
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Reviewed-by: default avatarHiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681065}
parent 5cfaf945
...@@ -13,7 +13,7 @@ import generate ...@@ -13,7 +13,7 @@ import generate
class ReferrerPolicyConfig(object): class ReferrerPolicyConfig(object):
def __init__(self): def __init__(self):
self.selection_pattern = '%(delivery_method)s/' + \ self.selection_pattern = '%(delivery_type)s/' + \
'%(origin)s/' + \ '%(origin)s/' + \
'%(source_protocol)s-%(target_protocol)s/' + \ '%(source_protocol)s-%(target_protocol)s/' + \
'%(subresource)s/' + \ '%(subresource)s/' + \
...@@ -24,7 +24,7 @@ class ReferrerPolicyConfig(object): ...@@ -24,7 +24,7 @@ class ReferrerPolicyConfig(object):
self.test_description_template = '''The referrer URL is %(expectation)s when a self.test_description_template = '''The referrer URL is %(expectation)s when a
document served over %(source_protocol)s requires an %(target_protocol)s document served over %(source_protocol)s requires an %(target_protocol)s
sub-resource via %(subresource)s using the %(delivery_method)s sub-resource via %(subresource)s using the %(delivery_type)s
delivery method with %(redirection)s and when delivery method with %(redirection)s and when
the target request is %(origin)s.''' the target request is %(origin)s.'''
...@@ -43,30 +43,30 @@ the target request is %(origin)s.''' ...@@ -43,30 +43,30 @@ the target request is %(origin)s.'''
os.path.join(script_directory, '..', '..')) os.path.join(script_directory, '..', '..'))
def handleDelivery(self, selection, spec): def handleDelivery(self, selection, spec):
delivery_method = selection['delivery_method'] delivery_type = selection['delivery_type']
delivery_value = spec['referrer_policy'] delivery_value = spec['referrer_policy']
meta = '' meta = ''
headers = [] headers = []
if delivery_value != None: if delivery_value != None:
if delivery_method == 'meta-referrer': if delivery_type == 'meta-referrer':
meta = \ meta = \
'<meta name="referrer" content="%s">' % delivery_value '<meta name="referrer" content="%s">' % delivery_value
elif delivery_method == 'http-rp': elif delivery_type == 'http-rp':
meta = \ meta = \
"<!-- No meta: Referrer policy delivered via HTTP headers. -->" "<!-- No meta: Referrer policy delivered via HTTP headers. -->"
headers.append('Referrer-Policy: ' + '%s' % delivery_value) headers.append('Referrer-Policy: ' + '%s' % delivery_value)
# TODO(kristijanburnik): Limit to WPT origins. # TODO(kristijanburnik): Limit to WPT origins.
headers.append('Access-Control-Allow-Origin: *') headers.append('Access-Control-Allow-Origin: *')
elif delivery_method == 'attr-referrer': elif delivery_type == 'attr-referrer':
# attr-referrer is supported by the JS test wrapper. # attr-referrer is supported by the JS test wrapper.
pass pass
elif delivery_method == 'rel-noreferrer': elif delivery_type == 'rel-noreferrer':
# rel=noreferrer is supported by the JS test wrapper. # rel=noreferrer is supported by the JS test wrapper.
pass pass
else: else:
raise ValueError('Not implemented delivery_method: ' \ raise ValueError('Not implemented delivery_type: ' \
+ delivery_method) + delivery_type)
return {"meta": meta, "headers": headers} return {"meta": meta, "headers": headers}
......
...@@ -128,7 +128,7 @@ def validate(spec_json, details): ...@@ -128,7 +128,7 @@ def validate(spec_json, details):
# Validate the test_expansion schema members. # Validate the test_expansion schema members.
details['object'] = test_expansion_schema details['object'] = test_expansion_schema
assert_contains_only_fields(test_expansion_schema, [ assert_contains_only_fields(test_expansion_schema, [
'expansion', 'delivery_method', 'redirection', 'origin', 'expansion', 'delivery_type', 'redirection', 'origin',
'source_protocol', 'target_protocol', 'subresource', 'expectation' 'source_protocol', 'target_protocol', 'subresource', 'expectation'
]) ])
# Validate excluded tests. # Validate excluded tests.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment