mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
20e677d1b8
We want to create the source fragment before trying to use it in URIUtils::ResetWithSource. The testcase triggers an assertion related to unbalanced onload blocking/unblocking, fixing that by blocking onload on the new document we're setting in OnTransformDone and unblocking onload on the old document. --HG-- extra : rebase_source : 8bbdb9ce6a38dc6b76d13dfb2c3c7d67f78ecefe
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
function getFileStream(filename)
|
|
{
|
|
let self = Components.classes["@mozilla.org/file/local;1"]
|
|
.createInstance(Components.interfaces.nsIFile);
|
|
self.initWithPath(getState("__LOCATION__"));
|
|
let file = self.parent;
|
|
file.append(filename);
|
|
let stream = Components.classes['@mozilla.org/network/file-input-stream;1']
|
|
.createInstance(Components.interfaces.nsIFileInputStream);
|
|
stream.init(file, -1, -1, false);
|
|
return stream;
|
|
}
|
|
|
|
function handleRequest(request, response)
|
|
{
|
|
response.processAsync();
|
|
response.setStatusLine(null, 200, "OK");
|
|
response.setHeader("Content-Type", "text/xml", false);
|
|
|
|
switch (request.queryString) {
|
|
case "stylesheet":
|
|
{
|
|
let timer = Components.classes["@mozilla.org/timer;1"]
|
|
.createInstance(Components.interfaces.nsITimer);
|
|
timer.initWithCallback(() => {
|
|
setState("xslt", "loaded");
|
|
response.finish();
|
|
timer.cancel();
|
|
}, 1000 /* milliseconds */, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
let stream = getFileStream("1430818.xml");
|
|
response.bodyOutputStream.writeFrom(stream,
|
|
stream.available());
|
|
stream.close();
|
|
let timer = Components.classes["@mozilla.org/timer;1"]
|
|
.createInstance(Components.interfaces.nsITimer);
|
|
timer.initWithCallback(() => {
|
|
if (getState("xslt") == "loaded") {
|
|
response.finish();
|
|
timer.cancel();
|
|
}
|
|
}, 100 /* milliseconds */, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
|
|
break;
|
|
}
|
|
}
|
|
}
|