Bug 670452. Fix WindowSnapshot's windowutils codepath to work correctly for canvases of different sizes. r=joe

This commit is contained in:
Boris Zbarsky 2011-07-12 12:06:34 -04:00
Родитель e4a0fb65db
Коммит 3b926816f1
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -36,7 +36,19 @@ function compareSnapshots(s1, s2, expected) {
var s1Str, s2Str;
var correct = false;
if (gWindowUtils) {
correct = ((gWindowUtils.compareCanvases(s1, s2, {}) == 0) == expected);
// First, check that the canvases are the same size.
var equal;
if (s1.width != s2.width || s1.height != s2.height) {
equal = false;
} else {
try {
equal = (gWindowUtils.compareCanvases(s1, s2, {}) == 0);
} catch (e) {
equal = false;
ok(false, "Exception thrown from compareCanvases: " + e);
}
}
correct = (equal == expected);
}
if (!correct) {