mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests and CSS tests.
- Update CSS tests to revision e05bfd5e30ed662c2f8a353577003f8eed230180. - Update web-platform-tests to revision a052787dd5c069a340031011196b73affbd68cd9.
This commit is contained in:
parent
fb4f421c8b
commit
296fa2512b
21852 changed files with 2080936 additions and 892894 deletions
|
@ -5,6 +5,7 @@ from __future__ import print_function
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
|
@ -18,9 +19,11 @@ from multiprocessing import Process, Event
|
|||
from ..localpaths import repo_root
|
||||
|
||||
import sslutils
|
||||
from manifest.sourcefile import read_script_metadata
|
||||
from wptserve import server as wptserve, handlers
|
||||
from wptserve import stash
|
||||
from wptserve.logger import set_logger
|
||||
from wptserve.handlers import filesystem_path
|
||||
from mod_pywebsocket import standalone as pywebsocket
|
||||
|
||||
def replace_end(s, old, new):
|
||||
|
@ -33,7 +36,9 @@ def replace_end(s, old, new):
|
|||
|
||||
|
||||
class WorkersHandler(object):
|
||||
def __init__(self):
|
||||
def __init__(self, base_path=None, url_base="/"):
|
||||
self.base_path = base_path
|
||||
self.url_base = url_base
|
||||
self.handler = handlers.handler(self.handle_request)
|
||||
|
||||
def __call__(self, request, response):
|
||||
|
@ -41,19 +46,33 @@ class WorkersHandler(object):
|
|||
|
||||
def handle_request(self, request, response):
|
||||
worker_path = replace_end(request.url_parts.path, ".worker.html", ".worker.js")
|
||||
meta = "\n".join(self._get_meta(request))
|
||||
return """<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
%(meta)s
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
fetch_tests_from_worker(new Worker("%s"));
|
||||
fetch_tests_from_worker(new Worker("%(worker_path)s"));
|
||||
</script>
|
||||
""" % (worker_path,)
|
||||
""" % {"meta": meta, "worker_path": worker_path}
|
||||
|
||||
def _get_meta(self, request):
|
||||
path = filesystem_path(self.base_path, request, self.url_base)
|
||||
path = path.replace(".any.worker.html", ".any.js")
|
||||
path = path.replace(".worker.html", ".worker.js")
|
||||
with open(path, "rb") as f:
|
||||
for key, value in read_script_metadata(f):
|
||||
if key == b"timeout":
|
||||
if value == b"long":
|
||||
yield '<meta name="timeout" content="long">'
|
||||
|
||||
|
||||
class AnyHtmlHandler(object):
|
||||
def __init__(self):
|
||||
def __init__(self, base_path=None, url_base="/"):
|
||||
self.base_path = base_path
|
||||
self.url_base = url_base
|
||||
self.handler = handlers.handler(self.handle_request)
|
||||
|
||||
def __call__(self, request, response):
|
||||
|
@ -61,9 +80,11 @@ class AnyHtmlHandler(object):
|
|||
|
||||
def handle_request(self, request, response):
|
||||
test_path = replace_end(request.url_parts.path, ".any.html", ".any.js")
|
||||
meta = "\n".join(self._get_meta(request))
|
||||
return """\
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
%(meta)s
|
||||
<script>
|
||||
self.GLOBAL = {
|
||||
isWindow: function() { return true; },
|
||||
|
@ -73,12 +94,26 @@ self.GLOBAL = {
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id=log></div>
|
||||
<script src="%s"></script>
|
||||
""" % (test_path,)
|
||||
<script src="%(test_path)s"></script>
|
||||
""" % {"meta": meta, "test_path": test_path}
|
||||
|
||||
def _get_meta(self, request):
|
||||
path = filesystem_path(self.base_path, request, self.url_base)
|
||||
path = path.replace(".any.html", ".any.js")
|
||||
with open(path, "rb") as f:
|
||||
for key, value in read_script_metadata(f):
|
||||
if key == b"timeout":
|
||||
if value == b"long":
|
||||
yield '<meta name="timeout" content="long">'
|
||||
elif key == b"script":
|
||||
attribute = value.decode('utf-8').replace('"', """).replace(">", ">")
|
||||
yield '<script src="%s"></script>' % attribute
|
||||
|
||||
|
||||
class AnyWorkerHandler(object):
|
||||
def __init__(self):
|
||||
def __init__(self, base_path=None, url_base="/"):
|
||||
self.base_path = base_path
|
||||
self.url_base = url_base
|
||||
self.handler = handlers.handler(self.handle_request)
|
||||
|
||||
def __call__(self, request, response):
|
||||
|
@ -86,15 +121,28 @@ class AnyWorkerHandler(object):
|
|||
|
||||
def handle_request(self, request, response):
|
||||
test_path = replace_end(request.url_parts.path, ".any.worker.js", ".any.js")
|
||||
meta = "\n".join(self._get_meta(request))
|
||||
return """\
|
||||
%(meta)s
|
||||
self.GLOBAL = {
|
||||
isWindow: function() { return false; },
|
||||
isWorker: function() { return true; },
|
||||
};
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("%s");
|
||||
importScripts("%(test_path)s");
|
||||
done();
|
||||
""" % (test_path,)
|
||||
""" % {"meta": meta, "test_path": test_path}
|
||||
|
||||
def _get_meta(self, request):
|
||||
path = filesystem_path(self.base_path, request, self.url_base)
|
||||
path = path.replace(".any.worker.js", ".any.js")
|
||||
with open(path, "rb") as f:
|
||||
for key, value in read_script_metadata(f):
|
||||
if key == b"timeout":
|
||||
pass
|
||||
elif key == b"script":
|
||||
attribute = value.decode('utf-8').replace("\\", "\\\\").replace('"', '\\"')
|
||||
yield 'importScripts("%s")' % attribute
|
||||
|
||||
|
||||
rewrites = [("GET", "/resources/WebIDLParser.js", "/resources/webidl2/lib/webidl2.js")]
|
||||
|
@ -116,11 +164,7 @@ class RoutesBuilder(object):
|
|||
("*", "{spec}/tools/*", handlers.ErrorHandler(404)),
|
||||
("*", "/serve.py", handlers.ErrorHandler(404))]
|
||||
|
||||
self.static = [
|
||||
("GET", "*.worker.html", WorkersHandler()),
|
||||
("GET", "*.any.html", AnyHtmlHandler()),
|
||||
("GET", "*.any.worker.js", AnyWorkerHandler()),
|
||||
]
|
||||
self.static = []
|
||||
|
||||
self.mountpoint_routes = OrderedDict()
|
||||
|
||||
|
@ -144,9 +188,14 @@ class RoutesBuilder(object):
|
|||
|
||||
self.mountpoint_routes[url_base] = []
|
||||
|
||||
routes = [("GET", "*.asis", handlers.AsIsHandler),
|
||||
("*", "*.py", handlers.PythonScriptHandler),
|
||||
("GET", "*", handlers.FileHandler)]
|
||||
routes = [
|
||||
("GET", "*.worker.html", WorkersHandler),
|
||||
("GET", "*.any.html", AnyHtmlHandler),
|
||||
("GET", "*.any.worker.js", AnyWorkerHandler),
|
||||
("GET", "*.asis", handlers.AsIsHandler),
|
||||
("*", "*.py", handlers.PythonScriptHandler),
|
||||
("GET", "*", handlers.FileHandler)
|
||||
]
|
||||
|
||||
for (method, suffix, handler_cls) in routes:
|
||||
self.mountpoint_routes[url_base].append(
|
||||
|
@ -601,7 +650,11 @@ def main():
|
|||
|
||||
setup_logger(config["log_level"])
|
||||
|
||||
with stash.StashServer((config["host"], get_port()), authkey=str(uuid.uuid4())):
|
||||
stash_address = None
|
||||
if config["bind_hostname"]:
|
||||
stash_address = (config["host"], get_port())
|
||||
|
||||
with stash.StashServer(stash_address, authkey=str(uuid.uuid4())):
|
||||
with get_ssl_environment(config) as ssl_env:
|
||||
config_, servers = start(config, ssl_env, build_routes(config["aliases"]), **kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue