Auto merge of #19232 - jdm:updatewpt8, r=jdm

Update web-platform-tests.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19232)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-11-15 23:53:19 -06:00 committed by GitHub
commit 62aa91e0dc
1048 changed files with 45893 additions and 14716 deletions

1
.gitignore vendored
View file

@ -9,6 +9,7 @@
/ports/android/obj /ports/android/obj
/python/_virtualenv /python/_virtualenv
/python/tidy/servo_tidy.egg-info /python/tidy/servo_tidy.egg-info
/tests/wpt/sync
*~ *~
*.pkl *.pkl
*.pyc *.pyc

View file

@ -71,7 +71,7 @@ def create_parser_wpt():
parser = wptcommandline.create_parser() parser = wptcommandline.create_parser()
parser.add_argument('--release', default=False, action="store_true", parser.add_argument('--release', default=False, action="store_true",
help="Run with a release build of servo") help="Run with a release build of servo")
parser.add_argument('--chaos', default=False, action="store_true", parser.add_argument('--rr-chaos', default=False, action="store_true",
help="Run under chaos mode in rr until a failure is captured") help="Run under chaos mode in rr until a failure is captured")
parser.add_argument('--pref', default=[], action="append", dest="prefs", parser.add_argument('--pref', default=[], action="append", dest="prefs",
help="Pass preferences to servo") help="Pass preferences to servo")
@ -471,7 +471,7 @@ class MachCommands(CommandBase):
os.environ["RUST_BACKTRACE"] = "1" os.environ["RUST_BACKTRACE"] = "1"
kwargs["debug"] = not kwargs["release"] kwargs["debug"] = not kwargs["release"]
if kwargs.pop("chaos"): if kwargs.pop("rr_chaos"):
kwargs["debugger"] = "rr" kwargs["debugger"] = "rr"
kwargs["debugger_args"] = "record --chaos" kwargs["debugger_args"] = "record --chaos"
kwargs["repeat_until_unexpected"] = True kwargs["repeat_until_unexpected"] = True

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
[getallresponseheaders-cl.htm]
type: testharness
[Casing of known headers]
expected: FAIL
[Casing of known headers 1]
expected: FAIL
[Casing of known headers 2]
expected: FAIL

View file

@ -1,9 +1,11 @@
[getallresponseheaders.htm] [getallresponseheaders.htm]
type: testharness type: testharness
expected: TIMEOUT
[XMLHttpRequest: getAllResponseHeaders()] [XMLHttpRequest: getAllResponseHeaders()]
expected: TIMEOUT expected: FAIL
[XMLHttpRequest: getAllResponseHeaders() 1] [XMLHttpRequest: getAllResponseHeaders() 1]
expected: TIMEOUT expected: FAIL
[XMLHttpRequest: getAllResponseHeaders() 2]
expected: FAIL

View file

@ -0,0 +1,7 @@
[open-url-encoding.htm]
[percent encode characters]
expected: FAIL
[lone surrogate]
expected: FAIL

View file

@ -1,5 +0,0 @@
[send-authentication-cors-basic-setrequestheader.htm]
type: testharness
[XMLHttpRequest: send() - "Basic" authenticated CORS request using setRequestHeader() (expects to succeed)]
expected: FAIL

View file

@ -1,5 +0,0 @@
[send-authentication-cors-setrequestheader-no-cred.htm]
type: testharness
[CORS request with setRequestHeader auth to URL accepting Authorization header]
expected: FAIL

View file

@ -0,0 +1,4 @@
[setrequestheader-case-insensitive.htm]
[XMLHttpRequest: setRequestHeader() - headers that differ in case 1]
expected: FAIL

View file

@ -0,0 +1,2 @@
[overflow-propagation-001a.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[overflow-propagation-001b.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[overflow-propagation-001c.html]
expected: FAIL

View file

@ -1,3 +0,0 @@
[visibility-005.xht]
type: reftest
expected: FAIL

View file

@ -1,3 +1,3 @@
[box-shadow-syntax-001.xht] [box-shadow-syntax-001.xht]
type: reftest type: reftest
expected: FAIL expected: TIMEOUT

View file

@ -0,0 +1,7 @@
[percentage-heights-003.html]
[.flexbox 1]
expected: FAIL
[.flexbox 2]
expected: FAIL

View file

@ -0,0 +1,7 @@
[text-decoration-skip-ink.html]
[Body must have text-decoration-skip-ink auto by default.]
expected: FAIL
[Property text-decoration-skip-ink must support values auto and none.]
expected: FAIL

View file

@ -0,0 +1,2 @@
[css-transforms-3d-on-anonymous-block-001.html]
expected: FAIL

View file

@ -1,5 +0,0 @@
[media-query-list-interface.xht]
type: testharness
[window_inherits_matchmedia]
expected: FAIL

View file

@ -1,5 +0,0 @@
[window-interface.xht]
type: testharness
[window_inherited_functions]
expected: FAIL

View file

@ -0,0 +1,4 @@
[missing-right-token.html]
[attribute selectors with missing right tokens succeed]
expected: FAIL

View file

@ -0,0 +1,13 @@
[HTMLInputElement.html]
[capture on HTMLInputElement must enqueue an attributeChanged reaction when adding new attribute]
expected: FAIL
[capture on HTMLInputElement must enqueue an attributeChanged reaction when replacing an existing attribute]
expected: FAIL
[capture on HTMLInputElement must enqueue an attributeChanged reaction when adding invalid value default]
expected: FAIL
[capture on HTMLInputElement must enqueue an attributeChanged reaction when removing the attribute]
expected: FAIL

View file

@ -3,3 +3,18 @@
[Untitled] [Untitled]
expected: FAIL expected: FAIL
[Constructed MouseEvent timestamp should be high resolution and have the same time origin as performance.now()]
expected: FAIL
[Constructed KeyboardEvent timestamp should be high resolution and have the same time origin as performance.now()]
expected: FAIL
[Constructed WheelEvent timestamp should be high resolution and have the same time origin as performance.now()]
expected: FAIL
[Constructed GamepadEvent timestamp should be high resolution and have the same time origin as performance.now()]
expected: FAIL
[Constructed FocusEvent timestamp should be high resolution and have the same time origin as performance.now()]
expected: FAIL

View file

@ -0,0 +1,15 @@
[request-headers-case.any.html]
[Multiple headers with the same name, different case (THIS-is-A-test first)]
expected: FAIL
[Multiple headers with the same name, different case (THIS-IS-A-TEST first)]
expected: FAIL
[request-headers-case.any.worker.html]
[Multiple headers with the same name, different case (THIS-is-A-test first)]
expected: FAIL
[Multiple headers with the same name, different case (THIS-IS-A-TEST first)]
expected: FAIL

View file

@ -1,8 +0,0 @@
[cors-filtering-worker.html]
type: testharness
[CORS filter on Set-Cookie header]
expected: FAIL
[CORS filter on Set-Cookie header, header is forbidden]
expected: FAIL

View file

@ -1,8 +0,0 @@
[cors-filtering.html]
type: testharness
[CORS filter on Set-Cookie header]
expected: FAIL
[CORS filter on Set-Cookie header, header is forbidden]
expected: FAIL

View file

@ -0,0 +1,4 @@
[navigation-in-onload.tentative.html]
[Navigation in onload handler]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1a.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1b.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1c.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1d.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1e.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1f.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1i.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1j.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1k.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-1l.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2a.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2b.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2c.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2d.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2e.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2f.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2i.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2j.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2k.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[body-margin-2l.html]
expected: FAIL

View file

@ -172,3 +172,93 @@
[XHTML img usemap="http://example.org/#garbage-before-hash-id"] [XHTML img usemap="http://example.org/#garbage-before-hash-id"]
expected: FAIL expected: FAIL
[HTML (standards) IMG usemap="no-hash-name"]
expected: FAIL
[HTML (standards) IMG usemap="no-hash-id"]
expected: FAIL
[HTML (standards) IMG usemap="hash-last#"]
expected: FAIL
[HTML (standards) IMG usemap=""]
expected: FAIL
[HTML (standards) IMG usemap="#"]
expected: FAIL
[HTML (standards) IMG usemap="#percent-escape-name-%41"]
expected: FAIL
[HTML (standards) IMG usemap="#percent-escape-id-%41"]
expected: FAIL
[HTML (standards) IMG usemap="#no-such-map"]
expected: FAIL
[HTML (standards) IMG usemap="#different-CASE-name"]
expected: FAIL
[HTML (standards) IMG usemap="#different-CASE-id"]
expected: FAIL
[HTML (quirks) IMG usemap="no-hash-name"]
expected: FAIL
[HTML (quirks) IMG usemap="no-hash-id"]
expected: FAIL
[HTML (quirks) IMG usemap="hash-last#"]
expected: FAIL
[HTML (quirks) IMG usemap=""]
expected: FAIL
[HTML (quirks) IMG usemap="#"]
expected: FAIL
[HTML (quirks) IMG usemap="#percent-escape-name-%41"]
expected: FAIL
[HTML (quirks) IMG usemap="#percent-escape-id-%41"]
expected: FAIL
[HTML (quirks) IMG usemap="#no-such-map"]
expected: FAIL
[HTML (quirks) IMG usemap="#different-CASE-name"]
expected: FAIL
[HTML (quirks) IMG usemap="#different-CASE-id"]
expected: FAIL
[XHTML img usemap="no-hash-name"]
expected: FAIL
[XHTML img usemap="no-hash-id"]
expected: FAIL
[XHTML img usemap="hash-last#"]
expected: FAIL
[XHTML img usemap=""]
expected: FAIL
[XHTML img usemap="#"]
expected: FAIL
[XHTML img usemap="#percent-escape-name-%41"]
expected: FAIL
[XHTML img usemap="#percent-escape-id-%41"]
expected: FAIL
[XHTML img usemap="#no-such-map"]
expected: FAIL
[XHTML img usemap="#different-CASE-name"]
expected: FAIL
[XHTML img usemap="#different-CASE-id"]
expected: FAIL

View file

@ -1,6 +1,5 @@
[selection-start-end.html] [selection-start-end.html]
type: testharness type: testharness
[onselect should fire when selectionStart is changed] [onselect should fire when selectionStart is changed]
expected: FAIL expected: FAIL

View file

@ -59,3 +59,4 @@
[value IDL attribute of input type email with value attribute] [value IDL attribute of input type email with value attribute]
expected: FAIL expected: FAIL

View file

@ -0,0 +1,4 @@
[option-text-setter.html]
[Verify that using HTMLOptionElement.text setter does not update the existing text child node.]
expected: FAIL

View file

@ -1,2 +1,2 @@
local: b74f52d6df118d832db08276ebe698fee2fa2265 local: 85fa6409bb699647b4f5e22952538365e87418d7
upstream: f1d5e1dcd20176cee05692bd78863e9b03ace93b upstream: 40ee9a4553dca805163766c5970979a23e357292

View file

@ -0,0 +1,4 @@
[data-uri-fragment.html]
[Data URI parsing of fragments]
expected: FAIL

View file

@ -1,8 +1,5 @@
[005.html] [005.html]
type: testharness type: testharness
[WebSockets: proper first line]
expected: FAIL
[005.html?wss] [005.html?wss]
type: testharness type: testharness

View file

@ -1,8 +0,0 @@
[long-expressions-should-not-crash.html]
type: testharness
expected:
if os == "linux": CRASH
if os == "mac": TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -12,6 +12,7 @@ from mozlog.structured import structuredlog
here = os.path.split(__file__)[0] here = os.path.split(__file__)[0]
sys.path.insert(0, os.path.abspath(os.path.join(here, os.pardir, "web-platform-tests", "tools", "wptrunner"))) sys.path.insert(0, os.path.abspath(os.path.join(here, os.pardir, "web-platform-tests", "tools", "wptrunner")))
sys.path.insert(0, os.path.abspath(os.path.join(here, os.pardir, "web-platform-tests", "tools", "wptserve")))
sys.path.insert(0, os.path.abspath(os.path.join(here, os.pardir, "tests", "tools", "scripts"))) sys.path.insert(0, os.path.abspath(os.path.join(here, os.pardir, "tests", "tools", "scripts")))
from wptrunner.update import setup_logging, WPTUpdate from wptrunner.update import setup_logging, WPTUpdate

View file

@ -26,7 +26,9 @@ matrix:
include: include:
- os: linux - os: linux
python: "2.7" python: "2.7"
env: JOB=manifest_upload SCRIPT=tools/ci/ci_manifest.sh env:
- JOB=manifest_upload SCRIPT=tools/ci/ci_manifest.sh
- secure: "FrlMkMZiwggnhJbLiLxZ4imtXxuzFNozty94g1mneMPEVLrnyhb6c/g2SwN37KKU0WSDlGTz26IYnFvo1ftfSOx+sjRz0HqwW7JnrXULKYo7jiPttIcmeJxlSVeW9yS4blbLaBakytHjSnsf+za7bAaf1aS7RRAtAINgifA6Chg="
deploy: deploy:
provider: releases provider: releases
api_key: api_key:

View file

@ -0,0 +1,58 @@
<!doctype html>
<meta charset=utf-8>
<title>IndexedDB: Index iteration with cursor updates/deletes</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support.js"></script>
<script>
const objStoreValues = [
{name: 'foo', id: 1},
{name: 'bar', id: 2},
{name: 'foo', id: 3},
{name: 'bar', id: 4},
];
const objStoreValuesByIndex = [
objStoreValues[1],
objStoreValues[3],
objStoreValues[0],
objStoreValues[2],
];
const functionsThatShouldNotAffectIteration = [
cursor => cursor.update({}),
cursor => cursor.delete(),
];
functionsThatShouldNotAffectIteration.forEach((func) => indexeddb_test(
(t, db) => {
const objStore = db.createObjectStore('items', {autoIncrement: true});
objStore.createIndex('name', 'name', {unique: false});
objStoreValues.forEach((value) => objStore.add(value));
},
(t, db) => {
const txn = db.transaction('items', 'readwrite');
const objStore = txn.objectStore('items');
const nameIndex = objStore.index('name');
const cursorValues = [];
nameIndex.openCursor().onsuccess = (evt) => {
const cursor = evt.target.result;
if (cursor) {
func(cursor);
cursorValues.push(cursor.value);
cursor.continue();
} else {
assert_equals(cursorValues.length, 4,
`Cursor should iterate over 4 records`);
cursorValues.forEach((value, i) => {
assert_object_equals(value, objStoreValuesByIndex[i]);
});
t.done();
}
}
},
`Calling ${func} doesn't affect index iteration`
));
</script>

View file

@ -0,0 +1,109 @@
<!doctype html>
<meta charset="utf8">
<meta name="timeout" content="long">
<title>IndexedDB: WebAssembly module values</title>
<link rel="help" href="https://w3c.github.io/IndexedDB/">
<link rel="help" href="https://webassembly.github.io/spec/">
<link rel="author" href="pwnall@chromium.org" title="Victor Costan">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support-promises.js"></script>
<script>
'use strict';
// Binary representation for a WASM module that exports an "inc" function.
//
// This test covers storing WASM modules in IndexedDB. Its failure should only
// be debugged if WASM specification tests pass. To this end, the test does not
// use the WASM module builder helpers, trading off WASM debuggability in return
// for having the WASM wire bytes listed explicitly in the test body. Having the
// wire bytes spelled out can be helpful when debugging IndexedDB failures.
let wasm_module_bytes = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, // Magic.
0x01, 0x00, 0x00, 0x00, // Version.
0x01, 0x06, 0x01, // Type section - 6 bytes, 1 entry
0x60, 0x01, 0x7f, 0x01, 0x7f, // Type 0. Function: (i32) -> (i32)
0x03, 0x02, 0x01, // Function section - 2 bytes, 1 entry
0x00, // Function 0: Type 0
0x07, 0x07, 0x01, // Export section - 7 bytes, 1 entry
0x03, 0x69, 0x6e, 0x63, // Export 1. { name: "inc"
0x00, 0x00, // desc: function 0 }
0x0a, 0x09, 0x01, // Code section: 9 bytes, 1 entry
0x07, 0x00, // Function 1: 7 code bytes, 0 locals
0x20, 0x00, // getlocal 0
0x41, 0x01, // i32.const 1
0x6a, // i32.add
0x0b, // end
]);
promise_test(async testCase => {
const wasm_module = await WebAssembly.compile(wasm_module_bytes.buffer);
const database = await createDatabase(testCase, (database, transaction) => {
const store = database.createObjectStore('store');
store.put(wasm_module, 'key1');
});
const result = await new Promise((resolve, reject) => {
const transaction = database.transaction(['store'], 'readonly');
const store = transaction.objectStore('store');
const request = store.get('key1');
request.onsuccess = (event) => resolve(event.target.result);
request.onerror = (event) => reject(event.target.error);
});
database.close();
const instance = await WebAssembly.instantiate(result);
assert_equals(
instance.exports['inc'](42), 43, 'inc should increment its argument');
}, 'WebAssembly module as an IndexedDB value');
promise_test(async testCase => {
const wasm_module = await WebAssembly.compile(wasm_module_bytes.buffer);
const database = await createDatabase(testCase, (database, transaction) => {
const store = database.createObjectStore('store');
store.put({ module: wasm_module }, 'key1');
});
const result = await new Promise((resolve, reject) => {
const transaction = database.transaction(['store'], 'readonly');
const store = transaction.objectStore('store');
const request = store.get('key1');
request.onsuccess = (event) => resolve(event.target.result);
request.onerror = (event) => reject(event.target.error);
});
database.close();
const instance = await WebAssembly.instantiate(result.module);
assert_equals(
instance.exports['inc'](42), 43, 'inc should increment its argument');
}, 'WebAssembly module in a JavaScript object IndexedDB value');
promise_test(async testCase => {
const wasm_module = await WebAssembly.compile(wasm_module_bytes.buffer);
const database = await createDatabase(testCase, (database, transaction) => {
const store = database.createObjectStore('store', { keyPath: 'key' });
store.put({ key: 'key1', module: wasm_module });
});
const result = await new Promise((resolve, reject) => {
const transaction = database.transaction(['store'], 'readonly');
const store = transaction.objectStore('store');
const request = store.get('key1');
request.onsuccess = (event) => resolve(event.target.result);
request.onerror = (event) => reject(event.target.error);
});
database.close();
assert_equals('key1', result.key);
const instance = await WebAssembly.instantiate(result.module);
assert_equals(
instance.exports['inc'](42), 43, 'inc should increment its argument');
}, 'WebAssembly module in an IndexedDB value with an inline key');
</script>

View file

@ -17,6 +17,10 @@ Setting Up the Repo
Clone or otherwise get https://github.com/w3c/web-platform-tests. Clone or otherwise get https://github.com/w3c/web-platform-tests.
Note: because of the frequent creation and deletion of branches in this
repo, it is recommended to "prune" stale branches when fetching updates,
i.e. use `git pull --prune` (or `git fetch -p && git merge`).
Running the Tests Running the Tests
================= =================

View file

@ -76,7 +76,7 @@
assert_equals(client.statusText, "") assert_equals(client.statusText, "")
assert_equals(client.responseXML, null) assert_equals(client.responseXML, null)
assert_equals(client.getAllResponseHeaders(), "") assert_equals(client.getAllResponseHeaders(), "")
setTimeout(function() { test.step_timeout(function() {
assert_array_equals(result, expected) assert_array_equals(result, expected)
test.done(); test.done();
}, 100); // wait a bit in case XHR timeout causes spurious event }, 100); // wait a bit in case XHR timeout causes spurious event

View file

@ -40,7 +40,7 @@
assert_equals(client.statusText, "") assert_equals(client.statusText, "")
assert_equals(client.responseXML, null) assert_equals(client.responseXML, null)
assert_equals(client.getAllResponseHeaders(), "") assert_equals(client.getAllResponseHeaders(), "")
setTimeout(function() { test.step_timeout(function() {
assert_array_equals(result, expected) assert_array_equals(result, expected)
test.done(); test.done();
}, 100); // wait a bit in case XHR timeout causes spurious event }, 100); // wait a bit in case XHR timeout causes spurious event

View file

@ -40,7 +40,7 @@
assert_equals(client.statusText, "") assert_equals(client.statusText, "")
assert_equals(client.responseXML, null) assert_equals(client.responseXML, null)
assert_equals(client.getAllResponseHeaders(), "") assert_equals(client.getAllResponseHeaders(), "")
setTimeout(function() { test.step_timeout(function() {
assert_array_equals(result, expected) assert_array_equals(result, expected)
test.done(); test.done();
}, 100); // wait a bit in case XHR timeout causes spurious event }, 100); // wait a bit in case XHR timeout causes spurious event
@ -51,4 +51,3 @@
</script> </script>
</body> </body>
</html> </html>

View file

@ -1,27 +0,0 @@
<!doctype html>
<title>Casing of known headers</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
test(() => {
const client = new XMLHttpRequest
client.open("GET", "resources/header-content-length.asis", false)
client.send()
assert_equals(client.getAllResponseHeaders(), "content-length: 0\r\n")
})
test(() => {
const client = new XMLHttpRequest
client.open("GET", "resources/echo-headers.py", false)
client.setRequestHeader("THIS-IS-A-TEST", "1")
client.setRequestHeader("THIS-is-A-test", "2")
client.setRequestHeader("content-TYPE", "x/x")
client.send()
assert_regexp_match(client.responseText, /content-TYPE/)
assert_regexp_match(client.responseText, /THIS-IS-A-TEST: 1, 2/)
})
promise_test(() => {
return fetch("resources/echo-headers.py", {headers: [["THIS-is-A-test", 1], ["THIS-IS-A-TEST", 2]] }).then(res => res.text()).then(body => {
assert_regexp_match(body, /THIS-is-A-test: 1, 2/)
})
})
</script>

View file

@ -9,27 +9,22 @@
<body> <body>
<div id="log"></div> <div id="log"></div>
<script> <script>
var test = async_test() async_test(function() {
test.step(function() {
var client = new XMLHttpRequest() var client = new XMLHttpRequest()
var headersUnsent = client.getAllResponseHeaders(); assert_equals(client.getAllResponseHeaders(), "")
test.step(function() {
assert_equals(headersUnsent, "") client.onreadystatechange = this.step_func(function() {
}); var headers = client.getAllResponseHeaders().toLowerCase()
client.onreadystatechange = function() { if(client.readyState == 1) {
test.step(function() { assert_equals(headers, "")
var headers = client.getAllResponseHeaders().toLowerCase() }
if(client.readyState == 1) { if(client.readyState > 1) {
assert_equals(headers, "") assert_false(headers.indexOf("200 ok") != -1)
} assert_false(headers.indexOf("http/1.") != -1)
if(client.readyState > 1) { }
assert_false(headers.indexOf("200 ok") != -1) if(client.readyState == 4)
assert_false(headers.indexOf("http/1.") != -1) this.done()
} })
if(client.readyState == 4)
test.done()
})
}
client.open("GET", "resources/headers.py") client.open("GET", "resources/headers.py")
client.send(null) client.send(null)
}) })

View file

@ -9,6 +9,7 @@ async_test((t) => {
client.onload = t.step_func_done(() => { client.onload = t.step_func_done(() => {
assert_equals(client.getAllResponseHeaders(), "foo-test: 1, 2, 3\r\n") assert_equals(client.getAllResponseHeaders(), "foo-test: 1, 2, 3\r\n")
}) })
client.onerror = t.unreached_func("unexpected error")
client.open("GET", "resources/headers-basic.asis") client.open("GET", "resources/headers-basic.asis")
client.send(null) client.send(null)
}) })
@ -18,7 +19,15 @@ async_test((t) => {
client.onload = t.step_func_done(() => { client.onload = t.step_func_done(() => {
assert_equals(client.getAllResponseHeaders(), "also-here: Mr. PB\r\newok: lego\r\nfoo-test: 1, 2\r\n") assert_equals(client.getAllResponseHeaders(), "also-here: Mr. PB\r\newok: lego\r\nfoo-test: 1, 2\r\n")
}) })
client.onerror = t.unreached_func("unexpected error")
client.open("GET", "resources/headers.asis") client.open("GET", "resources/headers.asis")
client.send(null) client.send(null)
}) })
test(() => {
const client = new XMLHttpRequest
client.open("GET", "resources/header-content-length.asis", false)
client.send()
assert_equals(client.getAllResponseHeaders(), "content-length: 0\r\n")
})
</script> </script>

View file

@ -13,7 +13,7 @@
test.step(function() { test.step(function() {
var client = new XMLHttpRequest(), var client = new XMLHttpRequest(),
result = [], result = [],
expected = [1, 4, 1] // open() -> 1, expected = [1, 4, 1] // open() -> 1,
// abort() -> 4, open() -> 1 // abort() -> 4, open() -> 1
client.onreadystatechange = function() { client.onreadystatechange = function() {
test.step(function() { test.step(function() {

View file

@ -14,14 +14,14 @@
var client = new XMLHttpRequest() var client = new XMLHttpRequest()
client.open("GET", "resources/content.py?\u00DF", false) // This is the German "eszett" character client.open("GET", "resources/content.py?\u00DF", false) // This is the German "eszett" character
client.send() client.send()
assert_equals(client.getResponseHeader("x-request-query"), "%C3%9F") assert_equals(client.getResponseHeader("x-request-query"), "%DF")
}, "percent encode characters"); }, "percent encode characters");
test(function() { test(function() {
var client = new XMLHttpRequest() var client = new XMLHttpRequest()
client.open("GET", "resources/content.py?\uD83D", false) client.open("GET", "resources/content.py?\uD83D", false)
client.send() client.send()
assert_equals(client.getResponseHeader("x-request-query"), "%EF%BF%BD") assert_equals(client.getResponseHeader("x-request-query"), "&%2365533;")
}, "lone surrogate should return U+FFFD"); }, "lone surrogate");
</script> </script>
</body> </body>
</html> </html>

View file

@ -13,8 +13,8 @@
test(function() { test(function() {
var client = new self[0].XMLHttpRequest() var client = new self[0].XMLHttpRequest()
document.body.removeChild(document.getElementsByTagName("iframe")[0]) document.body.removeChild(document.getElementsByTagName("iframe")[0])
assert_throws("InvalidStateError", function() { assert_throws("InvalidStateError", function() {
client.open("GET", "folder.txt") client.open("GET", "folder.txt")
}, "open() when associated document's IFRAME is removed") }, "open() when associated document's IFRAME is removed")
}) })
} }

View file

@ -13,7 +13,7 @@
var client = new self[0].XMLHttpRequest() var client = new self[0].XMLHttpRequest()
client.open("GET", "folder.txt") client.open("GET", "folder.txt")
document.body.removeChild(document.getElementsByTagName("iframe")[0]) document.body.removeChild(document.getElementsByTagName("iframe")[0])
assert_throws("InvalidStateError", function() { assert_throws("InvalidStateError", function() {
client.send(null) client.send(null)
}, "send() when associated document's IFRAME is removed") }, "send() when associated document's IFRAME is removed")
}) })

View file

@ -11,7 +11,7 @@
/* /*
It's unclear what the pass condition should be for this test. It's unclear what the pass condition should be for this test.
Implementations: Implementations:
Firefox, Opera (Presto): terminate request with no further events when IFRAME is removed. Firefox, Opera (Presto): terminate request with no further events when IFRAME is removed.
Chrome: completes request to readyState=4 but responseText is "" so it's pretty much terminated with an extra event for "DONE" state Chrome: completes request to readyState=4 but responseText is "" so it's pretty much terminated with an extra event for "DONE" state
Pass condition is now according to my suggested spec text in https://github.com/whatwg/xhr/pull/3 , if that's not accepted we'll have to amend this test Pass condition is now according to my suggested spec text in https://github.com/whatwg/xhr/pull/3 , if that's not accepted we'll have to amend this test
*/ */
@ -20,7 +20,7 @@
test.step(function() { test.step(function() {
var hasErrorEvent = false var hasErrorEvent = false
var client = new self[0].XMLHttpRequest() var client = new self[0].XMLHttpRequest()
client.onreadystatechange = function() { client.onreadystatechange = function() {
test.step(function() { test.step(function() {
if(client.readyState == 4) { if(client.readyState == 4) {
assert_equals(client.responseText, "", "responseText is empty on inactive document error condition") assert_equals(client.responseText, "", "responseText is empty on inactive document error condition")

View file

@ -22,7 +22,7 @@
ifr.onload = function() { ifr.onload = function() {
// Again, do things async so we're not doing loads from inside // Again, do things async so we're not doing loads from inside
// load events. // load events.
setTimeout(function() { test.step_timeout(function() {
client = new ifr.contentWindow.XMLHttpRequest(); client = new ifr.contentWindow.XMLHttpRequest();
count++; count++;
// Important to do a normal navigation, not a reload. // Important to do a normal navigation, not a reload.

View file

@ -1,43 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <meta charset="utf-8">
<head> <title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
<meta charset="utf-8" /> <script src="/resources/testharness.js"></script>
<title>XMLHttpRequest: redirected worker scripts, origin and referrer</title> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script> <div id="log"></div>
<script src="/resources/testharnessreport.js"></script> <script>
</head> var finalWorkerURL = "workerxhr-origin-referrer.js";
<body> var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
<div id="log"></div> fetch_tests_from_worker(new Worker(url));
<script type="text/javascript"> </script>
var test = async_test() // This "test" does not actually do any assertations. It's just there to have multiple, separate, asyncronous sub-tests.
var expectations = {
'Referer header': 'Referer: '+(location.href.replace(/[^/]*$/, ''))+"resources/workerxhr-origin-referrer.js\n",
'Origin header': 'Origin: '+location.protocol+'//'+location.hostname+((location.port === "")?"":":"+location.port)+'\n',
'Request URL test' : (location.href.replace(/[^/]*$/, ''))+'resources/requri.py?full'
}
// now start the worker
var finalWorkerURL = "workerxhr-origin-referrer.js";
var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
var worker = new Worker(url)
worker.onmessage = function (e) {
var subtest = async_test(e.data.test)
subtest.step(function(){
var thisExpectation = expectations[e.data.test]
delete expectations[e.data.test]
assert_equals(e.data.result, thisExpectation)
subtest.done()
})
var allDone = true
for(var prop in expectations){
allDone = false
}
if(allDone){
test.step(function(){
test.done()
})
}
}
</script>
</body>
</html>

View file

@ -1,43 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <meta charset="utf-8">
<head> <title>XMLHttpRequest: worker scripts, origin and referrer</title>
<meta charset="utf-8" /> <script src="/resources/testharness.js"></script>
<title>XMLHttpRequest: worker scripts, origin and referrer</title> <script src="/resources/testharnessreport.js"></script>
<script src="/resources/testharness.js"></script> <div id="log"></div>
<script src="/resources/testharnessreport.js"></script> <script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[3]/ol[1]/li[1] following::OL[1]/LI[3]/ol[1]/li[2] following::OL[1]/LI[3]/ol[1]/li[3]" /> fetch_tests_from_worker(new Worker("resources/workerxhr-origin-referrer.js"));
</head> </script>
<body>
<div id="log"></div>
<script type="text/javascript">
var test = async_test() // This "test" does not actually do any assertations. It's just there to have multiple, separate, asyncronous sub-tests.
var expectations = {
'Referer header': 'Referer: '+(location.href.replace(/[^/]*$/, ''))+"resources/workerxhr-origin-referrer.js\n",
'Origin header': 'Origin: '+location.protocol+'//'+location.hostname+((location.port === "")?"":":"+location.port)+'\n',
'Request URL test' : (location.href.replace(/[^/]*$/, ''))+'resources/requri.py?full'
}
// now start the worker
var worker = new Worker("resources/workerxhr-origin-referrer.js")
worker.onmessage = function (e) {
var subtest = async_test(e.data.test)
subtest.step(function(){
var thisExpectation = expectations[e.data.test]
delete expectations[e.data.test]
assert_equals(e.data.result, thisExpectation)
subtest.done()
})
var allDone = true
for(var prop in expectations){
allDone = false
}
if(allDone){
test.step(function(){
test.done()
})
}
}
</script>
</body>
</html>

View file

@ -15,11 +15,11 @@
var client = new XMLHttpRequest(); var client = new XMLHttpRequest();
client.onreadystatechange = function() { client.onreadystatechange = function() {
if (client.readyState !== 4) return; if (client.readyState !== 4) return;
try{ try{
var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent; var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent;
}catch(e){ }catch(e){
assert_unreached('Exception when reading responseXML'); assert_unreached('Exception when reading responseXML');
} }
assert_equals( client.responseXML.documentElement.tagName, 'test' ); assert_equals( client.responseXML.documentElement.tagName, 'test' );
assert_equals( client.responseXML.documentElement.firstChild.tagName, 'message' ); assert_equals( client.responseXML.documentElement.firstChild.tagName, 'message' );
assert_equals( client.responseXML.documentElement.firstChild.textContent, 'Hello World' ); assert_equals( client.responseXML.documentElement.firstChild.textContent, 'Hello World' );

View file

@ -1,13 +1,16 @@
import imp import imp
import os import os
here = os.path.dirname(__file__)
def main(request, response): def main(request, response):
response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin")); response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
response.headers.set('Access-Control-Allow-Credentials', 'true'); response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Methods', 'GET'); response.headers.set('Access-Control-Allow-Methods', 'GET');
response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass'); response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass');
response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user'); response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
auth = imp.load_source("", os.path.abspath("XMLHttpRequest/resources/authentication.py")) auth = imp.load_source("", os.path.abspath(os.path.join(here, os.pardir, "authentication.py")))
if request.method == "OPTIONS": if request.method == "OPTIONS":
return "" return ""
else: else:

View file

@ -1,15 +1,16 @@
import imp import imp
import os import os
here = os.path.dirname(__file__)
def main(request, response): def main(request, response):
response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin")); response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
response.headers.set('Access-Control-Allow-Credentials', 'true'); response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Methods', 'GET'); response.headers.set('Access-Control-Allow-Methods', 'GET');
response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass'); response.headers.set('Access-Control-Allow-Headers', 'authorization, x-user, x-pass');
response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user'); response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), auth = imp.load_source("", os.path.join(here,
"XMLHttpRequest", os.pardir,
"resources",
"authentication.py")) "authentication.py"))
if request.method == "OPTIONS": if request.method == "OPTIONS":
return "" return ""

View file

@ -1,15 +1,17 @@
import imp import imp
import os import os
here = os.path.dirname(__file__)
def main(request, response): def main(request, response):
response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin")); response.headers.set('Access-Control-Allow-Origin', request.headers.get("origin"));
response.headers.set('Access-Control-Allow-Credentials', 'true'); response.headers.set('Access-Control-Allow-Credentials', 'true');
response.headers.set('Access-Control-Allow-Methods', 'GET'); response.headers.set('Access-Control-Allow-Methods', 'GET');
response.headers.set('Access-Control-Allow-Headers', 'x-user, x-pass'); response.headers.set('Access-Control-Allow-Headers', 'x-user, x-pass');
response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user'); response.headers.set('Access-Control-Expose-Headers', 'x-challenge, xhr-user, ses-user');
auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir), auth = imp.load_source("", os.path.join(here,
"XMLHttpRequest", os.pardir,
"resources",
"authentication.py")) "authentication.py"))
if request.method == "OPTIONS": if request.method == "OPTIONS":
return "" return ""

View file

@ -1,34 +1,63 @@
// This simply posts a message to the owner page with the contents of the Referer header importScripts("/resources/testharness.js")
var xhr=new XMLHttpRequest()
xhr.onreadystatechange = function(){
if(xhr.readyState == 4){
var obj = {test:'Referer header', result:xhr.responseText}
self.postMessage(obj)
}
}
xhr.open('GET', 'inspect-headers.py?filter_name=referer', true)
xhr.send()
// This simply posts a message to the owner page with the contents of the Origin header async_test(function() {
var xhr2=new XMLHttpRequest() var expected = 'Referer: ' +
xhr2.onreadystatechange = function(){ location.href.replace(/[^/]*$/, '') +
if(xhr2.readyState == 4){ "workerxhr-origin-referrer.js\n"
var obj = {test:'Origin header', result:xhr2.responseText}
self.postMessage(obj)
}
}
xhr2.open('GET', location.protocol + '//www2.'+location.hostname+((location.port === "")?"":":"+location.port)+(location.pathname.replace(/[^/]*$/, ''))+'inspect-headers.py?filter_name=origin&cors', true)
xhr2.send()
// If "origin" / base URL is the origin of this JS file, we can load files var xhr = new XMLHttpRequest()
// from the server it originates from.. and requri.py will be able to tell us xhr.onreadystatechange = this.step_func(function() {
// what the requested URL was if (xhr.readyState == 4) {
var xhr3=new XMLHttpRequest() assert_equals(xhr.responseText, expected)
xhr3.onreadystatechange = function(){ this.done()
if(xhr3.readyState == 4){
var obj = {test:'Request URL test', result:xhr3.responseText}
self.postMessage(obj)
} }
} })
xhr3.open('GET', 'requri.py?full', true) xhr.open('GET', 'inspect-headers.py?filter_name=referer', true)
xhr3.send() xhr.send()
}, 'Referer header')
async_test(function() {
var expected = 'Origin: ' +
location.protocol +
'//' +
location.hostname +
(location.port === "" ? "" : ":" + location.port) +
'\n'
var xhr = new XMLHttpRequest()
xhr.onreadystatechange = this.step_func(function() {
if (xhr.readyState == 4) {
assert_equals(xhr.responseText, expected)
this.done()
}
})
var url = location.protocol +
'//www2.' +
location.hostname +
(location.port === "" ? "" : ":" + location.port) +
location.pathname.replace(/[^/]*$/, '') +
'inspect-headers.py?filter_name=origin&cors'
xhr.open('GET', url, true)
xhr.send()
}, 'Origin header')
async_test(function() {
// If "origin" / base URL is the origin of this JS file, we can load files
// from the server it originates from.. and requri.py will be able to tell us
// what the requested URL was
var expected = location.href.replace(/[^/]*$/, '') +
'requri.py?full'
var xhr = new XMLHttpRequest()
xhr.onreadystatechange = this.step_func(function() {
if (xhr.readyState == 4) {
assert_equals(xhr.responseText, expected)
this.done()
}
})
xhr.open('GET', 'requri.py?full', true)
xhr.send()
}, 'Request URL test')
done()

View file

@ -1,10 +1,9 @@
var xhr=new XMLHttpRequest() var xhr=new XMLHttpRequest()
xhr.onreadystatechange = function(){ xhr.onreadystatechange = function(){
if(xhr.readyState == 4){ if(xhr.readyState == 4){
var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED' var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
self.postMessage(status) self.postMessage(status)
} }
} }
xhr.open('GET', 'folder.txt', true) xhr.open('GET', 'folder.txt', true)
xhr.send() xhr.send()

View file

@ -2,5 +2,5 @@ if (this.document === undefined)
importScripts("xmlhttprequest-timeout.js"); importScripts("xmlhttprequest-timeout.js");
runTestRequests([ new RequestTracker(true, "no time out scheduled, load fires normally", 0), runTestRequests([ new RequestTracker(true, "no time out scheduled, load fires normally", 0),
new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD), new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]); new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);

View file

@ -1,2 +1,2 @@
runTestRequests([ SyncRequestSettingTimeoutAfterOpen, runTestRequests([ SyncRequestSettingTimeoutAfterOpen,
SyncRequestSettingTimeoutBeforeOpen ]); SyncRequestSettingTimeoutBeforeOpen ]);

View file

@ -1,11 +1,11 @@
if (this.document === undefined){ if (this.document === undefined){
importScripts("xmlhttprequest-timeout.js"); importScripts("xmlhttprequest-timeout.js");
}else{ }else{
throw "This test expects to be run as a Worker"; throw "This test expects to be run as a Worker";
} }
/* NOT TESTED: setting timeout before calling open( ... , false) in a worker context. The test code always calls open() first. */ /* NOT TESTED: setting timeout before calling open( ... , false) in a worker context. The test code always calls open() first. */
runTestRequests([ new RequestTracker(false, "no time out scheduled, load fires normally", 0), runTestRequests([ new RequestTracker(false, "no time out scheduled, load fires normally", 0),
new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD), new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD),
new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]); new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);

View file

@ -2,5 +2,5 @@ if (this.document === undefined)
importScripts("xmlhttprequest-timeout.js"); importScripts("xmlhttprequest-timeout.js");
runTestRequests([ new RequestTracker(true, "load fires normally with no timeout set, twice", 0, TIME_REGULAR_TIMEOUT, 0), runTestRequests([ new RequestTracker(true, "load fires normally with no timeout set, twice", 0, TIME_REGULAR_TIMEOUT, 0),
new RequestTracker(true, "load fires normally with same timeout set twice", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD), new RequestTracker(true, "load fires normally with same timeout set twice", TIME_NORMAL_LOAD, TIME_REGULAR_TIMEOUT, TIME_NORMAL_LOAD),
new RequestTracker(true, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]); new RequestTracker(true, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]);

View file

@ -245,7 +245,7 @@ AbortedRequest.prototype = {
/** /**
* Check the event received, and if it's the right (and only) one we get. * Check the event received, and if it's the right (and only) one we get.
* *
* WebKit fires abort events even for DONE and UNSENT states, which is * WebKit fires abort events even for DONE and UNSENT states, which is
* discussed in http://webkit.org/b/98404 * discussed in http://webkit.org/b/98404
* That's why we chose to accept secondary "abort" events in this test. * That's why we chose to accept secondary "abort" events in this test.
* *

View file

@ -21,7 +21,7 @@
} }
const encoded_content = "%e6%a9%9f"; const encoded_content = "%e6%a9%9f";
const encoded_xml = const encoded_xml =
encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>") + encoded_content + encodeURIComponent("<\/x>"); encodeURIComponent("<?xml version='1.0' encoding='windows-1252'?><x>") + encoded_content + encodeURIComponent("<\/x>");
const encoded_html = const encoded_html =
encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>"); encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>");

View file

@ -10,7 +10,7 @@
<body> <body>
<div id="log"></div> <div id="log"></div>
<script> <script>
function request(user1, pass1, user2, pass2, name) { function request(user1, pass1, user2, pass2, name) {
// user1, pass1 will if given become userinfo part of URL // user1, pass1 will if given become userinfo part of URL
// user2, pass2 will if given be passed to open() call // user2, pass2 will if given be passed to open() call
test(function() { test(function() {

View file

@ -11,51 +11,82 @@
<body> <body>
<div id="log"></div> <div id="log"></div>
<script> <script>
var expectations = [ var tests = [
{ contentType: 'application/xml;charset=UTF-8', responseText : '<\u00FF\/>' }, {
{ contentType: 'text/html;charset=UTF-8', responseText : '<body>\uFFFD<\/body>' }, /*invalid character code in document turns into FFFD*/ title: 'XML document, windows-1252',
{ contentType: 'text/html;charset=UTF-8', responseText : '<body>\u30C6\u30b9\u30c8<\/body>' } /* correctly serialized Shift-JIS */, url: 'resources/win-1252-xml.py',
{ contentType: 'text/html;charset=UTF-8', responseText: 'top' }, /* There's some markup included, but it's not really relevant for this test suite, so we do an indexOf() test */ contentType: 'application/xml;charset=UTF-8',
{ contentType: 'text/html;charset=UTF-8' }, responseText: '<\u00FF\/>'
{ contentType: 'text/html;charset=UTF-8', responseText: '<img>foo' }, },
{ contentType: 'text/html;charset=UTF-8', responseText: '<!DOCTYPE html><html><head></head><body><div></div></body></html>' } // Invalid character code in document turns into U+FFFD.
] {
title: 'HTML document, invalid UTF-8',
url: 'resources/invalid-utf8-html.py',
contentType: 'text/html;charset=UTF-8',
responseText: '<body>\uFFFD<\/body>'
},
// Correctly serialized Shift-JIS.
{
title: 'HTML document, shift-jis',
url: 'resources/shift-jis-html.py',
contentType: 'text/html;charset=UTF-8',
responseText: '<body>\u30C6\u30b9\u30c8<\/body>'
},
// There's some markup included, but it's not really relevant for this
// test suite, so we do an indexOf() test.
{
title: 'plain text file',
url: 'folder.txt',
contentType: 'text/html;charset=UTF-8',
responseText: 'top'
},
// This test does not want to assert anything about what markup a
// standalone image should be wrapped in. Hence this test lacks a
// responseText expectation.
{
title: 'image file',
url: 'resources/image.gif',
contentType: 'text/html;charset=UTF-8'
},
{
title: 'img tag',
url: 'resources/img-utf8-html.py',
contentType: 'text/html;charset=UTF-8',
responseText: '<img>foo'
},
{
title: 'empty div',
url: 'resources/empty-div-utf8-html.py',
contentType: 'text/html;charset=UTF-8',
responseText: '<!DOCTYPE html><html><head></head><body><div></div></body></html>'
}
];
tests.forEach(function(t) {
function request(input, number, title) { async_test(function() {
test(function() { var iframe = document.createElement("iframe");
iframe.onload = this.step_func_done(function() {
var client = new XMLHttpRequest() var client = new XMLHttpRequest()
client.open("POST", "resources/content.py?response_charset_label=UTF-8", false) client.open("POST", "resources/content.py?response_charset_label=UTF-8", false)
client.send(input) client.send(iframe.contentDocument)
var exp = expectations[number] assert_equals(client.getResponseHeader('X-Request-Content-Type'),
assert_equals(client.getResponseHeader('X-Request-Content-Type'), exp.contentType, 'document should be serialized and sent as '+exp.contentType+' (TEST#'+number+')') t.contentType,
// The indexOf() assertation will overlook some stuff, i.e. XML prologues that shouldn't be there (looking at you, Presto). 'document should be serialized and sent as ' + t.contentType)
// However, arguably these things have little to do with the XHR functionality we're testing. // The indexOf() assertion will overlook some stuff, e.g. XML
if(exp.responseText){ // This test does not want to assert anything about what markup a standalone IMG should be wrapped in. Hence the GIF test lacks a responseText expectation. // prologues that shouldn't be there (looking at you, Presto).
assert_true(client.responseText.indexOf(exp.responseText) != -1, // However, arguably these things have little to do with the XHR
JSON.stringify(exp.responseText) + " not in " + // functionality we're testing.
if (t.responseText) {
assert_true(client.responseText.indexOf(t.responseText) != -1,
JSON.stringify(t.responseText) + " not in " +
JSON.stringify(client.responseText)); JSON.stringify(client.responseText));
} }
assert_equals(client.responseXML, null) assert_equals(client.responseXML, null)
}, title) });
} iframe.src = t.url;
function init(fr, number, title) { request(fr.contentDocument, number, title) } document.body.appendChild(iframe);
}, t.title);
});
</script> </script>
<!--
This test also tests how documents in various encodings are serialized.
The below IFRAMEs contain:
* one XML document parsed from a windows-1252 source - content is <ÿ/>
* one HTML-document parsed from an invalid UTF-8 source, will contain a basic HTML DOM
with a U+FFFD replacement character for the invalid char
* one HTML document parsed from a valid Shift-JIS source
-->
<iframe src='resources/win-1252-xml.py' onload="init(this, 0, 'XML document, windows-1252')"></iframe>
<iframe src='resources/invalid-utf8-html.py' onload="init(this, 1, 'HTML document, invalid UTF-8')"></iframe>
<iframe src='resources/shift-jis-html.py' onload="init(this, 2, 'HTML document, shift-jis')"></iframe>
<iframe src='folder.txt' onload="init(this, 3, 'plain text file')"></iframe>
<iframe src='resources/image.gif' onload="init(this, 4, 'image file')"></iframe>
<iframe src='resources/img-utf8-html.py' onload="init(this, 5, 'img tag')"></iframe>
<iframe src='resources/empty-div-utf8-html.py' onload="init(this, 6, 'empty div')"></iframe>
</body> </body>
</html> </html>

View file

@ -4,7 +4,7 @@
<title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD - async, no upload events should fire</title> <title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD - async, no upload events should fire</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7] following::OL[1]/LI[8]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7] following::OL[1]/LI[8]" />
</head> </head>
<body> <body>

View file

@ -4,7 +4,7 @@
<title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD</title> <title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::OL[1]/LI[3] following::OL[1]/LI[7]" />
</head> </head>
<body> <body>

View file

@ -29,7 +29,7 @@
test.done() test.done()
}) })
} }
client.send(null) client.send(null)
</script> </script>
</body> </body>
</html> </html>

View file

@ -5,7 +5,7 @@
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dl[1]/dt[2]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dl[1]/dt[2]" />
<!-- <!--
NOTE: the XHR spec does not really handle this scenario. It's handled in the Fetch spec: NOTE: the XHR spec does not really handle this scenario. It's handled in the Fetch spec:
"If response's headers do not contain a header whose name is Location, return response." "If response's headers do not contain a header whose name is Location, return response."
--> -->

View file

@ -25,7 +25,7 @@
// 307 redirects should resend the POST data, and events and headers will be a little different.. // 307 redirects should resend the POST data, and events and headers will be a little different..
if(shouldResendPost) { if(shouldResendPost) {
expectedHeaders = { expectedHeaders = {
"X-Request-Content-Length": "11988", "X-Request-Content-Length": "11988",
"X-Request-Content-Type": "text/plain;charset=UTF-8", "X-Request-Content-Type": "text/plain;charset=UTF-8",
"X-Request-Method": "POST", "X-Request-Method": "POST",
@ -45,12 +45,12 @@
]; ];
} else { } else {
// setting the right expectations for POST resent as GET without request body // setting the right expectations for POST resent as GET without request body
expectedHeaders = { expectedHeaders = {
"X-Request-Content-Length": "NO", "X-Request-Content-Length": "NO",
"X-Request-Content-Type": "NO", "X-Request-Content-Type": "NO",
"X-Request-Method": "GET", "X-Request-Method": "GET",
"X-Request-Query": "NO" "X-Request-Query": "NO"
} }
expectedEvents = [ expectedEvents = [
"xhr onreadystatechange 1", "xhr onreadystatechange 1",
"xhr loadstart 1", "xhr loadstart 1",

View file

@ -4,7 +4,7 @@
<title>XMLHttpRequest: setRequestHeader() after send()</title> <title>XMLHttpRequest: setRequestHeader() after send()</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[2]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="/following::ol/li[2]" />
</head> </head>
<body> <body>
<div id="log"></div> <div id="log"></div>

View file

@ -4,7 +4,7 @@
<title>XMLHttpRequest: setRequestHeader() before open()</title> <title>XMLHttpRequest: setRequestHeader() before open()</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-setrequestheader()-method" data-tested-assertations="following::ol/li[1]" />
</head> </head>
<body> <body>
<div id="log"></div> <div id="log"></div>

View file

@ -18,6 +18,17 @@
client.send(null) client.send(null)
assert_equals(client.responseText, "x-test,") assert_equals(client.responseText, "x-test,")
}) })
test(() => {
const client = new XMLHttpRequest
client.open("GET", "resources/echo-headers.py", false)
client.setRequestHeader("THIS-IS-A-TEST", "1")
client.setRequestHeader("THIS-is-A-test", "2")
client.setRequestHeader("content-TYPE", "x/x")
client.send()
assert_regexp_match(client.responseText, /content-TYPE/)
assert_regexp_match(client.responseText, /THIS-IS-A-TEST: 1, 2/)
})
</script> </script>
</body> </body>
</html> </html>

View file

@ -17,15 +17,16 @@
<div id="log"></div> <div id="log"></div>
<script type="text/javascript"> <script type="text/javascript">
var test = async_test();
function startRequest() { function startRequest() {
xhr.open("GET", "./resources/content.py?content=Hi", true); xhr.open("GET", "./resources/content.py?content=Hi", true);
xhr.timeout = 2000; xhr.timeout = 2000;
setTimeout(function () { test.step_timeout(function () {
xhr.send(); xhr.send();
}, 1000); }, 1000);
} }
var test = async_test();
test.step(function() test.step(function()
{ {
var count = 0; var count = 0;
@ -40,7 +41,7 @@ test.step(function()
assert_unreached("HTTP error should not timeout"); assert_unreached("HTTP error should not timeout");
} }
startRequest(); startRequest();
setTimeout(startRequest, 3500); test.step_timeout(startRequest, 3500);
}); });
</script> </script>

View file

@ -4,16 +4,16 @@
<title>XMLHttpRequest: members during UNSENT</title> <title>XMLHttpRequest: members during UNSENT</title>
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-unsent" data-tested-assertations=".. following::dd" /> <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-unsent" data-tested-assertations=".. following::dd" />
<link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#dom-xmlhttprequest-setrequestheader" data-tested-assertations="following::ol/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::ol/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol/li[1]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol/li[1]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[2]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol/li[2]" />
<link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol/li[2]" /> <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol/li[2]" />
</head> </head>
<body> <body>
<div id="log"></div> <div id="log"></div>

View file

@ -78,6 +78,7 @@ dictionary SecurityPolicyViolationEventInit : EventInit {
}; };
[ [
Constructor(),
CheckSecurity=Receiver, CheckSecurity=Receiver,
Exposed=(Window,Worker), Exposed=(Window,Worker),
ImmutablePrototype ImmutablePrototype

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="timeout" content="long">
<title>Async Cookies: Basic tests for cookieStore</title>
<meta name="help" href="https://github.com/WICG/async-cookies-api/blob/gh-pages/explainer.md">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-helpers.js"></script>
<script src="resources/cookie-store-tests.js"></script>
<script>
'use strict';
suite();
</script>

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<meta name="timeout" content="long">
<title>Async Cookies: Basic tests for cookieStore (HTTPS)</title>
<meta name="help" href="https://github.com/WICG/async-cookies-api/blob/gh-pages/explainer.md">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/testharness-helpers.js"></script>
<script src="resources/cookie-store-tests.js"></script>
<script>
'use strict';
suite();
</script>

Some files were not shown because too many files have changed in this diff Show more