mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 44702f2bc8ea98bc32b5b244f2fe63c6ce66d49d
This commit is contained in:
parent
85fa6409bb
commit
c227604a2c
997 changed files with 45660 additions and 14650 deletions
|
@ -71,7 +71,7 @@ def create_parser_wpt():
|
|||
parser = wptcommandline.create_parser()
|
||||
parser.add_argument('--release', default=False, action="store_true",
|
||||
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")
|
||||
parser.add_argument('--pref', default=[], action="append", dest="prefs",
|
||||
help="Pass preferences to servo")
|
||||
|
@ -471,7 +471,7 @@ class MachCommands(CommandBase):
|
|||
|
||||
os.environ["RUST_BACKTRACE"] = "1"
|
||||
kwargs["debug"] = not kwargs["release"]
|
||||
if kwargs.pop("chaos"):
|
||||
if kwargs.pop("rr_chaos"):
|
||||
kwargs["debugger"] = "rr"
|
||||
kwargs["debugger_args"] = "record --chaos"
|
||||
kwargs["repeat_until_unexpected"] = True
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,2 +1,2 @@
|
|||
local: b74f52d6df118d832db08276ebe698fee2fa2265
|
||||
upstream: f1d5e1dcd20176cee05692bd78863e9b03ace93b
|
||||
local: 85fa6409bb699647b4f5e22952538365e87418d7
|
||||
upstream: 40ee9a4553dca805163766c5970979a23e357292
|
||||
|
|
|
@ -12,6 +12,7 @@ from mozlog.structured import structuredlog
|
|||
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", "wptserve")))
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(here, os.pardir, "tests", "tools", "scripts")))
|
||||
|
||||
from wptrunner.update import setup_logging, WPTUpdate
|
||||
|
|
|
@ -26,7 +26,9 @@ matrix:
|
|||
include:
|
||||
- os: linux
|
||||
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:
|
||||
provider: releases
|
||||
api_key:
|
||||
|
|
|
@ -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>
|
109
tests/wpt/web-platform-tests/IndexedDB/wasm-module-value.html
Normal file
109
tests/wpt/web-platform-tests/IndexedDB/wasm-module-value.html
Normal 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>
|
|
@ -17,6 +17,10 @@ Setting Up the Repo
|
|||
|
||||
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
|
||||
=================
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
assert_equals(client.statusText, "")
|
||||
assert_equals(client.responseXML, null)
|
||||
assert_equals(client.getAllResponseHeaders(), "")
|
||||
setTimeout(function() {
|
||||
test.step_timeout(function() {
|
||||
assert_array_equals(result, expected)
|
||||
test.done();
|
||||
}, 100); // wait a bit in case XHR timeout causes spurious event
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
assert_equals(client.statusText, "")
|
||||
assert_equals(client.responseXML, null)
|
||||
assert_equals(client.getAllResponseHeaders(), "")
|
||||
setTimeout(function() {
|
||||
test.step_timeout(function() {
|
||||
assert_array_equals(result, expected)
|
||||
test.done();
|
||||
}, 100); // wait a bit in case XHR timeout causes spurious event
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
assert_equals(client.statusText, "")
|
||||
assert_equals(client.responseXML, null)
|
||||
assert_equals(client.getAllResponseHeaders(), "")
|
||||
setTimeout(function() {
|
||||
test.step_timeout(function() {
|
||||
assert_array_equals(result, expected)
|
||||
test.done();
|
||||
}, 100); // wait a bit in case XHR timeout causes spurious event
|
||||
|
@ -51,4 +51,3 @@
|
|||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -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>
|
|
@ -9,27 +9,22 @@
|
|||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var test = async_test()
|
||||
test.step(function() {
|
||||
async_test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
var headersUnsent = client.getAllResponseHeaders();
|
||||
test.step(function() {
|
||||
assert_equals(headersUnsent, "")
|
||||
});
|
||||
client.onreadystatechange = function() {
|
||||
test.step(function() {
|
||||
var headers = client.getAllResponseHeaders().toLowerCase()
|
||||
if(client.readyState == 1) {
|
||||
assert_equals(headers, "")
|
||||
}
|
||||
if(client.readyState > 1) {
|
||||
assert_false(headers.indexOf("200 ok") != -1)
|
||||
assert_false(headers.indexOf("http/1.") != -1)
|
||||
}
|
||||
if(client.readyState == 4)
|
||||
test.done()
|
||||
})
|
||||
}
|
||||
assert_equals(client.getAllResponseHeaders(), "")
|
||||
|
||||
client.onreadystatechange = this.step_func(function() {
|
||||
var headers = client.getAllResponseHeaders().toLowerCase()
|
||||
if(client.readyState == 1) {
|
||||
assert_equals(headers, "")
|
||||
}
|
||||
if(client.readyState > 1) {
|
||||
assert_false(headers.indexOf("200 ok") != -1)
|
||||
assert_false(headers.indexOf("http/1.") != -1)
|
||||
}
|
||||
if(client.readyState == 4)
|
||||
this.done()
|
||||
})
|
||||
client.open("GET", "resources/headers.py")
|
||||
client.send(null)
|
||||
})
|
||||
|
|
|
@ -9,6 +9,7 @@ async_test((t) => {
|
|||
client.onload = t.step_func_done(() => {
|
||||
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.send(null)
|
||||
})
|
||||
|
@ -18,7 +19,15 @@ async_test((t) => {
|
|||
client.onload = t.step_func_done(() => {
|
||||
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.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>
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
test.step(function() {
|
||||
var client = new XMLHttpRequest(),
|
||||
result = [],
|
||||
expected = [1, 4, 1] // open() -> 1,
|
||||
expected = [1, 4, 1] // open() -> 1,
|
||||
// abort() -> 4, open() -> 1
|
||||
client.onreadystatechange = function() {
|
||||
test.step(function() {
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "resources/content.py?\u00DF", false) // This is the German "eszett" character
|
||||
client.send()
|
||||
assert_equals(client.getResponseHeader("x-request-query"), "%C3%9F")
|
||||
assert_equals(client.getResponseHeader("x-request-query"), "%DF")
|
||||
}, "percent encode characters");
|
||||
test(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("GET", "resources/content.py?\uD83D", false)
|
||||
client.send()
|
||||
assert_equals(client.getResponseHeader("x-request-query"), "%EF%BF%BD")
|
||||
}, "lone surrogate should return U+FFFD");
|
||||
assert_equals(client.getResponseHeader("x-request-query"), "&%2365533;")
|
||||
}, "lone surrogate");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
test(function() {
|
||||
var client = new self[0].XMLHttpRequest()
|
||||
document.body.removeChild(document.getElementsByTagName("iframe")[0])
|
||||
assert_throws("InvalidStateError", function() {
|
||||
client.open("GET", "folder.txt")
|
||||
assert_throws("InvalidStateError", function() {
|
||||
client.open("GET", "folder.txt")
|
||||
}, "open() when associated document's IFRAME is removed")
|
||||
})
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
var client = new self[0].XMLHttpRequest()
|
||||
client.open("GET", "folder.txt")
|
||||
document.body.removeChild(document.getElementsByTagName("iframe")[0])
|
||||
assert_throws("InvalidStateError", function() {
|
||||
assert_throws("InvalidStateError", function() {
|
||||
client.send(null)
|
||||
}, "send() when associated document's IFRAME is removed")
|
||||
})
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
/*
|
||||
It's unclear what the pass condition should be for this test.
|
||||
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
|
||||
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() {
|
||||
var hasErrorEvent = false
|
||||
var client = new self[0].XMLHttpRequest()
|
||||
client.onreadystatechange = function() {
|
||||
client.onreadystatechange = function() {
|
||||
test.step(function() {
|
||||
if(client.readyState == 4) {
|
||||
assert_equals(client.responseText, "", "responseText is empty on inactive document error condition")
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
ifr.onload = function() {
|
||||
// Again, do things async so we're not doing loads from inside
|
||||
// load events.
|
||||
setTimeout(function() {
|
||||
test.step_timeout(function() {
|
||||
client = new ifr.contentWindow.XMLHttpRequest();
|
||||
count++;
|
||||
// Important to do a normal navigation, not a reload.
|
||||
|
|
|
@ -1,43 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<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 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>
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>XMLHttpRequest: redirected worker scripts, origin and referrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var finalWorkerURL = "workerxhr-origin-referrer.js";
|
||||
var url = "resources/redirect.py?location=" + encodeURIComponent(finalWorkerURL);
|
||||
fetch_tests_from_worker(new Worker(url));
|
||||
</script>
|
||||
|
|
|
@ -1,43 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>XMLHttpRequest: worker scripts, origin and referrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></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]" />
|
||||
</head>
|
||||
<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>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>XMLHttpRequest: worker scripts, origin and referrer</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
fetch_tests_from_worker(new Worker("resources/workerxhr-origin-referrer.js"));
|
||||
</script>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
var client = new XMLHttpRequest();
|
||||
client.onreadystatechange = function() {
|
||||
if (client.readyState !== 4) return;
|
||||
try{
|
||||
try{
|
||||
var str = client.responseXML.documentElement.tagName+client.responseXML.documentElement.firstChild.tagName+client.responseXML.documentElement.firstChild.textContent;
|
||||
}catch(e){
|
||||
assert_unreached('Exception when reading responseXML');
|
||||
}
|
||||
}catch(e){
|
||||
assert_unreached('Exception when reading responseXML');
|
||||
}
|
||||
assert_equals( client.responseXML.documentElement.tagName, 'test' );
|
||||
assert_equals( client.responseXML.documentElement.firstChild.tagName, 'message' );
|
||||
assert_equals( client.responseXML.documentElement.firstChild.textContent, 'Hello World!' );
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
import imp
|
||||
import os
|
||||
|
||||
here = os.path.dirname(__file__)
|
||||
|
||||
|
||||
def main(request, response):
|
||||
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-Methods', 'GET');
|
||||
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');
|
||||
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":
|
||||
return ""
|
||||
else:
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import imp
|
||||
import os
|
||||
|
||||
here = os.path.dirname(__file__)
|
||||
|
||||
def main(request, response):
|
||||
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-Methods', 'GET');
|
||||
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');
|
||||
auth = imp.load_source("", os.path.join(os.path.abspath(os.curdir),
|
||||
"XMLHttpRequest",
|
||||
"resources",
|
||||
auth = imp.load_source("", os.path.join(here,
|
||||
os.pardir,
|
||||
"authentication.py"))
|
||||
if request.method == "OPTIONS":
|
||||
return ""
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import imp
|
||||
import os
|
||||
|
||||
here = os.path.dirname(__file__)
|
||||
|
||||
|
||||
def main(request, response):
|
||||
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-Methods', 'GET');
|
||||
response.headers.set('Access-Control-Allow-Headers', 'x-user, x-pass');
|
||||
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),
|
||||
"XMLHttpRequest",
|
||||
"resources",
|
||||
auth = imp.load_source("", os.path.join(here,
|
||||
os.pardir,
|
||||
"authentication.py"))
|
||||
if request.method == "OPTIONS":
|
||||
return ""
|
||||
|
|
|
@ -1,34 +1,63 @@
|
|||
// This simply posts a message to the owner page with the contents of the Referer header
|
||||
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()
|
||||
importScripts("/resources/testharness.js")
|
||||
|
||||
// This simply posts a message to the owner page with the contents of the Origin header
|
||||
var xhr2=new XMLHttpRequest()
|
||||
xhr2.onreadystatechange = function(){
|
||||
if(xhr2.readyState == 4){
|
||||
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()
|
||||
async_test(function() {
|
||||
var expected = 'Referer: ' +
|
||||
location.href.replace(/[^/]*$/, '') +
|
||||
"workerxhr-origin-referrer.js\n"
|
||||
|
||||
// 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 xhr3=new XMLHttpRequest()
|
||||
xhr3.onreadystatechange = function(){
|
||||
if(xhr3.readyState == 4){
|
||||
var obj = {test:'Request URL test', result:xhr3.responseText}
|
||||
self.postMessage(obj)
|
||||
var xhr = new XMLHttpRequest()
|
||||
xhr.onreadystatechange = this.step_func(function() {
|
||||
if (xhr.readyState == 4) {
|
||||
assert_equals(xhr.responseText, expected)
|
||||
this.done()
|
||||
}
|
||||
}
|
||||
xhr3.open('GET', 'requri.py?full', true)
|
||||
xhr3.send()
|
||||
})
|
||||
xhr.open('GET', 'inspect-headers.py?filter_name=referer', true)
|
||||
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()
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
|
||||
var xhr=new XMLHttpRequest()
|
||||
xhr.onreadystatechange = function(){
|
||||
if(xhr.readyState == 4){
|
||||
var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
|
||||
self.postMessage(status)
|
||||
}
|
||||
if(xhr.readyState == 4){
|
||||
var status = xhr.responseText === 'bottom\n' ? 'PASSED' : 'FAILED'
|
||||
self.postMessage(status)
|
||||
}
|
||||
}
|
||||
xhr.open('GET', 'folder.txt', true)
|
||||
xhr.send()
|
||||
|
|
|
@ -2,5 +2,5 @@ if (this.document === undefined)
|
|||
importScripts("xmlhttprequest-timeout.js");
|
||||
|
||||
runTestRequests([ new RequestTracker(true, "no time out scheduled, load fires normally", 0),
|
||||
new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
|
||||
new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
|
||||
new RequestTracker(true, "load fires normally", TIME_NORMAL_LOAD),
|
||||
new RequestTracker(true, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
runTestRequests([ SyncRequestSettingTimeoutAfterOpen,
|
||||
SyncRequestSettingTimeoutBeforeOpen ]);
|
||||
SyncRequestSettingTimeoutBeforeOpen ]);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
if (this.document === undefined){
|
||||
importScripts("xmlhttprequest-timeout.js");
|
||||
}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. */
|
||||
|
||||
runTestRequests([ new RequestTracker(false, "no time out scheduled, load fires normally", 0),
|
||||
new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD),
|
||||
new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
|
||||
new RequestTracker(false, "load fires normally", TIME_NORMAL_LOAD),
|
||||
new RequestTracker(false, "timeout hit before load", TIME_REGULAR_TIMEOUT) ]);
|
||||
|
|
|
@ -2,5 +2,5 @@ if (this.document === undefined)
|
|||
importScripts("xmlhttprequest-timeout.js");
|
||||
|
||||
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, "timeout fires normally with same timeout set twice", TIME_REGULAR_TIMEOUT, TIME_DELAY, TIME_REGULAR_TIMEOUT) ]);
|
||||
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) ]);
|
||||
|
|
|
@ -245,7 +245,7 @@ AbortedRequest.prototype = {
|
|||
/**
|
||||
* 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
|
||||
* That's why we chose to accept secondary "abort" events in this test.
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
|
||||
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>");
|
||||
const encoded_html =
|
||||
encodeURIComponent("<!doctype html><meta charset=windows-1252><x>") + encoded_content + encodeURIComponent("<\/x>");
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<body>
|
||||
<div id="log"></div>
|
||||
<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
|
||||
// user2, pass2 will if given be passed to open() call
|
||||
test(function() {
|
||||
|
|
|
@ -11,51 +11,82 @@
|
|||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
var expectations = [
|
||||
{ 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*/
|
||||
{ contentType: 'text/html;charset=UTF-8', responseText : '<body>\u30C6\u30b9\u30c8<\/body>' } /* correctly serialized Shift-JIS */,
|
||||
{ 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: 'text/html;charset=UTF-8' },
|
||||
{ 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>' }
|
||||
]
|
||||
var tests = [
|
||||
{
|
||||
title: 'XML document, windows-1252',
|
||||
url: 'resources/win-1252-xml.py',
|
||||
contentType: 'application/xml;charset=UTF-8',
|
||||
responseText: '<\u00FF\/>'
|
||||
},
|
||||
// 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>'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
function request(input, number, title) {
|
||||
test(function() {
|
||||
tests.forEach(function(t) {
|
||||
async_test(function() {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.onload = this.step_func_done(function() {
|
||||
var client = new XMLHttpRequest()
|
||||
client.open("POST", "resources/content.py?response_charset_label=UTF-8", false)
|
||||
client.send(input)
|
||||
var exp = expectations[number]
|
||||
assert_equals(client.getResponseHeader('X-Request-Content-Type'), exp.contentType, 'document should be serialized and sent as '+exp.contentType+' (TEST#'+number+')')
|
||||
// The indexOf() assertation will overlook some stuff, i.e. XML prologues that shouldn't be there (looking at you, Presto).
|
||||
// However, arguably these things have little to do with the XHR functionality we're testing.
|
||||
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.
|
||||
assert_true(client.responseText.indexOf(exp.responseText) != -1,
|
||||
JSON.stringify(exp.responseText) + " not in " +
|
||||
client.send(iframe.contentDocument)
|
||||
assert_equals(client.getResponseHeader('X-Request-Content-Type'),
|
||||
t.contentType,
|
||||
'document should be serialized and sent as ' + t.contentType)
|
||||
// The indexOf() assertion will overlook some stuff, e.g. XML
|
||||
// prologues that shouldn't be there (looking at you, Presto).
|
||||
// However, arguably these things have little to do with the XHR
|
||||
// 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));
|
||||
}
|
||||
assert_equals(client.responseXML, null)
|
||||
}, title)
|
||||
}
|
||||
function init(fr, number, title) { request(fr.contentDocument, number, title) }
|
||||
});
|
||||
iframe.src = t.url;
|
||||
document.body.appendChild(iframe);
|
||||
}, t.title);
|
||||
});
|
||||
</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>
|
||||
</html>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<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/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>
|
||||
<body>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: send() - non-empty data argument and GET/HEAD</title>
|
||||
<script src="/resources/testharness.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>
|
||||
<body>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
test.done()
|
||||
})
|
||||
}
|
||||
client.send(null)
|
||||
client.send(null)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<script src="/resources/testharness.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]" />
|
||||
<!--
|
||||
<!--
|
||||
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."
|
||||
-->
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
// 307 redirects should resend the POST data, and events and headers will be a little different..
|
||||
if(shouldResendPost) {
|
||||
expectedHeaders = {
|
||||
expectedHeaders = {
|
||||
"X-Request-Content-Length": "11988",
|
||||
"X-Request-Content-Type": "text/plain;charset=UTF-8",
|
||||
"X-Request-Method": "POST",
|
||||
|
@ -45,12 +45,12 @@
|
|||
];
|
||||
} else {
|
||||
// setting the right expectations for POST resent as GET without request body
|
||||
expectedHeaders = {
|
||||
expectedHeaders = {
|
||||
"X-Request-Content-Length": "NO",
|
||||
"X-Request-Content-Type": "NO",
|
||||
"X-Request-Method": "GET",
|
||||
"X-Request-Query": "NO"
|
||||
}
|
||||
}
|
||||
expectedEvents = [
|
||||
"xhr onreadystatechange 1",
|
||||
"xhr loadstart 1",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: setRequestHeader() after send()</title>
|
||||
<script src="/resources/testharness.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>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>XMLHttpRequest: setRequestHeader() before open()</title>
|
||||
<script src="/resources/testharness.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>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -18,6 +18,17 @@
|
|||
client.send(null)
|
||||
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>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -17,15 +17,16 @@
|
|||
<div id="log"></div>
|
||||
<script type="text/javascript">
|
||||
|
||||
var test = async_test();
|
||||
|
||||
function startRequest() {
|
||||
xhr.open("GET", "./resources/content.py?content=Hi", true);
|
||||
xhr.timeout = 2000;
|
||||
setTimeout(function () {
|
||||
test.step_timeout(function () {
|
||||
xhr.send();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
var test = async_test();
|
||||
test.step(function()
|
||||
{
|
||||
var count = 0;
|
||||
|
@ -40,7 +41,7 @@ test.step(function()
|
|||
assert_unreached("HTTP error should not timeout");
|
||||
}
|
||||
startRequest();
|
||||
setTimeout(startRequest, 3500);
|
||||
test.step_timeout(startRequest, 3500);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
|
@ -4,16 +4,16 @@
|
|||
<title>XMLHttpRequest: members during UNSENT</title>
|
||||
<script src="/resources/testharness.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-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-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-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-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/#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/#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-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-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-responsexml-attribute" data-tested-assertations="following::ol/li[2]" />
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
|
|
|
@ -78,6 +78,7 @@ dictionary SecurityPolicyViolationEventInit : EventInit {
|
|||
};
|
||||
|
||||
[
|
||||
Constructor(),
|
||||
CheckSecurity=Receiver,
|
||||
Exposed=(Window,Worker),
|
||||
ImmutablePrototype
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Basic tests for cookieStore (Static)</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>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Basic tests for cookieStore (Static; 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>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: delete cookies</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({testName: 'testDeleteCookies'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: delete cookies (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({testName: 'testDeleteCookies'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: delete cookies (Static)</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({testName: 'testDeleteCookies'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: delete cookies (Static; 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({testName: 'testDeleteCookies'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: document.cookie</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({testName: 'testDocumentCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: document.cookie (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({testName: 'testDocumentCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: document.cookie (Static)</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({testName: 'testDocumentCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: document.cookie (Static; 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({testName: 'testDocumentCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: expiration</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({testName: 'testExpiration'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: expiration (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({testName: 'testExpiration'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: expiration (Static)</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({testName: 'testExpiration'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: expiration (Static; 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({testName: 'testExpiration'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: get, set, getAll</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({testName: 'testGetSetGetAll'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: get, set, getAll (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({testName: 'testGetSetGetAll'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: get, set, getAll (Static)</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({testName: 'testGetSetGetAll'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: get, set, getAll (Static; 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({testName: 'testGetSetGetAll'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: HTTP Cookie and Set-Cookie headers</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({testName: 'testHttpCookieAndSetCookieHeaders'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: HTTP Cookie and Set-Cookie headers (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({testName: 'testHttpCookieAndSetCookieHeaders'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: <title>Async Cookies: document.cookie</title>lt;Meta Http-Equiv="Set-Cookie" ... <title>Async Cookies: document.cookie</title>gt;</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({testName: 'testMetaHttpEquivSetCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: <title>Async Cookies: document.cookie</title>lt;Meta Http-Equiv="Set-Cookie" ... <title>Async Cookies: document.cookie</title>gt; (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({testName: 'testMetaHttpEquivSetCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: <title>Async Cookies: document.cookie</title>lt;Meta Http-Equiv="Set-Cookie" ... <title>Async Cookies: document.cookie</title>gt; (Static)</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({testName: 'testMetaHttpEquivSetCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: <title>Async Cookies: document.cookie</title>lt;Meta Http-Equiv="Set-Cookie" ... <title>Async Cookies: document.cookie</title>gt; (Static; 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({testName: 'testMetaHttpEquivSetCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name and No Value</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({testName: 'testNoNameAndNoValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name and No Value (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({testName: 'testNoNameAndNoValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name and No Value (Static)</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({testName: 'testNoNameAndNoValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name and No Value (Static; 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({testName: 'testNoNameAndNoValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, '=' in Value</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({testName: 'testNoNameEqualsInValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, '=' in Value (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({testName: 'testNoNameEqualsInValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, '=' in Value (Static)</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({testName: 'testNoNameEqualsInValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, '=' in Value (Static; 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({testName: 'testNoNameEqualsInValue'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, Multiple Values</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({testName: 'testNoNameMultipleValues'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, Multiple Values (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({testName: 'testNoNameMultipleValues'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, Multiple Values (Static)</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({testName: 'testNoNameMultipleValues'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test No Name, Multiple Values (Static; 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({testName: 'testNoNameMultipleValues'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test Observation</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({testName: 'testObservation'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test Observation (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({testName: 'testObservation'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test Observation (Static)</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({testName: 'testObservation'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: Test Observation (Static; 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({testName: 'testObservation'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: One simple origin cookie</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({testName: 'testOneSimpleOriginCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: One simple origin cookie (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({testName: 'testOneSimpleOriginCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: One simple origin cookie (Static)</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({testName: 'testOneSimpleOriginCookie'});
|
||||
</script>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<meta name="timeout" content="long">
|
||||
<title>Async Cookies: One simple origin cookie (Static; 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({testName: 'testOneSimpleOriginCookie'});
|
||||
</script>
|
File diff suppressed because it is too large
Load diff
69
tests/wpt/web-platform-tests/cookie-store/resources/cookie_helper.py
Executable file
69
tests/wpt/web-platform-tests/cookie-store/resources/cookie_helper.py
Executable file
|
@ -0,0 +1,69 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Active wptserve handler for cookie operations.
|
||||
#
|
||||
# This must support the following requests:
|
||||
#
|
||||
# - GET with the following query parameters:
|
||||
# - charset: (optional) character set for response (default: utf-8)
|
||||
# A cookie: request header (if present) is echoed in the body with a
|
||||
# cookie= prefix followed by the urlencoded bytes from the header.
|
||||
# Used to inspect the cookie jar from an HTTP request header context.
|
||||
# - POST with form-data in the body and the following query-or-form parameters:
|
||||
# - set-cookie: (optional; repeated) echoed in the set-cookie: response
|
||||
# header and also echoed in the body with a set-cookie= prefix
|
||||
# followed by the urlencoded bytes from the parameter; multiple occurrences
|
||||
# are CRLF-delimited.
|
||||
# Used to set cookies from an HTTP response header context.
|
||||
#
|
||||
# The response has 200 status and content-type: text/plain; charset=<charset>
|
||||
import cgi, encodings, os, re, sys, urllib
|
||||
|
||||
# NOTE: These are intentionally very lax to permit testing
|
||||
DISALLOWED_IN_COOKIE_NAME_RE = re.compile(r'[;\0-\x1f\x7f]');
|
||||
DISALLOWED_IN_HEADER_RE = re.compile(r'[\0-\x1f\x7f]');
|
||||
|
||||
# Ensure common charset names do not end up with different
|
||||
# capitalization or punctuation
|
||||
CHARSET_OVERRIDES = {
|
||||
encodings.codecs.lookup(charset).name: charset
|
||||
for charset in ('utf-8', 'iso-8859-1',)
|
||||
}
|
||||
|
||||
def main(request, response):
|
||||
assert request.method in (
|
||||
'GET',
|
||||
'POST',
|
||||
), 'request method was neither GET nor POST: %r' % request.method
|
||||
qd = (request.url.split('#')[0].split('?', 1) + [''])[1]
|
||||
if request.method == 'POST':
|
||||
qd += '&' + request.body
|
||||
args = cgi.parse_qs(qd, keep_blank_values = True)
|
||||
charset = encodings.codecs.lookup(args.get('charset', ['utf-8'])[-1]).name
|
||||
charset = CHARSET_OVERRIDES.get(charset, charset)
|
||||
headers = [('content-type', 'text/plain; charset=' + charset)]
|
||||
body = []
|
||||
if request.method == 'POST':
|
||||
for set_cookie in args.get('set-cookie', []):
|
||||
if '=' in set_cookie.split(';', 1)[0]:
|
||||
name, rest = set_cookie.split('=', 1)
|
||||
assert re.search(
|
||||
DISALLOWED_IN_COOKIE_NAME_RE,
|
||||
name
|
||||
) is None, 'name had disallowed characters: %r' % name
|
||||
else:
|
||||
rest = set_cookie
|
||||
assert re.search(
|
||||
DISALLOWED_IN_HEADER_RE,
|
||||
rest
|
||||
) is None, 'rest had disallowed characters: %r' % rest
|
||||
headers.append(('set-cookie', set_cookie))
|
||||
body.append('set-cookie=' + urllib.quote(set_cookie, ''))
|
||||
else:
|
||||
cookie = request.headers.get('cookie')
|
||||
if cookie is not None:
|
||||
body.append('cookie=' + urllib.quote(cookie, ''))
|
||||
body = '\r\n'.join(body)
|
||||
headers.append(('content-length', str(len(body))))
|
||||
return 200, headers, body
|
|
@ -0,0 +1,286 @@
|
|||
'use strict';
|
||||
|
||||
// Length of final setTimeout when observer callback has not fired.
|
||||
//
|
||||
const kExtraObserverDelay = 0; // For builtin implementation
|
||||
|
||||
// NOTE: A polyfill was used for pre-implementation testing. To revive
|
||||
// it uncomment these and comment out the preceding line:
|
||||
//
|
||||
// const kExtraObserverDelay = 200; // Polyfill when not running on battery
|
||||
// // const kExtraObserverDelay = 5000; // ... when running on battery
|
||||
// document.open();
|
||||
// document.write(`
|
||||
// <script>delete cookieStore</script>
|
||||
// <script src="https://wicg.github.io/async-cookies-api/cookies.js">
|
||||
// </script>
|
||||
// `);
|
||||
// document.close()
|
||||
|
||||
// See https://github.com/whatwg/html/pull/3011#issuecomment-331187136
|
||||
// and https://www.chromestatus.com/feature/6170540112871424
|
||||
const kMetaHttpEquivSetCookieIsGone = true;
|
||||
|
||||
// True when running in a document context as opposed to a worker context
|
||||
const kHasDocument = typeof document !== 'undefined';
|
||||
|
||||
// Override for named test inclusion. Set by suite().
|
||||
let testOverride = undefined;
|
||||
|
||||
// Determines whether the named test should be included in this run of the
|
||||
// suite. Only usable in a test runner context as this uses assert_equals.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// - testName: (string) test name; must be an identifier starting with 'test'
|
||||
// - opt_excludeFromAll: (optional; boolean) if true, explicit or implicit
|
||||
// #...&test=all (which is the default) will not activate this test.
|
||||
const includeTest = (testName, opt_excludeFromAll) => {
|
||||
assert_equals(!!testName.match(/^test\w+/), true, 'includeTest: ' + testName);
|
||||
assert_equals(typeof eval(testName), 'function', 'includeTest: ' + testName);
|
||||
let testParams =
|
||||
(location.hash || '#').substr(1).split('&').filter(
|
||||
x => x.match(/^test=/)).map(x => decodeURIComponent(x));
|
||||
if (!testParams.length) {
|
||||
testParams = ['test=all'];
|
||||
if (testOverride !== undefined) {
|
||||
testParams = ['test=' + testOverride];
|
||||
}
|
||||
}
|
||||
const filterSet =
|
||||
testParams.map(x => x.split('=', 2)[1]).join(',').split(',').reduce(
|
||||
(set, name) => Object.assign(set, {[name]: true}), {});
|
||||
for (let name in filterSet) {
|
||||
if (name === 'all' || !filterSet.hasOwnProperty(name)) continue;
|
||||
assert_equals(!!name.match(/^test\w+/), true, '#test=' + testName);
|
||||
assert_equals(typeof eval(name), 'function', '#test=' + testName);
|
||||
}
|
||||
return (filterSet.all && !opt_excludeFromAll) ||
|
||||
filterSet.hasOwnProperty(testName) && filterSet[testName];
|
||||
}
|
||||
|
||||
// True when running on unsecured 'http:' rather than secured 'https:'.
|
||||
const kIsUnsecured = location.protocol !== 'https:';
|
||||
|
||||
// True when no CGI/no active wptserve handlers should be used.
|
||||
const kIsStatic = !!((location.hash || '#').match(/(^#|&)static=true(&|$)/) ||
|
||||
location.pathname.match(/_static\./));
|
||||
|
||||
const kCookieHelperCgi = 'resources/cookie_helper.py';
|
||||
|
||||
// Async wrapper for an async function or promise that is expected
|
||||
// reject in an unsecured (non-https:) context and work in a secured
|
||||
// (https:) context.
|
||||
//
|
||||
// Parameters:
|
||||
//
|
||||
// - testCase: (TestCase) test case context
|
||||
// - code: (Error class or number) expected rejection type in unsecured context
|
||||
// - promise: (thenable) test code
|
||||
// - message: (optional; string) message to forward to promise_rejects in
|
||||
// unsecured context
|
||||
const promise_rejects_when_unsecured = async (
|
||||
testCase,
|
||||
code,
|
||||
promise,
|
||||
message = 'Feature unavailable from unsecured contexts'
|
||||
) => {
|
||||
if (kIsUnsecured) await promise_rejects(testCase, code, promise, message);
|
||||
else await promise;
|
||||
};
|
||||
|
||||
// Converts a list of cookie records {name, value} to [name=]value; ... as
|
||||
// seen in Cookie: and document.cookie.
|
||||
//
|
||||
// Parameters:
|
||||
// - cookies: (array of {name, value}) records to convert
|
||||
//
|
||||
// Returns a string serializing the records, or undefined if no records were
|
||||
// given.
|
||||
const cookieString = cookies => cookies.length ? cookies.map((
|
||||
{name, value}) => (name ? (name + '=') : '') + value).join('; ') :
|
||||
undefined;
|
||||
|
||||
// Approximate async equivalent to the document.cookie getter but with
|
||||
// important differences: optional additional getAll arguments are
|
||||
// forwarded, and an empty cookie jar returns undefined.
|
||||
//
|
||||
// This is intended primarily for verification against expected cookie
|
||||
// jar contents. It should produce more readable messages using
|
||||
// assert_equals in failing cases than assert_object_equals would
|
||||
// using parsed cookie jar contents and also allows expectations to be
|
||||
// written more compactly.
|
||||
const getCookieString = async (...args) => {
|
||||
return cookieString(await cookieStore.getAll(...args));
|
||||
}
|
||||
|
||||
// Approximate async equivalent to the document.cookie getter but from
|
||||
// the server's point of view. Returns UTF-8 interpretation. Allows
|
||||
// sub-path to be specified.
|
||||
//
|
||||
// Unlike document.cookie, this returns undefined when no cookies are
|
||||
// present.
|
||||
const getCookieStringHttp = async (extraPath = null) => {
|
||||
if (kIsStatic) throw 'CGI not available in static HTML test';
|
||||
const url =
|
||||
kCookieHelperCgi + ((extraPath == null) ? '' : ('/' + extraPath));
|
||||
const response = await fetch(url, { credentials: 'include' });
|
||||
const text = await response.text();
|
||||
assert_equals(
|
||||
response.ok,
|
||||
true,
|
||||
'CGI should have succeeded in getCookieStringHttp\n' + text);
|
||||
assert_equals(
|
||||
response.headers.get('content-type'),
|
||||
'text/plain; charset=utf-8',
|
||||
'CGI did not return UTF-8 text in getCookieStringHttp');
|
||||
if (text === '') return undefined;
|
||||
assert_equals(
|
||||
text.indexOf('cookie='),
|
||||
0,
|
||||
'CGI response did not begin with "cookie=" and was not empty: ' + text);
|
||||
return decodeURIComponent(text.replace(/^cookie=/, ''));
|
||||
}
|
||||
|
||||
// Approximate async equivalent to the document.cookie getter but from
|
||||
// the server's point of view. Returns binary string
|
||||
// interpretation. Allows sub-path to be specified.
|
||||
//
|
||||
// Unlike document.cookie, this returns undefined when no cookies are
|
||||
// present.
|
||||
const getCookieBinaryHttp = async (extraPath = null) => {
|
||||
if (kIsStatic) throw 'CGI not available in static HTML test';
|
||||
const url =
|
||||
kCookieHelperCgi +
|
||||
((extraPath == null) ?
|
||||
'' :
|
||||
('/' + extraPath)) + '?charset=iso-8859-1';
|
||||
const response = await fetch(url, { credentials: 'include' });
|
||||
const text = await response.text();
|
||||
assert_equals(
|
||||
response.ok,
|
||||
true,
|
||||
'CGI should have succeeded in getCookieBinaryHttp\n' + text);
|
||||
assert_equals(
|
||||
response.headers.get('content-type'),
|
||||
'text/plain; charset=iso-8859-1',
|
||||
'CGI did not return ISO 8859-1 text in getCookieBinaryHttp');
|
||||
if (text === '') return undefined;
|
||||
assert_equals(
|
||||
text.indexOf('cookie='),
|
||||
0,
|
||||
'CGI response did not begin with "cookie=" and was not empty: ' + text);
|
||||
return unescape(text.replace(/^cookie=/, ''));
|
||||
}
|
||||
|
||||
// Approximate async equivalent to the document.cookie setter but from
|
||||
// the server's point of view.
|
||||
const setCookieStringHttp = async setCookie => {
|
||||
if (kIsStatic) throw 'CGI not available in static HTML test';
|
||||
const encodedSetCookie = encodeURIComponent(setCookie);
|
||||
const url = kCookieHelperCgi;
|
||||
const headers = new Headers();
|
||||
headers.set(
|
||||
'content-type',
|
||||
'application/x-www-form-urlencoded; charset=utf-8');
|
||||
const response = await fetch(
|
||||
url,
|
||||
{
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: 'set-cookie=' + encodedSetCookie,
|
||||
});
|
||||
const text = await response.text();
|
||||
assert_equals(
|
||||
response.ok,
|
||||
true,
|
||||
'CGI should have succeeded in setCookieStringHttp set-cookie: ' +
|
||||
setCookie + '\n' + text);
|
||||
assert_equals(
|
||||
response.headers.get('content-type'),
|
||||
'text/plain; charset=utf-8',
|
||||
'CGI did not return UTF-8 text in setCookieStringHttp');
|
||||
assert_equals(
|
||||
text,
|
||||
'set-cookie=' + encodedSetCookie,
|
||||
'CGI did not faithfully echo the set-cookie value');
|
||||
};
|
||||
|
||||
// Approximate async equivalent to the document.cookie setter but from
|
||||
// the server's point of view. This version sets a binary cookie rather
|
||||
// than a UTF-8 one.
|
||||
const setCookieBinaryHttp = async setCookie => {
|
||||
if (kIsStatic) throw 'CGI not available in static HTML test';
|
||||
const encodedSetCookie = escape(setCookie).split('/').join('%2F');
|
||||
const url = kCookieHelperCgi + '?charset=iso-8859-1';
|
||||
const headers = new Headers();
|
||||
headers.set(
|
||||
'content-type',
|
||||
'application/x-www-form-urlencoded; charset=iso-8859-1');
|
||||
const response = await fetch(url, {
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: 'set-cookie=' + encodedSetCookie
|
||||
});
|
||||
const text = await response.text();
|
||||
assert_equals(
|
||||
response.ok,
|
||||
true,
|
||||
'CGI should have succeeded in setCookieBinaryHttp set-cookie: ' +
|
||||
setCookie + '\n' + text);
|
||||
assert_equals(
|
||||
response.headers.get('content-type'),
|
||||
'text/plain; charset=iso-8859-1',
|
||||
'CGI did not return Latin-1 text in setCookieBinaryHttp');
|
||||
assert_equals(
|
||||
text,
|
||||
'set-cookie=' + encodedSetCookie,
|
||||
'CGI did not faithfully echo the set-cookie value');
|
||||
};
|
||||
|
||||
// Approximate async equivalent to the document.cookie setter but using
|
||||
// <meta http-equiv="set-cookie" content="..."> written into a temporary
|
||||
// IFRAME. Merely appending the node to HEAD works in some browsers (e.g.
|
||||
// Chromium) but not others (e.g. Firefox.)
|
||||
const setCookieStringMeta = async setCookie => {
|
||||
if (document.readyState !== 'complete') {
|
||||
await new Promise(resolve => addEventListener('load', resolve, true));
|
||||
}
|
||||
const meta = Object.assign(document.createElement('meta'), {
|
||||
httpEquiv: 'set-cookie',
|
||||
content: setCookie
|
||||
});
|
||||
const ifr = document.createElement('iframe');
|
||||
await new Promise(resolve => document.body.appendChild(Object.assign(
|
||||
ifr,
|
||||
{
|
||||
onload: resolve
|
||||
})));
|
||||
try {
|
||||
ifr.contentWindow.document.open('text/html; charset=utf-8');
|
||||
ifr.contentWindow.document.write([
|
||||
'<!DOCTYPE html>',
|
||||
'<meta charset="utf-8">',
|
||||
meta.outerHTML
|
||||
].join('\r\n'));
|
||||
ifr.contentWindow.document.close();
|
||||
} finally {
|
||||
if (ifr.parentNode) ifr.parentNode.removeChild(ifr);
|
||||
}
|
||||
};
|
||||
|
||||
// Async document.cookie getter; converts '' to undefined which loses
|
||||
// information in the edge case where a single ''-valued anonymous
|
||||
// cookie is visible.
|
||||
const getCookieStringDocument = async () => {
|
||||
if (!kHasDocument) throw 'document.cookie not available in this context';
|
||||
return String(document.cookie || '') || undefined;
|
||||
};
|
||||
|
||||
// Async document.cookie setter
|
||||
const setCookieStringDocument = async setCookie => {
|
||||
if (!kHasDocument) throw 'document.cookie not available in this context';
|
||||
document.cookie = setCookie;
|
||||
};
|
|
@ -6,7 +6,8 @@
|
|||
<link rel="author" title="Bert Bos" href="mailto:bert@w3.org/" />
|
||||
|
||||
<style type="text/css">
|
||||
#container {width: 20em; background: green; text-align: center}
|
||||
#container {width: 20em; background: green; text-align: center;
|
||||
line-height: 1.2em}
|
||||
|
||||
#child3 {display: inline}
|
||||
#grandchild3 {width: 20em; height: 1.2em; background: green;
|
||||
|
@ -35,13 +36,17 @@
|
|||
</div>
|
||||
|
||||
<div id="child3">
|
||||
<img id="grandchild3" src="../support/1x1-green.png" alt="green" />
|
||||
<img id="grandchild3" src="support/1x1-green.png" alt="green" />
|
||||
</div>
|
||||
|
||||
<table id="child4">
|
||||
<caption id="grandchild4">
|
||||
Block 4a
|
||||
</caption>
|
||||
<tr>
|
||||
<td>
|
||||
<div id="grandchild4">
|
||||
Block 4a
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>Block 4b</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
<link rel="match" href="overflow-applies-to-001-ref.xht" />
|
||||
<meta name="assert" content="Name: overflow [...] Applies to:
|
||||
block containers and boxes that establish a formatting context" />
|
||||
<link rel="author" title="Bert Bos" href="mailto:bert@w3.org/" />
|
||||
<link rel="author" title="Bert Bos" href="mailto:bert@w3.org" />
|
||||
|
||||
<style type="text/css">
|
||||
#container {width: 20em; background: red; text-align: center}
|
||||
#container {width: 20em; background: red; text-align: center;
|
||||
line-height: 1.2em}
|
||||
|
||||
/* The visible overflow of grandchild1 hides the red container background */
|
||||
#child1 {width: 10em; overflow: visible}
|
||||
|
@ -23,8 +24,8 @@ block containers and boxes that establish a formatting context" />
|
|||
#grandchild2 {width: 20em; border-right: solid 1em red}
|
||||
|
||||
/* Overflow (and width) don't apply to child3 and so grandchild3 is visible */
|
||||
#child3 {display: inline; width: 10em; overflow: hidden}
|
||||
#grandchild3 {width: 20em; height: 1.2em; background: green;
|
||||
#child3 {display: inline; width: 10em; overflow: hidden; background: red}
|
||||
#grandchild3 {width: 20em; height: 1.2em; background: red;
|
||||
vertical-align: bottom}
|
||||
|
||||
/* Child4 establishes a formatting context and so can clip grandchild4 */
|
||||
|
@ -53,13 +54,17 @@ block containers and boxes that establish a formatting context" />
|
|||
</div>
|
||||
|
||||
<div id="child3">
|
||||
<img id="grandchild3" src="../support/1x1-green.png" alt="green" />
|
||||
<img id="grandchild3" src="support/1x1-green.png" alt="Image download support must be enabled" />
|
||||
</div>
|
||||
|
||||
<table id="child4">
|
||||
<caption id="grandchild4">
|
||||
Block 4a
|
||||
</caption>
|
||||
<tr>
|
||||
<td>
|
||||
<div id="grandchild4">
|
||||
Block 4a
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>Block 4b</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Ensure that body propagates its scrollbars</title>
|
||||
<link rel=match href="support/overflow-propagation-001-ref.html">
|
||||
<link rel=help href="https://www.w3.org/TR/CSS21/visufx.html#overflow-clipping">
|
||||
<body style="overflow: hidden; margin: 100px; width: 100px; height: 100px; border: 1px solid green; position: absolute; top: 0; left: 0">
|
||||
The body should have visible overflow of the text that totally doesn't fit
|
||||
in the little box.
|
||||
</body>
|
|
@ -0,0 +1,14 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Ensure that body propagates its scrollbars</title>
|
||||
<link rel=match href="support/overflow-propagation-001-ref.html">
|
||||
<link rel=help href="https://www.w3.org/TR/CSS21/visufx.html#overflow-clipping">
|
||||
<script>
|
||||
onload = function() {
|
||||
document.body.remove();
|
||||
var b = document.createElement("body");
|
||||
b.style = "overflow: hidden; margin: 100px; width: 100px; height: 100px; border: 1px solid green; position: absolute; top: 0; left: 0";
|
||||
b.textContent = "The body should have visible overflow of the text that totally doesn't fit in the little box.";
|
||||
document.documentElement.appendChild(b);
|
||||
}
|
||||
</script>
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue