Bug 1439875: Update browser_windowopen_flicker.js. r=florian

To avoid hacking around the empty window, and handle the activation issue seen
on Windows / OSX.

MozReview-Commit-ID: oK3T8FKd5n
This commit is contained in:
Emilio Cobos Álvarez 2018-03-13 09:18:58 +01:00
Родитель 497f6918b3
Коммит fb9873799a
2 изменённых файлов: 18 добавлений и 10 удалений

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

@ -22,16 +22,16 @@ add_task(async function() {
let frame = frames[i], previousFrame = frames[i - 1];
let rects = compareFrames(frame, previousFrame);
// The first screenshot we get shows an unfocused browser window for some
// reason. This is likely due to the test harness, so we want to ignore it.
// The first screenshot we get in OSX / Windows shows an unfocused browser
// window for some reason. See bug 1445161.
//
// We'll assume the changes we are seeing are due to this focus change if
// there are at least 5 areas that changed near the top of the screen, but
// will only ignore this once (hence the alreadyFocused variable).
if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) {
alreadyFocused = true;
// This is likely an issue caused by the test harness, but log it anyway.
todo(false,
"the window should be focused at first paint, " + rects.toSource());
"bug 1445161 - the window should be focused at first paint, " + rects.toSource());
continue;
}

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

@ -71,17 +71,25 @@ add_task(async function() {
win.removeEventListener("MozAfterPaint", afterPaintListener);
let unexpectedRects = 0;
let ignoreTinyPaint = true;
let alreadyFocused = false;
for (let i = 1; i < frames.length; ++i) {
let frame = frames[i], previousFrame = frames[i - 1];
if (ignoreTinyPaint &&
previousFrame.width == 1 && previousFrame.height == 1) {
todo(false, "shouldn't initially paint a 1x1px window");
let rects = compareFrames(frame, previousFrame);
// The first screenshot we get in OSX / Windows shows an unfocused browser
// window for some reason. See bug 1445161.
//
// We'll assume the changes we are seeing are due to this focus change if
// there are at least 5 areas that changed near the top of the screen, but
// will only ignore this once (hence the alreadyFocused variable).
if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) {
alreadyFocused = true;
todo(false,
"bug 1445161 - the window should be focused at first paint, " + rects.toSource());
continue;
}
ignoreTinyPaint = false;
let rects = compareFrames(frame, previousFrame).filter(rect => {
rects = rects.filter(rect => {
let inRange = (val, min, max) => min <= val && val <= max;
let width = frame.width;