Update web-platform-tests to revision 5349c6a6327372f856ecbe07d863d468a4236726

This commit is contained in:
WPT Sync Bot 2018-12-08 20:32:47 -05:00
parent d17d5adb6d
commit c5c7a1f47a
19 changed files with 427 additions and 39 deletions

View file

@ -0,0 +1,2 @@
def main(request, response):
return "PASS" if request.POST["file_input"].file.read() == b"File to upload\n" else "FAIL"

View file

@ -0,0 +1,26 @@
<!doctype html>
<meta charset=utf8>
<title>File upload using testdriver</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<form id="form">
<input id="file_input" name="file_input" type="file">
</form>
<script>
let form = document.getElementById("form");
let input = document.getElementById("file_input");
test_driver
.send_keys(input, "{{fs_path(file_upload_data.txt)}}")
.then(() =>
fetch("file_upload.py",
{method: "POST",
body: new FormData(form)}))
.then(response => response.text())
.then(data => {
assert_equals(data, "PASS");
done();
})
.catch(() => assert_unreached("File upload failed"));
</script>

View file

@ -0,0 +1 @@
File to upload

View file

@ -17,17 +17,6 @@ partial interface Navigator {
[SameObject] readonly attribute XR xr;
};
enum XRSessionMode {
"inline",
"immersive-vr",
"immersive-ar"
};
dictionary XRSessionCreationOptions {
XRSessionMode mode = "inline";
XRPresentationContext outputContext;
};
enum XREnvironmentBlendMode {
"opaque",
"additive",
@ -64,6 +53,17 @@ enum XREnvironmentBlendMode {
attribute EventHandler onselectend;
};
enum XRSessionMode {
"inline",
"immersive-vr",
"immersive-ar"
};
dictionary XRSessionCreationOptions {
XRSessionMode mode = "inline";
XRPresentationContext outputContext;
};
callback XRFrameRequestCallback = void (DOMHighResTimeStamp time, XRFrame frame);
[SecureContext, Exposed=Window] interface XRFrame {

View file

@ -243,7 +243,7 @@ class FirefoxBrowser(Browser):
self.profile.set_preferences({
"marionette.port": self.marionette_port,
"network.dns.localDomains": ",".join(self.config.domains_set),
"dom.file.createInChild": True,
# TODO: Remove preferences once Firefox 64 is stable (Bug 905404)
"network.proxy.type": 0,
"places.history.enabled": False,

View file

@ -0,0 +1,3 @@
{{fs_path(sub_path.sub.txt)}}
{{fs_path(../sub_path.sub.txt)}}
{{fs_path(/sub_path.sub.txt)}}

View file

@ -117,6 +117,15 @@ server: http://localhost:{0}""".format(self.server.port).encode("ascii")
expected = b"localhost %d A %d B localhost C" % (port, port)
self.assertEqual(resp.read().rstrip(), expected)
def test_sub_fs_path(self):
resp = self.request("/subdir/sub_path.sub.txt")
root = os.path.abspath(doc_root)
expected = """%(root)s%(sep)ssubdir%(sep)ssub_path.sub.txt
%(root)s%(sep)ssub_path.sub.txt
%(root)s%(sep)ssub_path.sub.txt
""" % {"root": root, "sep": os.path.sep}
self.assertEqual(resp.read(), expected.encode("utf8"))
class TestTrickle(TestUsingServer):
def test_trickle(self):
#Actually testing that the response trickles in is not that easy

View file

@ -354,6 +354,8 @@ def sub(request, response, escape_type="html"):
sha224, sha256, sha384, and sha512. For example:
{{file_hash(md5, dom/interfaces.html)}}
fs_path(filepath)
The absolute path to a file inside the wpt document root
So for example in a setup running on localhost with a www
subdomain and a http server on ports 80 and 81::
@ -414,6 +416,21 @@ class SubFunctions(object):
return base64.b64encode(hash_obj.digest()).strip()
@staticmethod
def fs_path(request, path):
if not path.startswith("/"):
subdir = request.request_path[len(request.url_base):]
if "/" in subdir:
subdir = subdir.rsplit("/", 1)[0]
root_rel_path = subdir + "/" + path
else:
root_rel_path = path[1:]
root_rel_path = root_rel_path.replace("/", os.path.sep)
absolute_path = os.path.abspath(os.path.join(request.doc_root, root_rel_path))
if ".." in os.path.relpath(absolute_path, request.doc_root):
raise ValueError("Path outside wpt root")
return absolute_path
def template(request, content, escape_type="html"):
#TODO: There basically isn't any error handling here
tokenizer = ReplacementTokenizer()