mirror of
https://github.com/servo/servo.git
synced 2025-08-09 07:25:35 +01:00
Update web-platform-tests to revision b'7af9d6ec48ab04043a2bea85a3599904a1a19efa'
This commit is contained in:
parent
8050c95e31
commit
87be1008de
2742 changed files with 142451 additions and 40667 deletions
|
@ -32,7 +32,7 @@
|
|||
metadata: {
|
||||
content_type: "application/reports+json",
|
||||
},
|
||||
}), "receive report about redirected resource");
|
||||
}, true /* retain */), "receive report about redirected resource");
|
||||
assert_true(await reportExists({
|
||||
// This happens to be where we're redirected to.
|
||||
url: getURLForResourceWithNoPolicy(),
|
||||
|
|
|
@ -247,12 +247,14 @@ function _isSubsetOf(obj1, obj2) {
|
|||
* expected.
|
||||
*/
|
||||
|
||||
async function reportExists(expected) {
|
||||
async function reportExists(expected, retain_reports) {
|
||||
var timeout =
|
||||
document.querySelector("meta[name=timeout][content=long]") ? 50 : 1;
|
||||
var reportLocation =
|
||||
"/network-error-logging/support/report.py?op=retrieve_report&timeout=" +
|
||||
"/reporting/resources/report.py?op=retrieve_report&timeout=" +
|
||||
timeout + "&reportID=" + reportID;
|
||||
if (retain_reports)
|
||||
reportLocation += "&retain=1";
|
||||
const response = await fetch(reportLocation);
|
||||
const json = await response.json();
|
||||
for (const report of json) {
|
||||
|
@ -268,11 +270,13 @@ async function reportExists(expected) {
|
|||
* expected.
|
||||
*/
|
||||
|
||||
async function reportsExist(expected_reports) {
|
||||
async function reportsExist(expected_reports, retain_reports) {
|
||||
const timeout = 10;
|
||||
let reportLocation =
|
||||
"/network-error-logging/support/report.py?op=retrieve_report&timeout=" +
|
||||
"/reporting/resources/report.py?op=retrieve_report&timeout=" +
|
||||
timeout + "&reportID=" + reportID;
|
||||
if (retain_reports)
|
||||
reportLocation += "&retain";
|
||||
// There must be the report of pass.png, so adding 1.
|
||||
const min_count = expected_reports.length + 1;
|
||||
reportLocation += "&min_count=" + min_count;
|
||||
|
|
|
@ -2,5 +2,5 @@ Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
|||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Report-To: { "group": "nel-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/network-error-logging/support/report.py?op=put&reportID={{GET[id]}}" }] }
|
||||
Report-To: { "group": "nel-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?op=put&reportID={{GET[id]}}" }] }
|
||||
NEL: {"report_to": "nel-group", "max_age": 10886400, "success_fraction": {{GET[success_fraction]}}}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
import time
|
||||
import json
|
||||
import re
|
||||
|
||||
from wptserve.utils import isomorphic_decode
|
||||
|
||||
def retrieve_from_stash(request, key, timeout, min_count, default_value):
|
||||
t0 = time.time()
|
||||
while time.time() - t0 < timeout:
|
||||
time.sleep(0.5)
|
||||
value = request.server.stash.take(key=key)
|
||||
if value is not None and len(value) >= min_count:
|
||||
request.server.stash.put(key=key, value=value)
|
||||
return json.dumps(value)
|
||||
|
||||
return default_value
|
||||
|
||||
def main(request, response):
|
||||
# Handle CORS preflight requests
|
||||
if request.method == u'OPTIONS':
|
||||
# Always reject preflights for one subdomain
|
||||
if b"www2" in request.headers[b"Origin"]:
|
||||
return (400, [], u"CORS preflight rejected for www2")
|
||||
return [
|
||||
(b"Content-Type", b"text/plain"),
|
||||
(b"Access-Control-Allow-Origin", b"*"),
|
||||
(b"Access-Control-Allow-Methods", b"post"),
|
||||
(b"Access-Control-Allow-Headers", b"Content-Type"),
|
||||
], u"CORS allowed"
|
||||
|
||||
op = request.GET.first(b"op");
|
||||
key = request.GET.first(b"reportID")
|
||||
|
||||
if op == b"retrieve_report":
|
||||
try:
|
||||
timeout = float(request.GET.first(b"timeout"))
|
||||
except:
|
||||
timeout = 0.5
|
||||
try:
|
||||
min_count = int(request.GET.first(b"min_count"))
|
||||
except:
|
||||
min_count = 1
|
||||
return [(b"Content-Type", b"application/json")], retrieve_from_stash(request, key, timeout, min_count, u'[]')
|
||||
|
||||
# append new reports
|
||||
new_reports = json.loads(request.body)
|
||||
for report in new_reports:
|
||||
report[u"metadata"] = {
|
||||
u"content_type": isomorphic_decode(request.headers[b"Content-Type"]),
|
||||
}
|
||||
with request.server.stash.lock:
|
||||
reports = request.server.stash.take(key=key)
|
||||
if reports is None:
|
||||
reports = []
|
||||
reports.extend(new_reports)
|
||||
request.server.stash.put(key=key, value=reports)
|
||||
|
||||
# return acknowledgement report
|
||||
return [(b"Content-Type", b"text/plain")], u"Recorded report"
|
|
@ -2,5 +2,5 @@ Expires: Mon, 26 Jul 1997 05:00:00 GMT
|
|||
Cache-Control: no-store, no-cache, must-revalidate
|
||||
Cache-Control: post-check=0, pre-check=0, false
|
||||
Pragma: no-cache
|
||||
Report-To: { "group": "nel-group", "max_age": 10886400, "include_subdomains": true, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/network-error-logging/support/report.py?op=put&reportID={{GET[id]}}" }] }
|
||||
Report-To: { "group": "nel-group", "max_age": 10886400, "include_subdomains": true, "endpoints": [{ "url": "https://{{hosts[][www]}}:{{ports[https][0]}}/reporting/resources/report.py?op=put&reportID={{GET[id]}}" }] }
|
||||
NEL: {"report_to": "nel-group", "max_age": 10886400, "include_subdomains": true, "success_fraction": 1.0}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue