Commit 8c84af9b authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Update beacon WPTs

 - Fix beacon-common.sub.js and so that it can handle exceptions thrown
   from sendBeacon.
 - Simplify beacon-common.sub.js.
 - Remove navigate.iFrame.sub.html. Replace it with scripts in the
   main page.

Bug: 876670, 626703, 848275, 876669
Change-Id: I847dec3a71b27c76df156326637be243876daaab
Reviewed-on: https://chromium-review.googlesource.com/1237796Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595780}
parent c6926755
......@@ -3418,9 +3418,6 @@ crbug.com/626703 [ Android Linux Mac ] external/wpt/html/semantics/embedded-cont
crbug.com/626703 [ Android Win ] external/wpt/css/css-fonts/font-kerning-02.html [ Failure ]
crbug.com/626703 external/wpt/2dcontext/building-paths/canvas_complexshapes_arcto_001.htm [ Failure ]
crbug.com/626703 external/wpt/2dcontext/building-paths/canvas_complexshapes_beziercurveto_001.htm [ Failure ]
crbug.com/626703 external/wpt/beacon/beacon-cors.sub.window.html [ Timeout ]
crbug.com/626703 external/wpt/beacon/beacon-navigate.html [ Timeout ]
crbug.com/626703 external/wpt/beacon/beacon-redirect.window.html [ Timeout ]
crbug.com/626703 external/wpt/compat/webkit-text-fill-color-property-005.html [ Failure ]
crbug.com/626703 external/wpt/css/CSS2/text/text-decoration-va-length-001.xht [ Failure ]
crbug.com/626703 external/wpt/css/CSS2/text/text-decoration-va-length-002.xht [ Failure ]
......
This is a testharness.js-based test.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-CORS-ALLOW
FAIL Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-CORS-ALLOW Failed to execute 'sendBeacon' on 'Navigator': sendBeacon() with a Blob whose type is not any of the CORS-safelisted values for the Content-Type request header is disabled temporarily. See http://crbug.com/490015 for details.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-CORS-ALLOW
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-CORS-FORBID
FAIL Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-CORS-FORBID Failed to execute 'sendBeacon' on 'Navigator': sendBeacon() with a Blob whose type is not any of the CORS-safelisted values for the Content-Type request header is disabled temporarily. See http://crbug.com/490015 for details.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-CORS-FORBID
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-CORS-FORBID
FAIL Verify 'navigator.sendbeacon()' successfully sends for variant: SmallCORSContentTypeText-PREFLIGHT-ALLOW Failed to execute 'sendBeacon' on 'Navigator': sendBeacon() with a Blob whose type is not any of the CORS-safelisted values for the Content-Type request header is disabled temporarily. See http://crbug.com/490015 for details.
Harness: the test ran to completion.
......@@ -7,12 +7,6 @@
// the beacon handler will return CORS headers. This test ensures that the
// sendBeacon() succeeds in either case.
[true, false].forEach(function(allowCors) {
// Implement the self.buildId extension to identify the parameterized
// test in the report.
self.buildId = function(baseId) {
return `${baseId}-${allowCors ? "CORS-ALLOW" : "CORS-FORBID"}`;
};
// Implement the self.buildBaseUrl and self.buildTargetUrl extensions
// to change the target URL to use a cross-origin domain name.
self.buildBaseUrl = function(baseUrl) {
......@@ -35,7 +29,13 @@
return allowCors ? `${targetUrl}&origin=http://{{host}}:{{ports[http][0]}}&credentials=true` : targetUrl;
}
runTests(sampleTests);
const tests = [];
for (const test of sampleTests) {
const copy = Object.assign({}, test);
copy.id = `${test.id}-${allowCors ? "CORS-ALLOW" : "CORS-FORBID"}`;
tests.push(copy);
}
runTests(tests);
});
// Now test a cross-origin request that doesn't use a safelisted Content-Type and ensure
......@@ -43,12 +43,6 @@
// header is used there should be a preflight/options request and we should only succeed
// send the payload if the proper CORS headers are used.
{
// Implement the self.buildId extension to identify the parameterized
// test in the report.
self.buildId = function (baseId) {
return `${baseId}-PREFLIGHT-ALLOW`;
};
// Implement the self.buildBaseUrl and self.buildTargetUrl extensions
// to change the target URL to use a cross-origin domain name.
self.buildBaseUrl = function (baseUrl) {
......@@ -60,8 +54,13 @@
self.buildTargetUrl = function (targetUrl) {
return `${targetUrl}&origin=http://{{host}}:{{ports[http][0]}}&credentials=true&preflightExpected=true`;
}
runTests(preflightTests);
const tests = [];
for (const test of preflightTests) {
const copy = Object.assign({}, test);
copy.id = `${test.id}-PREFLIGHT-ALLOW`;
tests.push(copy);
}
runTests(tests);
}
done();
\ No newline at end of file
done();
This is a testharness.js-based test.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-NAVIGATE
FAIL Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-NAVIGATE Failed to execute 'sendBeacon' on 'Navigator': sendBeacon() with a Blob whose type is not any of the CORS-safelisted values for the Content-Type request header is disabled temporarily. See http://crbug.com/490015 for details.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-NAVIGATE
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-NAVIGATE
Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-307
FAIL Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-307 Failed to execute 'sendBeacon' on 'Navigator': sendBeacon() with a Blob whose type is not any of the CORS-safelisted values for the Content-Type request header is disabled temporarily. See http://crbug.com/490015 for details.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-307
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NoData-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: NullData-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: UndefinedData-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallString-308
FAIL Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBlob-308 Failed to execute 'sendBeacon' on 'Navigator': sendBeacon() with a Blob whose type is not any of the CORS-safelisted values for the Content-Type request header is disabled temporarily. See http://crbug.com/490015 for details.
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallBufferSource-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallFormData-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeEncoded-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeForm-308
PASS Verify 'navigator.sendbeacon()' successfully sends for variant: SmallSafeContentTypeText-308
Harness: the test ran to completion.
......@@ -7,19 +7,18 @@
// Note that status codes 307 and 308 are the only codes that will maintain POST data
// through a redirect.
[307, 308].forEach(function(status) {
// Implement the self.buildId extension to identify the parameterized
// test in the report.
self.buildId = function(baseId) {
return `${baseId}-${status}`;
};
// Implement the self.buildTargetUrl extension to inject a redirect to
// the sendBeacon target.
self.buildTargetUrl = function(targetUrl) {
return `/common/redirect.py?status=${status}&location=${encodeURIComponent(targetUrl)}`;
};
runTests(sampleTests);
const tests = [];
for (const test of sampleTests) {
const copy = Object.assign({}, test);
copy.id = `${test.id}-${status}`;
tests.push(copy);
}
runTests(tests);
});
done();
<!DOCTYPE html>
<html>
<head>
<title>W3C Beacon As Fetch (Fetch KeepAlive) Navigate Test</title>
</head>
<body>
<script src="beacon-common.sub.js"></script>
<script>
"use strict";
// An array should be passed through postMessage to this iFrame, where
// [0] contains a test case id as defined in beacon-common.js.
// [1] is the URL for the keep alive fetch() or sendBeacon().
// [2] string indicating the function to call - "fetch" to call fetch() or "beacon" to call sendBeacon().
// The testcase id is returned back to the window through postMesage.
var tests = 0;
window.onmessage = function(e) {
var testCaseId = e.data[0];
var url = e.data[1];
var func = e.data[2];
tests++;
// Reconstruct enough of the test case to send the keep alive fetch (data and url).
var testCase = testLookup[testCaseId];
testCase.url = url;
if (func === "beacon") {
// sendData calls sendBeacon
sendData(testCase);
}
else {
throw new Error(func + " is an invalid function");
}
// Let the main page continue the test if we don't immediately throw an exception.
parent.postMessage(testCaseId, "*");
// Now navigate ourselves.
if (tests == sampleTests.length) {
window.location = "http://{{host}}:{{ports[http][0]}}/";
}
}
</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment