Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two buggy tests, two helper files #101

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion XMLHttpRequest/resources/conditional.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
}
if((!empty($match) && $match == $tag) ||
(!empty($modified) && $modified == $date)) {
header("HTTP/1.1 304 SUPERCOOL");
//header("HTTP/1.1 304 SUPERCOOL");
header("SUPERCOOL", true, 304); // try to make w3c-test.org play along..
exit;
}
header("Content-Type:text/plain");
Expand Down
3 changes: 2 additions & 1 deletion XMLHttpRequest/resources/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ function stripslashes_recursive($var) {
$text = $_GET["text"] ? $_GET["text"] : "OMG";
$content = $_GET["content"] ? $_GET["content"] : "";
$type = $_GET["type"] ? $_GET["type"] : "";
header("HTTP/1.1 " . $code . " " . $text);
header("HTTP/1.1 " . $code . " " . $text, true, $code);
header($text, true, $code); // workaround to try to get it running on w3c-test.org
header("Content-Type:" . $type);
echo $content;
exit;
Expand Down
2 changes: 1 addition & 1 deletion XMLHttpRequest/send-entity-body-none.htm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
var client = new XMLHttpRequest()
client.open("POST", "resources/content.php", false)
client.send(null)
assert_equals(client.getResponseHeader("x-request-content-length"), "NO")
assert_equals(client.getResponseHeader("x-request-content-length"), "0")
assert_equals(client.getResponseHeader("x-request-content-type"), "NO")
})
</script>
Expand Down
26 changes: 13 additions & 13 deletions XMLHttpRequest/setrequestheader-bogus-header.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
<div id="log"></div>
<script>
function try_header(header) {
assert_throws("INVALID_STATE_ERR", function() { client.setRequestHeader(header, "test") })
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "...")
assert_throws("SYNTAX_ERR", function() { client.setRequestHeader(header, "test") })
})
}
test(function() {
var client = new XMLHttpRequest()
client.open("GET", "...")
try_header("")
try_header("t<")
try_header("t:t")
try_header("t t")
try_header(" t")
try_header("\tt")
try_header("t\rt")
try_header("t\nt")
})
try_header("")
try_header("t<")
try_header("t:t")
try_header("t t")
try_header(" t")
try_header("\tt")
try_header("t\rt")
try_header("t\nt")
</script>
</body>
</html>
12 changes: 12 additions & 0 deletions XMLHttpRequest/tests/submissions/Opera/resources/upload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php
ksort($_POST);
ksort($_FILES);
if (!empty($_POST))
foreach ($_POST as $k => $v)
echo "{$k}={$v},";
echo "\n";
if (!empty($_FILES))
foreach ($_FILES as $k => $v)
echo "{$k}={$v['name']}:{$v['type']}:{$v['size']},";

?>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var originalBody = document.body;
test(function() {
assert_throws(new TypeError(), function() {
document.body = "text"
Expand All @@ -24,4 +25,7 @@
doc.body = document.createElement("body")
})
}, "Should throw a HierarchyRequestError when trying to set document.body when there's no root element.")
test(function(){
assert_true(originalBody === document.body);
}, "document.body has not changed")
</script>