Skip to content

Commit

Permalink
removing isInitialized workaround for the double readystatechange eve…
Browse files Browse the repository at this point in the history
…nt that should no longer be sent per spec
  • Loading branch information
Hallvord Reiar M. Steen committed May 21, 2013
1 parent 116d43a commit 319668b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 27 deletions.
25 changes: 10 additions & 15 deletions XMLHttpRequest/abort-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[5]" />
<script src="/resources/testharness.js"></script>
<title>XMLHttpRequest L2: The abort() method: Fire a progress event named abort</title>
<title>XMLHttpRequest: The abort() method: Fire a progress event named abort</title>
</head>

<body>
Expand All @@ -15,34 +15,29 @@
test.step(function()
{
var xhr = new XMLHttpRequest();
var initialized = false;

xhr.onreadystatechange = function()
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.onabort = function(e)
xhr.onabort = function(e)
{
test.step(function()
test.step(function()
{
assert_true(e instanceof ProgressEvent);
assert_equals(e.type, "abort");
test.done();
test.done();
});
};

xhr.open("GET", "./support/echo.php", true);
xhr.open("GET", "./resources/content.php", true);
xhr.send();
});
</script>
Expand Down
19 changes: 7 additions & 12 deletions XMLHttpRequest/abort-event-loadend.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[6]"/>
<script src="/resources/testharness.js"></script>
<title>XMLHttpRequest L2: The abort() method: Fire a progress event named loadend</title>
<title>XMLHttpRequest: The abort() method: Fire a progress event named loadend</title>
</head>

<body>
Expand All @@ -15,34 +15,29 @@
test.step(function()
{
var xhr = new XMLHttpRequest();
var initialized = false;

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

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

xhr.open("GET", "./support/echo.php", true);
xhr.open("GET", "./resources/content.php", true);
xhr.send();
});
</script>
Expand Down

0 comments on commit 319668b

Please sign in to comment.