Bug 1010784: Null out sync loop target to avoid assertions when reusing sync XHR. r=khuey

This commit is contained in:
Shian-Yow Wu 2014-05-28 22:07:02 -07:00
parent 5fdb919065
commit 7070951543
4 changed files with 48 additions and 0 deletions

View File

@ -954,6 +954,7 @@ Proxy::Teardown()
}
mWorkerPrivate = nullptr;
mSyncLoopTarget = nullptr;
mOutstandingSendCount = 0;
}
@ -1106,6 +1107,7 @@ LoadStartDetectionRunnable::Run()
mXMLHttpRequestPrivate, mChannelId);
if (runnable->Dispatch(nullptr)) {
mProxy->mWorkerPrivate = nullptr;
mProxy->mSyncLoopTarget = nullptr;
mProxy->mOutstandingSendCount--;
}
}

View File

@ -0,0 +1,9 @@
onmessage = function(event) {
var xhr = new XMLHttpRequest();
xhr.open("GET", event.data, false);
xhr.send();
xhr.open("GET", event.data, false);
xhr.send();
postMessage("done");
}

View File

@ -15,6 +15,7 @@ support-files =
errorwarning_worker.js
eventDispatch_worker.js
fibonacci_worker.js
file_bug1010784_worker.js
importScripts_worker.js
importScripts_worker_imported1.js
importScripts_worker_imported2.js
@ -74,6 +75,7 @@ support-files =
[test_blobConstructor.html]
[test_blobWorkers.html]
[test_bug949946.html]
[test_bug1010784.html]
[test_chromeWorker.html]
[test_clearTimeouts.html]
[test_close.html]

View File

@ -0,0 +1,35 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1010784
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1010784</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1010784">Mozilla Bug 1010784</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
var worker = new Worker("file_bug1010784_worker.js");
worker.onmessage = function(event) {
is(event.data, "done", "Got correct result");
SimpleTest.finish();
}
worker.postMessage("testXHR.txt");
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>