mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 527623: Fix more intermittant problems by making the test code deal with necko re-ordering requests. r=jst
This commit is contained in:
parent
b2f1a27021
commit
2e3de03e1d
@ -1,3 +1,21 @@
|
|||||||
|
// 'timer' is global to avoid getting GCed which would cancel the timer
|
||||||
|
var timer;
|
||||||
|
const nsITimer = Components.interfaces.nsITimer;
|
||||||
|
|
||||||
|
function attemptUnblock(s) {
|
||||||
|
try {
|
||||||
|
let blockedResponse = null;
|
||||||
|
getObjectState("bug503481_" + s, function(x) {blockedResponse = x.wrappedJSObject.r});
|
||||||
|
blockedResponse.finish();
|
||||||
|
setObjectState("bug503481_" + s, null);
|
||||||
|
} catch(e) {
|
||||||
|
dump("unable to unblock " + s + "retrying in half a second\n");
|
||||||
|
timer = Components.classes["@mozilla.org/timer;1"]
|
||||||
|
.createInstance(nsITimer);
|
||||||
|
timer.initWithCallback(function () { attemptUnblock(s) }, 500, nsITimer.TYPE_ONE_SHOT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function handleRequest(request, response)
|
function handleRequest(request, response)
|
||||||
{
|
{
|
||||||
var query = {};
|
var query = {};
|
||||||
@ -6,17 +24,10 @@ function handleRequest(request, response)
|
|||||||
query[name] = unescape(value);
|
query[name] = unescape(value);
|
||||||
});
|
});
|
||||||
|
|
||||||
// dump("processing:" + request.queryString + "\n");
|
dump("processing:" + request.queryString + "\n");
|
||||||
|
|
||||||
if (query.unblock) {
|
if (query.unblock) {
|
||||||
let blockedResponse = null;
|
attemptUnblock(query.unblock);
|
||||||
try {
|
|
||||||
getObjectState("bug503481_" + query.unblock, function(x) {blockedResponse = x.wrappedJSObject.r});
|
|
||||||
} catch(e) {
|
|
||||||
throw "unable to unblock '" + query.unblock + "': " + e.message;
|
|
||||||
}
|
|
||||||
setObjectState("bug503481_" + query.unblock, null);
|
|
||||||
blockedResponse.finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.blockOn) {
|
if (query.blockOn) {
|
||||||
|
Loading…
Reference in New Issue
Block a user