mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 14:55:47 +00:00
Bug 627015 - Add a crashtest for an image that takes a very long time to download the next frame, giving our animation timer a chance to fire. r=jrmuizel
This commit is contained in:
parent
c33a3e4697
commit
2dab1263e5
@ -22,3 +22,7 @@ load 256-height.ico
|
||||
# GIFs with LZW data that isn't terminated properly.
|
||||
load invalid-lzw-end1.gif
|
||||
load invalid-lzw-end2.gif
|
||||
|
||||
# A 3-frame animated GIF with an inordinate delay between the second and third
|
||||
# frame.
|
||||
HTTP load delayedframe.sjs
|
||||
|
42
modules/libpr0n/test/crashtests/delayedframe.sjs
Normal file
42
modules/libpr0n/test/crashtests/delayedframe.sjs
Normal file
@ -0,0 +1,42 @@
|
||||
function getFileStream(filename)
|
||||
{
|
||||
// Get the location of this sjs file, and then use that to figure out where
|
||||
// to find where our other files are.
|
||||
var self = Components.classes["@mozilla.org/file/local;1"]
|
||||
.createInstance(Components.interfaces.nsILocalFile);
|
||||
self.initWithPath(getState("__LOCATION__"));
|
||||
var file = self.parent;
|
||||
file.append(filename);
|
||||
dump(file.path + "\n");
|
||||
|
||||
var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1']
|
||||
.createInstance(Components.interfaces.nsIFileInputStream);
|
||||
fileStream.init(file, 1, 0, false);
|
||||
|
||||
return fileStream;
|
||||
}
|
||||
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
response.processAsync();
|
||||
response.setStatusLine(request.httpVersion, 200, "OK");
|
||||
response.setHeader("Content-Type", "image/gif", false);
|
||||
|
||||
var firststream = getFileStream("threeframes-start.gif");
|
||||
response.bodyOutputStream.writeFrom(firststream, firststream.available())
|
||||
firststream.close();
|
||||
|
||||
var timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
|
||||
timer.initWithCallback(function()
|
||||
{
|
||||
var secondstream = getFileStream("threeframes-end.gif");
|
||||
response.bodyOutputStream.writeFrom(secondstream, secondstream.available())
|
||||
secondstream.close();
|
||||
response.finish();
|
||||
|
||||
// This time needs to be longer than the animation timer in
|
||||
// threeframes-start.gif. That's specified as 100ms; just use 5 seconds as
|
||||
// a reasonable upper bound. Since this is just a crashtest, timeouts
|
||||
// aren't a big deal.
|
||||
}, 5 * 1000 /* milliseconds */, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
|
||||
}
|
BIN
modules/libpr0n/test/crashtests/threeframes-end.gif
Normal file
BIN
modules/libpr0n/test/crashtests/threeframes-end.gif
Normal file
Binary file not shown.
BIN
modules/libpr0n/test/crashtests/threeframes-start.gif
Normal file
BIN
modules/libpr0n/test/crashtests/threeframes-start.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 B |
Loading…
Reference in New Issue
Block a user