Skip to content

Commit

Permalink
minor fixes, changed helper files, whitespace, no double readyState 1…
Browse files Browse the repository at this point in the history
… events
  • Loading branch information
Hallvord Reiar M. Steen committed May 21, 2013
1 parent 74c4c6e commit b65bc5a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 35 deletions.
2 changes: 1 addition & 1 deletion XMLHttpRequest/abort-event-order.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" data-tested-assertations="following-sibling::ol/li[4]/ol/li[5]" />
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" data-tested-assertations="following-sibling::ol/li[4]/ol/li[5] following-sibling::ol/li[4]/ol/li[6] following-sibling::ol/li[4]/ol/li[7]/ol/li[3] following-sibling::ol/li[4]/ol/li[7]/ol/li[4]" />
<script src="/resources/testharness.js"></script>
<title>XMLHttpRequest: The abort() method: abort and loadend events</title>
</head>
Expand Down
23 changes: 9 additions & 14 deletions XMLHttpRequest/abort-upload-event-abort.htm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" />
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" data-tested-assertations="following-sibling::ol/li[4]/ol/li[7]/ol/li[3]" />
<script src="/resources/testharness.js"></script>
<title>XMLHttpRequest L2: The abort() method: Fire a progress event named abort on the XMLHttpRequestUpload object</title>
<title>XMLHttpRequest: The abort() method: Fire a progress event named abort on the XMLHttpRequestUpload object</title>
</head>

<body>
Expand All @@ -12,38 +12,33 @@
<script type="text/javascript">
var test = async_test();

test.step(function()
test.step(function()
{
var xhr = new XMLHttpRequest();
var initialized = false;

xhr.onreadystatechange = function()
{
test.step(function()
test.step(function()
{
if (xhr.readyState == 1)
if (xhr.readyState == 1)
{
if (initialized)
{
xhr.abort();
}
initialized = true;
xhr.abort();
}
});
};

xhr.upload.onabort = function(e)
xhr.upload.onabort = function(e)
{
test.step(function()
{
assert_true(e instanceof ProgressEvent);
assert_equals(e.type, "abort");
assert_equals(e.target, xhr.upload);
test.done();
test.done();
});
};

xhr.open("POST", "./support/echo.php", true);
xhr.open("POST", "./resources/content.php", true);
xhr.send("Test Message");
});
</script>
Expand Down
23 changes: 9 additions & 14 deletions XMLHttpRequest/abort-upload-event-loadend.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<head>
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" />
<link rel="help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-abort()-method" data-tested-assertations="following-sibling::ol/li[4]/ol/li[7]/ol/li[4]" />
<script src="/resources/testharness.js"></script>
<title>XMLHttpRequest L2: The abort() method: Fire a progress event named loadend on the XMLHttpRequestUpload object</title>
</head>
Expand All @@ -12,38 +12,33 @@
<script type="text/javascript">
var test = async_test();

test.step(function()
test.step(function()
{
var xhr = new XMLHttpRequest();
var initialized = false;

xhr.onreadystatechange = function()
{
test.step(function ()
test.step(function ()
{
if (xhr.readyState == 1)
if (xhr.readyState == 1)
{
if (initialized)
{
xhr.abort();
}
initialized = true;
xhr.abort();
}
});
};

xhr.upload.onloadend = function(e)
xhr.upload.onloadend = function(e)
{
test.step(function()
test.step(function()
{
assert_true(e instanceof ProgressEvent);
assert_equals(e.type, "loadend");
assert_equals(e.target, xhr.upload);
test.done();
test.done();
});
};

xhr.open("POST", "./support/echo.php", true);
xhr.open("POST", "./resources/content.php", true);
xhr.send("Test Message");
});
</script>
Expand Down
12 changes: 6 additions & 6 deletions XMLHttpRequest/response-data-arraybuffer.htm
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<link rel="Help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-response-attribute" />
<link rel="Help" href="http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#the-response-attribute" data-tested-assertations="following::a[contains(@href,'#arraybuffer-response-entity-body')]/.." />
<script src="/resources/testharness.js"></script>
<title>XMLHttpRequest L2: The response attribute: ArrayBuffer data</title>
<title>XMLHttpRequest: The response attribute: ArrayBuffer data</title>
</head>

<body>
Expand All @@ -16,11 +16,11 @@
{
var xhr = new XMLHttpRequest();

xhr.onreadystatechange = function()
xhr.onreadystatechange = function()
{
if (xhr.readyState == 4)
if (xhr.readyState == 4)
{
test.step(function()
test.step(function()
{
assert_equals(xhr.status, 200);

Expand All @@ -40,7 +40,7 @@
}
};

xhr.open("GET", "./support/echo.php?content=Hello", true);
xhr.open("GET", "./resources/content.php?content=Hello", true);
xhr.responseType = "arraybuffer";
xhr.send();
});
Expand Down

0 comments on commit b65bc5a

Please sign in to comment.