mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 4333a1d2f109795547fc5e22ebfc8481fa649de7
This commit is contained in:
parent
728ebcc932
commit
8c46b67f8e
456 changed files with 10561 additions and 5108 deletions
|
@ -65,7 +65,8 @@ class WrapperHandler(object):
|
|||
if query:
|
||||
query = "?" + query
|
||||
meta = "\n".join(self._get_meta(request))
|
||||
response.content = self.wrapper % {"meta": meta, "path": path, "query": query}
|
||||
script = "\n".join(self._get_script(request))
|
||||
response.content = self.wrapper % {"meta": meta, "script": script, "path": path, "query": query}
|
||||
wrap_pipeline(path, request, response)
|
||||
|
||||
def _get_path(self, path, resource_path):
|
||||
|
@ -93,7 +94,7 @@ class WrapperHandler(object):
|
|||
return path
|
||||
|
||||
def _get_metadata(self, request):
|
||||
"""Get an iterator over script metadata based on //META comments in the
|
||||
"""Get an iterator over script metadata based on // META comments in the
|
||||
associated js file.
|
||||
|
||||
:param request: The Request being processed.
|
||||
|
@ -105,7 +106,7 @@ class WrapperHandler(object):
|
|||
|
||||
def _get_meta(self, request):
|
||||
"""Get an iterator over strings to inject into the wrapper document
|
||||
based on //META comments in the associated js file.
|
||||
based on // META comments in the associated js file.
|
||||
|
||||
:param request: The Request being processed.
|
||||
"""
|
||||
|
@ -114,6 +115,17 @@ class WrapperHandler(object):
|
|||
if replacement:
|
||||
yield replacement
|
||||
|
||||
def _get_script(self, request):
|
||||
"""Get an iterator over strings to inject into the wrapper document
|
||||
based on // META comments in the associated js file.
|
||||
|
||||
:param request: The Request being processed.
|
||||
"""
|
||||
for key, value in self._get_metadata(request):
|
||||
replacement = self._script_replacement(key, value)
|
||||
if replacement:
|
||||
yield replacement
|
||||
|
||||
@abc.abstractproperty
|
||||
def path_replace(self):
|
||||
# A list containing a mix of 2 item tuples with (input suffix, output suffix)
|
||||
|
@ -159,14 +171,17 @@ class HtmlWrapperHandler(WrapperHandler):
|
|||
if key == b"timeout":
|
||||
if value == b"long":
|
||||
return '<meta name="timeout" content="long">'
|
||||
if key == b"script":
|
||||
attribute = value.decode('utf-8').replace("&", "&").replace('"', """)
|
||||
return '<script src="%s"></script>' % attribute
|
||||
if key == b"title":
|
||||
value = value.decode('utf-8').replace("&", "&").replace("<", "<")
|
||||
return '<title>%s</title>' % value
|
||||
return None
|
||||
|
||||
def _script_replacement(self, key, value):
|
||||
if key == b"script":
|
||||
attribute = value.decode('utf-8').replace("&", "&").replace('"', """)
|
||||
return '<script src="%s"></script>' % attribute
|
||||
return None
|
||||
|
||||
|
||||
class WorkersHandler(HtmlWrapperHandler):
|
||||
global_type = b"dedicatedworker"
|
||||
|
@ -191,6 +206,7 @@ class WindowHandler(HtmlWrapperHandler):
|
|||
%(meta)s
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
%(script)s
|
||||
<div id=log></div>
|
||||
<script src="%(path)s"></script>
|
||||
"""
|
||||
|
@ -210,6 +226,7 @@ self.GLOBAL = {
|
|||
</script>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
%(script)s
|
||||
<div id=log></div>
|
||||
<script src="%(path)s"></script>
|
||||
"""
|
||||
|
@ -260,14 +277,21 @@ self.GLOBAL = {
|
|||
isWorker: function() { return true; },
|
||||
};
|
||||
importScripts("/resources/testharness.js");
|
||||
%(script)s
|
||||
importScripts("%(path)s");
|
||||
done();
|
||||
"""
|
||||
|
||||
def _meta_replacement(self, key, value):
|
||||
return None
|
||||
|
||||
def _script_replacement(self, key, value):
|
||||
if key == b"script":
|
||||
attribute = value.decode('utf-8').replace("\\", "\\\\").replace('"', '\\"')
|
||||
return 'importScripts("%s")' % attribute
|
||||
if key == b"title":
|
||||
value = value.decode('utf-8').replace("\\", "\\\\").replace('"', '\\"')
|
||||
return 'self.META_TITLE = "%s";' % value
|
||||
return None
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue