mirror of
https://github.com/servo/servo.git
synced 2025-06-28 02:53:48 +01:00
Update web-platform-tests to revision cb40575e1a57892476f3e326355674d492dedbd2
This commit is contained in:
parent
0afe412d63
commit
fa6a725a86
170 changed files with 1958 additions and 664 deletions
|
@ -1,4 +1,4 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript"), ("Cache-control", "public, max-age=100")]
|
||||
body = "throw('fox');"
|
||||
headers = [(b"Content-Type", b"text/javascript"), (b"Cache-control", b"public, max-age=100")]
|
||||
body = u"throw('fox');"
|
||||
return 200, headers, body
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import time
|
||||
|
||||
def main(request, response):
|
||||
response.headers.append("Content-Type", "text/javascript")
|
||||
response.headers.append(b"Content-Type", b"text/javascript")
|
||||
try:
|
||||
script_id = int(request.GET.first("id"))
|
||||
delay = int(request.GET.first("sec"))
|
||||
script_id = int(request.GET.first(b"id"))
|
||||
delay = int(request.GET.first(b"sec"))
|
||||
except:
|
||||
response.set_error(400, "Invalid parameter")
|
||||
response.set_error(400, u"Invalid parameter")
|
||||
|
||||
time.sleep(int(delay))
|
||||
|
||||
return "log('%s')" % script_id
|
||||
return u"log('%s')" % script_id
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import time
|
||||
|
||||
def main(request, response):
|
||||
delay = float(request.GET.first("ms", 500))
|
||||
time.sleep(delay / 1E3);
|
||||
delay = float(request.GET.first(b"ms", 500))
|
||||
time.sleep(delay / 1E3)
|
||||
|
||||
return [("Content-type", "text/javascript")], "export let delayedLoaded = true;"
|
||||
return [(b"Content-type", b"text/javascript")], u"export let delayedLoaded = true;"
|
||||
|
|
|
@ -1,22 +1,25 @@
|
|||
import random
|
||||
import time
|
||||
|
||||
from wptserve.utils import isomorphic_decode
|
||||
|
||||
|
||||
"""
|
||||
This script serves
|
||||
"""
|
||||
|
||||
def main(request, response):
|
||||
inlineOrExternal = request.GET.first("inlineOrExternal", "null")
|
||||
hasBlockingStylesheet = request.GET.first("hasBlockingStylesheet", "true") == "true"
|
||||
result = request.GET.first("result", "success")
|
||||
type = "text/javascript" if request.GET.first("type", "classic") == "classic" else "module"
|
||||
inlineOrExternal = request.GET.first(b"inlineOrExternal", b"null")
|
||||
hasBlockingStylesheet = request.GET.first(b"hasBlockingStylesheet", b"true") == b"true"
|
||||
result = request.GET.first(b"result", b"success")
|
||||
type = u"text/javascript" if request.GET.first(b"type", b"classic") == b"classic" else u"module"
|
||||
|
||||
response.headers.set("Content-Type", "text/html; charset=utf-8")
|
||||
response.headers.set("Transfer-Encoding", "chunked")
|
||||
response.headers.set(b"Content-Type", b"text/html; charset=utf-8")
|
||||
response.headers.set(b"Transfer-Encoding", b"chunked")
|
||||
response.write_status_headers()
|
||||
|
||||
# Step 1: Start parsing.
|
||||
body = """<!DOCTYPE html>
|
||||
body = u"""<!DOCTYPE html>
|
||||
<head>
|
||||
<script>
|
||||
parent.postMessage("fox", "*");
|
||||
|
@ -24,33 +27,33 @@ def main(request, response):
|
|||
"""
|
||||
|
||||
if hasBlockingStylesheet:
|
||||
body += """
|
||||
body += u"""
|
||||
<link rel="stylesheet" href="slow-flag-setter.py?result=css&cache=%f">
|
||||
""" % random.random()
|
||||
|
||||
body += """
|
||||
body += u"""
|
||||
</head>
|
||||
<body>
|
||||
"""
|
||||
|
||||
if inlineOrExternal == "inline" or inlineOrExternal == "external" or inlineOrExternal == "empty-src":
|
||||
body += """
|
||||
if inlineOrExternal == b"inline" or inlineOrExternal == b"external" or inlineOrExternal == b"empty-src":
|
||||
body += u"""
|
||||
<streaming-element>
|
||||
"""
|
||||
|
||||
# Trigger DOM processing
|
||||
body += "A" * 100000
|
||||
body += u"A" * 100000
|
||||
|
||||
response.writer.write("%x\r\n" % len(body))
|
||||
response.writer.write(u"%x\r\n" % len(body))
|
||||
response.writer.write(body)
|
||||
response.writer.write("\r\n")
|
||||
response.writer.write(u"\r\n")
|
||||
response.writer.flush()
|
||||
|
||||
body = ""
|
||||
body = u""
|
||||
|
||||
if inlineOrExternal == "inline":
|
||||
if inlineOrExternal == b"inline":
|
||||
time.sleep(1)
|
||||
body += """
|
||||
body += u"""
|
||||
<script id="s1" type="%s"
|
||||
onload="scriptOnLoad()"
|
||||
onerror="scriptOnError(event)">
|
||||
|
@ -59,26 +62,26 @@ def main(request, response):
|
|||
} else {
|
||||
window.didExecute = "executed";
|
||||
}
|
||||
""" % (type)
|
||||
if result == "parse-error":
|
||||
body += "1=2 parse error\n"
|
||||
""" % type
|
||||
if result == b"parse-error":
|
||||
body += u"1=2 parse error\n"
|
||||
|
||||
body += """
|
||||
body += u"""
|
||||
</script>
|
||||
</streaming-element>
|
||||
"""
|
||||
elif inlineOrExternal == "external":
|
||||
elif inlineOrExternal == b"external":
|
||||
time.sleep(1)
|
||||
body += """
|
||||
body += u"""
|
||||
<script id="s1" type="%s"
|
||||
src="slow-flag-setter.py?result=%s&cache=%s"
|
||||
onload="scriptOnLoad()"
|
||||
onerror="scriptOnError(event)"></script>
|
||||
</streaming-element>
|
||||
""" % (type, result, random.random())
|
||||
elif inlineOrExternal == "empty-src":
|
||||
""" % (type, isomorphic_decode(result), random.random())
|
||||
elif inlineOrExternal == b"empty-src":
|
||||
time.sleep(1)
|
||||
body += """
|
||||
body += u"""
|
||||
<script id="s1" type="%s"
|
||||
src=""
|
||||
onload="scriptOnLoad()"
|
||||
|
@ -90,12 +93,12 @@ def main(request, response):
|
|||
# // wasn't blocked by stylesheets as expected.
|
||||
|
||||
# Trigger DOM processing
|
||||
body += "B" * 100000
|
||||
body += u"B" * 100000
|
||||
|
||||
response.writer.write("%x\r\n" % len(body))
|
||||
response.writer.write(u"%x\r\n" % len(body))
|
||||
response.writer.write(body)
|
||||
response.writer.write("\r\n")
|
||||
response.writer.write(u"\r\n")
|
||||
|
||||
response.writer.write("0\r\n")
|
||||
response.writer.write("\r\n")
|
||||
response.writer.write(u"0\r\n")
|
||||
response.writer.write(u"\r\n")
|
||||
response.writer.flush()
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
import time
|
||||
|
||||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
headers = [(b"Content-Type", b"text/javascript")]
|
||||
|
||||
result = request.GET.first("result", "success")
|
||||
if result == "css":
|
||||
result = request.GET.first(b"result", b"success")
|
||||
if result == b"css":
|
||||
time.sleep(3)
|
||||
headers = [("Content-Type", "text/css")]
|
||||
body = ""
|
||||
headers = [(b"Content-Type", b"text/css")]
|
||||
body = u""
|
||||
else:
|
||||
time.sleep(2)
|
||||
|
||||
body = """
|
||||
body = u"""
|
||||
fetch('exec');
|
||||
console.log('exec');
|
||||
if (!window.readyToEvaluate) {
|
||||
|
@ -21,9 +21,9 @@ def main(request, response):
|
|||
window.didExecute = "executed";
|
||||
}
|
||||
"""
|
||||
if result == "parse-error":
|
||||
body = "1=2 parse error;"
|
||||
if result == "fetch-error":
|
||||
return 404, [('Content-Type', 'text/plain')], """window.didExecute = "fetch error";"""
|
||||
if result == b"parse-error":
|
||||
body = u"1=2 parse error;"
|
||||
if result == b"fetch-error":
|
||||
return 404, [(b'Content-Type', b'text/plain')], u"""window.didExecute = "fetch error";"""
|
||||
|
||||
return headers, body
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
def main(request, response):
|
||||
origin = request.headers.get("origin")
|
||||
origin = request.headers.get(b"origin")
|
||||
|
||||
if origin is not None:
|
||||
response.headers.set("Access-Control-Allow-Origin", origin)
|
||||
response.headers.set("Access-Control-Allow-Methods", "GET")
|
||||
response.headers.set("Access-Control-Allow-Credentials", "true")
|
||||
response.headers.set(b"Access-Control-Allow-Origin", origin)
|
||||
response.headers.set(b"Access-Control-Allow-Methods", b"GET")
|
||||
response.headers.set(b"Access-Control-Allow-Credentials", b"true")
|
||||
|
||||
if request.method == "OPTIONS":
|
||||
return ""
|
||||
if request.method == u"OPTIONS":
|
||||
return u""
|
||||
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
milk = request.cookies.first("milk", None)
|
||||
headers = [(b"Content-Type", b"text/javascript")]
|
||||
milk = request.cookies.first(b"milk", None)
|
||||
|
||||
if milk is None:
|
||||
return headers, "var included = false;"
|
||||
elif milk.value == "yes":
|
||||
return headers, "var included = true;"
|
||||
return headers, u"var included = false;"
|
||||
elif milk.value == b"yes":
|
||||
return headers, u"var included = true;"
|
||||
|
||||
return headers, "var included = false;"
|
||||
return headers, u"var included = false;"
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import re
|
||||
|
||||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
test = request.GET.first('test')
|
||||
assert(re.match('^[a-zA-Z0-9_]+$', test));
|
||||
headers = [(b"Content-Type", b"text/javascript")]
|
||||
test = request.GET.first(b'test')
|
||||
assert(re.match(b'^[a-zA-Z0-9_]+$', test))
|
||||
|
||||
if test.find('_load') >= 0:
|
||||
if test.find(b'_load') >= 0:
|
||||
status = 200
|
||||
content = '"use strict"; %s.executed = true;' % test
|
||||
content = b'"use strict"; %s.executed = true;' % test
|
||||
else:
|
||||
status = 404
|
||||
content = '"use strict"; %s.test.step(function() { assert_unreached("404 script should not be executed"); });' % test
|
||||
content = b'"use strict"; %s.test.step(function() { assert_unreached("404 script should not be executed"); });' % test
|
||||
|
||||
return status, headers, content
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
body = "test2_token = \"script executed\";"
|
||||
headers = [(b"Content-Type", b"text/javascript")]
|
||||
body = u"test2_token = \"script executed\";"
|
||||
return 200, headers, body
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
def main(request, response):
|
||||
headers = [("Content-Type", "text/javascript")]
|
||||
body = "test1_token = \"script executed\";"
|
||||
headers = [(b"Content-Type", b"text/javascript")]
|
||||
body = u"test1_token = \"script executed\";"
|
||||
return 404, headers, body
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import os
|
||||
|
||||
from wptserve.utils import isomorphic_decode
|
||||
|
||||
def main(request, response):
|
||||
directory = os.path.dirname(__file__)
|
||||
directory = os.path.dirname(isomorphic_decode(__file__))
|
||||
|
||||
try:
|
||||
file_name = request.GET.first("fn")
|
||||
content_type = request.GET.first("ct")
|
||||
with open(os.path.join(directory, file_name), "rb") as fh:
|
||||
file_name = request.GET.first(b"fn")
|
||||
content_type = request.GET.first(b"ct")
|
||||
with open(os.path.join(directory, isomorphic_decode(file_name)), u"rb") as fh:
|
||||
content = fh.read()
|
||||
|
||||
response.headers.set("Content-Type", content_type)
|
||||
response.headers.set(b"Content-Type", content_type)
|
||||
response.content = content
|
||||
except:
|
||||
response.set_error(400, "Not enough parameters or file not found")
|
||||
response.set_error(400, u"Not enough parameters or file not found")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue