Bug 1441687 [wpt PR 9696] - add XHR.prototype.open parameter toString test, a=testonly

Automatic update from web-platform-testsAdd XHR.prototype.open parameter toString test

wpt-commits: 6d9902016ffa1e5a73b8910c863c89c45b12e11e
wpt-pr: 9696
wpt-commits: 6d9902016ffa1e5a73b8910c863c89c45b12e11e
wpt-pr: 9696
This commit is contained in:
Michael Ficarra 2018-03-26 14:47:21 +00:00 коммит произвёл James Graham
Родитель fd074ff003
Коммит 5e81805358
2 изменённых файлов: 64 добавлений и 0 удалений

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

@ -369396,6 +369396,12 @@
{}
]
],
"xhr/open-parameters-toString.htm": [
[
"/xhr/open-parameters-toString.htm",
{}
]
],
"xhr/open-referer.htm": [
[
"/xhr/open-referer.htm",
@ -606541,6 +606547,10 @@
"8b1721532c80a0732462bc090db236256bf1bf38",
"testharness"
],
"xhr/open-parameters-toString.htm": [
"bd1a660def50557f2a7ee896aa29583504be9ae3",
"testharness"
],
"xhr/open-referer.htm": [
"7343a7af06cda485e60af3bb5d86e1376a89fd68",
"testharness"

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

@ -0,0 +1,54 @@
<!doctype html>
<title>XMLHttpRequest: open() attempts to toString its string parameters</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
test(() => {
let log = [];
let expected = [
'method',
'url',
// NOTE: 'async' intentionally missing
'username',
'password',
];
let xhr = new XMLHttpRequest;
xhr.open(
{
toString() {
log.push('method');
return 'get';
},
},
{
toString() {
log.push('url');
return location.href;
},
},
// NOTE: ToBoolean should not invoke valueOf
{
valueOf() {
log.push('async');
return true;
},
},
{
toString() {
log.push('username');
return 'username';
},
},
{
toString() {
log.push('password');
return 'password';
},
}
);
assert_array_equals(log, expected);
});
</script>