mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision bc60e6f82132cfc9a5b688c566c7772024b3c15c
This commit is contained in:
parent
449881f566
commit
29156ca9e2
223 changed files with 7517 additions and 2093 deletions
|
@ -3,62 +3,69 @@
|
|||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'common', 'security-features', 'tools'))
|
||||
sys.path.insert(
|
||||
0,
|
||||
os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)), '..', '..', '..', 'common',
|
||||
'security-features', 'tools'))
|
||||
import generate
|
||||
|
||||
|
||||
class MixedContentConfig(object):
|
||||
def __init__(self):
|
||||
self.selection_pattern = '%(subresource)s/' + \
|
||||
'%(opt_in_method)s/' + \
|
||||
'%(origin)s/' + \
|
||||
'%(context_nesting)s/' + \
|
||||
'%(redirection)s/'
|
||||
def __init__(self):
|
||||
self.selection_pattern = '%(subresource)s/' + \
|
||||
'%(delivery_type)s/' + \
|
||||
'%(delivery_value)s/' + \
|
||||
'%(origin)s/' + \
|
||||
'top-level/' + \
|
||||
'%(redirection)s/'
|
||||
|
||||
self.test_file_path_pattern = self.selection_pattern + \
|
||||
'%(spec_name)s/' + \
|
||||
'%(name)s.%(source_scheme)s.html'
|
||||
self.test_file_path_pattern = self.selection_pattern + \
|
||||
'%(spec_name)s/' + \
|
||||
'%(name)s.%(source_scheme)s.html'
|
||||
|
||||
self.test_description_template = '''opt_in_method: %(opt_in_method)s
|
||||
self.test_description_template = '''delivery_type: %(delivery_type)s
|
||||
delivery_value: %(delivery_value)s
|
||||
origin: %(origin)s
|
||||
source_scheme: %(source_scheme)s
|
||||
context_nesting: %(context_nesting)s
|
||||
context_nesting: top-level
|
||||
redirection: %(redirection)s
|
||||
subresource: %(subresource)s
|
||||
expectation: %(expectation)s
|
||||
'''
|
||||
|
||||
self.test_page_title_template = 'Mixed-Content: %s'
|
||||
self.test_page_title_template = 'Mixed-Content: %s'
|
||||
|
||||
self.helper_js = '/mixed-content/generic/mixed-content-test-case.js?pipe=sub'
|
||||
self.helper_js = '/mixed-content/generic/mixed-content-test-case.js?pipe=sub'
|
||||
|
||||
# For debug target only.
|
||||
self.sanity_checker_js = '/mixed-content/generic/sanity-checker.js'
|
||||
self.spec_json_js = '/mixed-content/spec_json.js'
|
||||
# For debug target only.
|
||||
self.sanity_checker_js = '/mixed-content/generic/sanity-checker.js'
|
||||
self.spec_json_js = '/mixed-content/spec_json.js'
|
||||
|
||||
self.test_case_name = 'MixedContentTestCase'
|
||||
self.test_case_name = 'MixedContentTestCase'
|
||||
|
||||
script_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
self.spec_directory = os.path.abspath(os.path.join(script_directory, '..', '..'))
|
||||
script_directory = os.path.dirname(os.path.abspath(__file__))
|
||||
self.spec_directory = os.path.abspath(
|
||||
os.path.join(script_directory, '..', '..'))
|
||||
|
||||
def handleDelivery(self, selection, spec):
|
||||
opt_in_method = selection['opt_in_method']
|
||||
def handleDelivery(self, selection, spec):
|
||||
delivery_type = selection['delivery_type']
|
||||
delivery_value = selection['delivery_value']
|
||||
|
||||
meta = ''
|
||||
headers = []
|
||||
meta = ''
|
||||
headers = []
|
||||
|
||||
# TODO(kristijanburnik): Implement the opt-in-method here.
|
||||
if opt_in_method == 'meta-csp':
|
||||
meta = '<meta http-equiv="Content-Security-Policy" ' + \
|
||||
'content="block-all-mixed-content">'
|
||||
elif opt_in_method == 'http-csp':
|
||||
headers.append("Content-Security-Policy: block-all-mixed-content")
|
||||
elif opt_in_method == 'no-opt-in':
|
||||
pass
|
||||
else:
|
||||
raise ValueError("Invalid opt_in_method %s" % opt_in_method)
|
||||
if delivery_value is not None:
|
||||
if delivery_type == 'meta':
|
||||
meta = '<meta http-equiv="Content-Security-Policy" ' + \
|
||||
'content="block-all-mixed-content">'
|
||||
elif delivery_type == 'http-rp':
|
||||
headers.append(
|
||||
"Content-Security-Policy: block-all-mixed-content")
|
||||
else:
|
||||
raise ValueError("Invalid delivery_type %s" % delivery_type)
|
||||
|
||||
return {"meta": meta, "headers": headers}
|
||||
return {"meta": meta, "headers": headers}
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue