зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1426688 - Wait for pending paint updates after opening the toolbox. r=jdescottes
MozReview-Commit-ID: 34Z9dPwUnwI --HG-- extra : rebase_source : fb220a3cfbb48c1aeb5ad1d0d8ae4749c5afc3ce
This commit is contained in:
Родитель
159d0ad651
Коммит
f4cd2c0067
|
@ -480,12 +480,40 @@ async _consoleOpenWithCachedMessagesTest() {
|
|||
return Promise.resolve();
|
||||
},
|
||||
|
||||
/**
|
||||
* Wait for any pending paint.
|
||||
* The tool may have touched the DOM elements at the very end of the current test.
|
||||
* We should ensure waiting for the reflow related to these changes.
|
||||
*/
|
||||
async waitForPendingPaints(toolbox) {
|
||||
let panel = toolbox.getCurrentPanel();
|
||||
// All panels have its own way of exposing their window object...
|
||||
let window = panel.panelWin || panel._frameWindow || panel.panelWindow;
|
||||
|
||||
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
window.performance.mark("pending paints.start");
|
||||
while (utils.isMozAfterPaintPending) {
|
||||
await new Promise(done => {
|
||||
window.addEventListener("MozAfterPaint", function listener() {
|
||||
window.performance.mark("pending paint");
|
||||
done();
|
||||
}, { once: true });
|
||||
});
|
||||
}
|
||||
window.performance.measure("pending paints", "pending paints.start");
|
||||
},
|
||||
|
||||
async openToolboxAndLog(name, tool, onLoad) {
|
||||
dump("Open toolbox on '" + name + "'\n");
|
||||
let test = this.runTest(name + ".open.DAMP");
|
||||
let toolbox = await this.openToolbox(tool, onLoad);
|
||||
test.done();
|
||||
|
||||
test = this.runTest(name + ".open.settle.DAMP");
|
||||
await this.waitForPendingPaints(toolbox);
|
||||
test.done();
|
||||
|
||||
// Force freeing memory after toolbox open as it creates a lot of objects
|
||||
// and for complex documents, it introduces a GC that runs during 'reload' test.
|
||||
await garbageCollect();
|
||||
|
|
Загрузка…
Ссылка в новой задаче