Bug 1436497 [wpt PR 9352] - Check CORS using PassesAccessControlCheck() with supplied SecurityOrigin, a=testonly

Automatic update from web-platform-tests
Partial revert of https://chromium-review.googlesource.com/535694.

Bug: 799477
Change-Id: I878bb9bcb83afaafe8601293db9aa644fc5929b3
Reviewed-on: https://chromium-review.googlesource.com/898427
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: Takeshi Yoshino <tyoshino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535176}

<!-- Reviewable:start -->

<!-- Reviewable:end -->

wpt-commits: c22b35ce5be0ab867e8d7933a24f1709a9da2460
wpt-pr: 9352
reapplied-commits: 370e267e160568862f1fd9ec246ab5bb840f586e, fe4514c84e7ad28e46bad5da93381deb99b177f3, 7806af854343c043a2645a4034fdc7812f65daad, 9ddfd21554293dec5a4bf2e5375ae4f3c9f2ded0, 75f63c4d1ebc949647184fd60972fc7b9fd4affb, 1f3a5b496acd2288cc8cf0c32af86cb35157ea4e, 88b42bd5847abac58a62c4d6b33c1509bfce5f3d, 15c2e4c690700c6c115f8afe5e44ded10d943538, c8d461ef1437641ae7d4ea1d21e1e60cd62910b0, a6088a5f48ee299386a84d2f771902267d7355b1, 0634cd8f08ebe0905a9188fb1398c7b5f889c5dc, c8ee4a012dae506ae06bb5b2ad50942b04c1aaaa, c2c352456a4cf62dcc12f851138b04397675a445, b93a8879555d2fa7e7d4e00a275513a3a6338b35, b86e1331cb36634fd33677043b61fc0c1d8485bc, 44ddf14fd3346658c3223f13652073fafbfa48fa, a1a5840a6bb53e305ba02bcbeb215659342d0edb, 7465cb110ae5ec2e2ca73182caf5293f0efc8fd5, aad5349b3458bc3414e274b33fa86a1123901ff2, eca0907980d2769c449894a6277c60c1a306792f, 38626987c0cfd6e715cfcc6f4f1a1209191a03c5, e4a67f7ddcde6cd99348e9104bd7ed07074da44a, bb3c9990840a0fae2afc840b5952d7874785b112, 042d7adef0bdb9dc80e825c3997ace7519477c42, 99f1ea44fc7915b8b7b33bce4732fa8765fd3ac2, b81999f30c1516a70c153de51a0331d14c8faead
This commit is contained in:
Hiroshige Hayashizaki 2018-03-06 18:21:00 +00:00 коммит произвёл James Graham
Родитель 40a08ec487
Коммит eef822fc21
4 изменённых файлов: 86 добавлений и 0 удалений

Просмотреть файл

@ -279952,6 +279952,11 @@
{}
]
],
"html/semantics/scripting-1/the-script-element/cacheable-script-throw.py": [
[
{}
]
],
"html/semantics/scripting-1/the-script-element/contains.json": [
[
{}
@ -280697,6 +280702,11 @@
{}
]
],
"html/semantics/scripting-1/the-script-element/muted-errors-iframe.html": [
[
{}
]
],
"html/semantics/scripting-1/the-script-element/resources/bom-utf-16be.js": [
[
{}
@ -330646,6 +330656,12 @@
{}
]
],
"html/semantics/scripting-1/the-script-element/muted-errors.sub.html": [
[
"/html/semantics/scripting-1/the-script-element/muted-errors.sub.html",
{}
]
],
"html/semantics/scripting-1/the-script-element/nomodule-reflect.html": [
[
"/html/semantics/scripting-1/the-script-element/nomodule-reflect.html",
@ -559417,6 +559433,10 @@
"c5147ae243c2a2855397c94f23c73c0bf8a729ce",
"testharness"
],
"html/semantics/scripting-1/the-script-element/cacheable-script-throw.py": [
"2eb7a0a6000ca0f028093f4f84f3e84c54c158b4",
"support"
],
"html/semantics/scripting-1/the-script-element/contains.json": [
"f9a602045e19618260a2ea96f188d77536bd772e",
"support"
@ -560941,6 +560961,14 @@
"34c282c0357c639400877b65bf21f30db3b99ea5",
"support"
],
"html/semantics/scripting-1/the-script-element/muted-errors-iframe.html": [
"f99f7d4941f22f18101cfd39cc83b36c6721aaec",
"support"
],
"html/semantics/scripting-1/the-script-element/muted-errors.sub.html": [
"b973843fcd299b45b03c14d71b1b5b3ee2340045",
"testharness"
],
"html/semantics/scripting-1/the-script-element/nomodule-reflect.html": [
"ac2b3c16e9e9263cd4c14de205b63709c14ec2e3",
"testharness"

Просмотреть файл

@ -0,0 +1,4 @@
def main(request, response):
headers = [("Content-Type", "text/javascript"), ("Cache-control", "public, max-age=100")]
body = "throw('fox');"
return 200, headers, body

Просмотреть файл

@ -0,0 +1,2 @@
<!DOCTYPE html>
<script src="cacheable-script-throw.py?iframe"></script>

Просмотреть файл

@ -0,0 +1,52 @@
<!DOCTYPE html>
<title>Muted Errors</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// https://html.spec.whatwg.org/#report-the-error
// If script's muted errors is true, then set message to "Script error.",
// urlString to the empty string, line and col to 0, and errorValue to null.
setup({allow_uncaught_exception: true});
window.log = [];
window.addEventListener("error", ev => log.push(ev));
function check(shouldBeMuted) {
assert_equals(log.length, 1);
var ev = log[0];
log = [];
if (shouldBeMuted) {
assert_equals(ev.message, "Script error.");
assert_equals(ev.error, null, 'error');
assert_equals(ev.filename, "", 'filename');
assert_equals(ev.lineno, 0, 'lineno');
assert_equals(ev.colno, 0, 'colno');
} else {
assert_not_equals(ev.message, "Script error.");
assert_not_equals(ev.error, null);
}
}
var test1 = async_test("Errors for same-origin script shouldn't be muted");
var check1 = test1.step_func_done(() => check(false));
var test2 = async_test("Errors for cross-origin script should be muted");
var check2 = test2.step_func_done(() => check(true));
var test3 = async_test("Errors for cross-origin script should be muted " +
"even if the script is once loaded as same-origin");
function step3() {
var script = document.createElement('script');
script.setAttribute('src', "//{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py?iframe");
script.onerror = test3.unreached_func();
script.onload = test3.step_func_done(() => check(true));
document.body.appendChild(script);
}
function unreachable() { log.push("unexpected"); }
</script>
<script src="cacheable-script-throw.py" onerror="test1.unreached_func()()" onload="check1()"></script>
<script src="//{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/cacheable-script-throw.py"
onerror="test2.unreached_func()()" onload="check2()"></script>
<iframe src="//{{domains[www2]}}:{{ports[http][0]}}/html/semantics/scripting-1/the-script-element/muted-errors-iframe.html"
onerror="test3.unreached_func()()" onload="step3()"></iframe>