зеркало из https://github.com/mozilla/pjs.git
Bug 552651 - nsXMLHttpRequest leaks if aborted in state 3 ("in progress"). r=sicking
This commit is contained in:
Родитель
172780b739
Коммит
a6107b00fb
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html class="reftest-wait">
|
||||
<head>
|
||||
<title>Testcase for bug 552651</title>
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
function testCancel() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.addEventListener("readystatechange", function(e) {
|
||||
if (xhr.readyState == 3) // NOTE : only leaks for state == 3
|
||||
xhr.abort();
|
||||
}, false);
|
||||
|
||||
xhr.open("GET", "552651.xml", true);
|
||||
xhr.send();
|
||||
|
||||
setTimeout(function f() {
|
||||
document.documentElement.className = "";
|
||||
}, 1000);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="testCancel()">
|
||||
This test should not leak...
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<foo>test</foo>
|
||||
|
|
@ -61,4 +61,5 @@ load 490760-1.xhtml
|
|||
load 494810-1.html
|
||||
load 529670.html
|
||||
load 554230-1.xhtml
|
||||
load 552651.html
|
||||
load 558973.html
|
||||
|
|
|
@ -2100,9 +2100,13 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
|||
mRequestObserver->OnStopRequest(request, ctxt, status);
|
||||
}
|
||||
|
||||
// Don't do anything if we have been aborted
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED)
|
||||
// make sure to notify the listener if we were aborted
|
||||
// XXX in fact, why don't we do the cleanup below in this case??
|
||||
if (mState & XML_HTTP_REQUEST_UNINITIALIZED) {
|
||||
if (mXMLParserStreamListener)
|
||||
(void) mXMLParserStreamListener->OnStopRequest(request, ctxt, status);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIParser> parser;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче