-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Uzlopak <5059100+Uzlopak@users.noreply.github.com>
- Loading branch information
1 parent
8b06b82
commit 40714fa
Showing
13 changed files
with
889 additions
and
10 deletions.
There are no files selected for viewing
373 changes: 373 additions & 0 deletions
373
test/fixtures/wpt/fetch/metadata/generated/script-json-module-import-static.https.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,373 @@ | ||
<!DOCTYPE html> | ||
<!-- | ||
This test was procedurally generated. Please do not modify it directly. | ||
Sources: | ||
- fetch/metadata/tools/fetch-metadata.conf.yml | ||
- fetch/metadata/tools/templates/script-json-module-import-static.sub.html | ||
--> | ||
<html lang="en"> | ||
<meta charset="utf-8"> | ||
<title>HTTP headers on request for static ECMAScript module import</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/fetch/metadata/resources/helper.sub.js"></script> | ||
<body> | ||
<script> | ||
'use strict'; | ||
|
||
function induceRequest(url) { | ||
const script = document.createElement('script'); | ||
script.setAttribute('type', 'module'); | ||
script.setAttribute( | ||
'src', | ||
'/fetch/metadata/resources/es-json-module.sub.js?moduleId=' + encodeURIComponent(url) | ||
); | ||
|
||
return new Promise((resolve, reject) => { | ||
script.onload = resolve; | ||
script.onerror = () => reject('Failed to load script'); | ||
document.body.appendChild(script); | ||
}) | ||
.then(() => script.remove()); | ||
} | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsOrigin'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-origin']); | ||
}); | ||
}, 'sec-fetch-site - Same origin'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsCrossSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Cross-site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsSameSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-site']); | ||
}); | ||
}, 'sec-fetch-site - Same site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsOrigin', 'httpsCrossSite', 'httpsOrigin'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Origin -> Cross-Site -> Same-Origin redirect'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsOrigin', 'httpsSameSite', 'httpsOrigin'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Origin -> Same-Site -> Same-Origin redirect'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsCrossSite', 'httpsOrigin'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Cross-Site -> Same Origin'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsCrossSite', 'httpsSameSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Cross-Site -> Same-Site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsCrossSite', 'httpsCrossSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Cross-Site -> Cross-Site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsOrigin', 'httpsOrigin'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-origin']); | ||
}); | ||
}, 'sec-fetch-site - Same-Origin -> Same Origin'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsOrigin', 'httpsSameSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Origin -> Same-Site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsOrigin', 'httpsCrossSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Origin -> Cross-Site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsSameSite', 'httpsOrigin'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Site -> Same Origin'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsSameSite', 'httpsSameSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['same-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Site -> Same-Site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
['httpsSameSite', 'httpsCrossSite'], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-site'); | ||
assert_array_equals(headers['sec-fetch-site'], ['cross-site']); | ||
}); | ||
}, 'sec-fetch-site - Same-Site -> Cross-Site'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
[], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-mode'); | ||
assert_array_equals(headers['sec-fetch-mode'], ['cors']); | ||
}); | ||
}, 'sec-fetch-mode'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
[], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_own_property(headers, 'sec-fetch-dest'); | ||
assert_array_equals(headers['sec-fetch-dest'], ['json']); | ||
}); | ||
}, 'sec-fetch-dest'); | ||
|
||
promise_test(() => { | ||
const key = '{{uuid()}}'; | ||
|
||
return induceRequest( | ||
makeRequestURL( | ||
key, | ||
[], | ||
{ | ||
mime: 'application/json', | ||
body: '{}' | ||
} | ||
) | ||
) | ||
.then(() => retrieve(key)) | ||
.then((headers) => { | ||
assert_not_own_property(headers, 'sec-fetch-user'); | ||
}); | ||
}, 'sec-fetch-user'); | ||
</script> | ||
</html> |
Oops, something went wrong.