mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 715402 - Wait for chrome MozAfterPaint before executing any code not critical to making the initial window visible.
r=gavin
This commit is contained in:
parent
a1a7e85f92
commit
c0c8d98a47
@ -86,7 +86,8 @@ var gLastValidURLStr = "";
|
||||
var gInPrintPreviewMode = false;
|
||||
var gDownloadMgr = null;
|
||||
var gContextMenu = null; // nsContextMenu instance
|
||||
var gDelayedStartupTimeoutId;
|
||||
var gDelayedStartupTimeoutId; // used for non-browser-windows
|
||||
var gFirstPaintListener = null;
|
||||
var gStartupRan = false;
|
||||
|
||||
#ifndef XP_MACOSX
|
||||
@ -1376,7 +1377,18 @@ function BrowserStartup() {
|
||||
|
||||
retrieveToolbarIconsizesFromTheme();
|
||||
|
||||
gDelayedStartupTimeoutId = setTimeout(delayedStartup, 0, isLoadingBlank, mustLoadSidebar);
|
||||
// Listen for the first paint event for this window, and only do non-critical
|
||||
// work then, so that things like session restore don't block the window from
|
||||
// being visible.
|
||||
gFirstPaintListener = function(e) {
|
||||
if (e.target == window) {
|
||||
window.removeEventListener("MozAfterPaint", gFirstPaintListener, false);
|
||||
gFirstPaintListener = null;
|
||||
delayedStartup(isLoadingBlank, mustLoadSidebar);
|
||||
}
|
||||
};
|
||||
window.addEventListener("MozAfterPaint", gFirstPaintListener, false);
|
||||
|
||||
gStartupRan = true;
|
||||
}
|
||||
|
||||
@ -1505,7 +1517,6 @@ function prepareForStartup() {
|
||||
function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
||||
Cu.import("resource:///modules/TelemetryTimestamps.jsm");
|
||||
TelemetryTimestamps.add("delayedStartupStarted");
|
||||
gDelayedStartupTimeoutId = null;
|
||||
|
||||
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
|
||||
Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled", false);
|
||||
@ -1820,8 +1831,9 @@ function BrowserShutdown() {
|
||||
|
||||
// Now either cancel delayedStartup, or clean up the services initialized from
|
||||
// it.
|
||||
if (gDelayedStartupTimeoutId) {
|
||||
clearTimeout(gDelayedStartupTimeoutId);
|
||||
if (gFirstPaintListener) {
|
||||
window.removeEventListener("MozAfterPaint", gFirstPaintListener, false);
|
||||
gFirstPaintListener = null;
|
||||
} else {
|
||||
if (Win7Features)
|
||||
Win7Features.onCloseWindow();
|
||||
|
Loading…
Reference in New Issue
Block a user