mirror of
https://github.com/servo/servo.git
synced 2025-10-03 18:19:14 +01:00
44 lines
1.5 KiB
HTML
44 lines
1.5 KiB
HTML
<!DOCTYPE html>
|
|
|
|
<link rel="author" href="mtrzos@google.com" title="Maciek Trzos">
|
|
<script src=/resources/testharness.js></script>
|
|
<script src=/resources/testharnessreport.js></script>
|
|
<script src=/fetch/sec-metadata/resources/helper.js></script>
|
|
<script>
|
|
|
|
// TESTS //
|
|
if (window.Worker) {
|
|
|
|
// Same-Origin test
|
|
var sharedWorker = new SharedWorker('/fetch/sec-metadata/resources/record-header.py?file=sharedworker-same-origin');
|
|
sharedWorker.port.start();
|
|
|
|
sharedWorker.onerror = function(){
|
|
test_same_origin();
|
|
}
|
|
sharedWorker.port.onmessage = function(e) {
|
|
test_same_origin();
|
|
}
|
|
sharedWorker.port.postMessage("Ready");
|
|
}
|
|
|
|
function test_same_origin(){
|
|
var same_origin_test = async_test("Same-Origin sharedworker");
|
|
same_origin_test.step(function () {
|
|
key = "sharedworker-same-origin";
|
|
expected_same_origin = {"destination":"sharedworker", "site":"same-origin"};
|
|
|
|
// Requests from the server the saved value of the Sec-Metadata header
|
|
same_origin_xhr = new XMLHttpRequest();
|
|
same_origin_xhr.open("GET", "/fetch/sec-metadata/resources/record-header.py?retrieve=true&file=" + key);
|
|
|
|
// Async test step triggered when the response is loaded
|
|
same_origin_xhr.onreadystatechange = same_origin_test.step_func(function () {
|
|
verify_response(same_origin_xhr, same_origin_test, expected_same_origin)
|
|
});
|
|
same_origin_xhr.send();
|
|
});
|
|
}
|
|
</script>
|
|
<body></body>
|
|
|