mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 1372518 - the identity block shouldn't flicker when loading a secure internal page in a new window, r=johannh.
This commit is contained in:
parent
aa1bc47d4a
commit
a3bc704783
@ -1364,8 +1364,11 @@ var gBrowserInit = {
|
||||
|
||||
gRemoteControl.updateVisualCue(Marionette.running);
|
||||
|
||||
let uriToLoad = this._getUriToLoad();
|
||||
gIdentityHandler.initIdentityBlock(uriToLoad);
|
||||
|
||||
// Wait until chrome is painted before executing code not critical to making the window visible
|
||||
this._boundDelayedStartup = this._delayedStartup.bind(this);
|
||||
this._boundDelayedStartup = this._delayedStartup.bind(this, uriToLoad);
|
||||
window.addEventListener("MozAfterPaint", this._boundDelayedStartup);
|
||||
|
||||
this._loadHandled = true;
|
||||
@ -1376,7 +1379,7 @@ var gBrowserInit = {
|
||||
this._boundDelayedStartup = null;
|
||||
},
|
||||
|
||||
_delayedStartup() {
|
||||
_delayedStartup(uriToLoad) {
|
||||
let tmp = {};
|
||||
Cu.import("resource://gre/modules/TelemetryTimestamps.jsm", tmp);
|
||||
let TelemetryTimestamps = tmp.TelemetryTimestamps;
|
||||
@ -1422,7 +1425,6 @@ var gBrowserInit = {
|
||||
// e.g., start/home page, command line / startup uris to load, sessionstore
|
||||
gAboutNewTabService.QueryInterface(Ci.nsISupports);
|
||||
|
||||
let uriToLoad = this._getUriToLoad();
|
||||
if (uriToLoad && uriToLoad != "about:blank") {
|
||||
if (uriToLoad instanceof Ci.nsIArray) {
|
||||
let count = uriToLoad.length;
|
||||
@ -7013,6 +7015,12 @@ var gIdentityHandler = {
|
||||
*/
|
||||
_popupTriggeredByKeyboard: false,
|
||||
|
||||
/**
|
||||
* RegExp used to decide if an about url should be shown as being part of
|
||||
* the browser UI.
|
||||
*/
|
||||
_secureInternalUIWhitelist: /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|searchreset|sessionrestore|support|welcomeback)(?:[?#]|$)/i,
|
||||
|
||||
get _isBroken() {
|
||||
return this._state & Ci.nsIWebProgressListener.STATE_IS_BROKEN;
|
||||
},
|
||||
@ -7641,6 +7649,14 @@ var gIdentityHandler = {
|
||||
},
|
||||
|
||||
setURI(uri) {
|
||||
// Ignore about:blank loads until the window's initial URL has loaded,
|
||||
// to avoid hiding the UI that initIdentityBlock could have prepared.
|
||||
if (this._ignoreAboutBlankUntilFirstLoad) {
|
||||
if (uri.spec == "about:blank")
|
||||
return;
|
||||
this._ignoreAboutBlankUntilFirstLoad = false;
|
||||
}
|
||||
|
||||
this._uri = uri;
|
||||
|
||||
try {
|
||||
@ -7650,8 +7666,8 @@ var gIdentityHandler = {
|
||||
this._uriHasHost = false;
|
||||
}
|
||||
|
||||
let whitelist = /^(?:accounts|addons|cache|config|crashes|customizing|downloads|healthreport|home|license|newaddon|permissions|preferences|privatebrowsing|rights|searchreset|sessionrestore|support|welcomeback)(?:[?#]|$)/i;
|
||||
this._isSecureInternalUI = uri.schemeIs("about") && whitelist.test(uri.pathQueryRef);
|
||||
this._isSecureInternalUI = uri.schemeIs("about") &&
|
||||
this._secureInternalUIWhitelist.test(uri.pathQueryRef);
|
||||
|
||||
this._isExtensionPage = uri.schemeIs("moz-extension");
|
||||
|
||||
@ -7674,6 +7690,25 @@ var gIdentityHandler = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Used to initialize the identity block before first paint to avoid
|
||||
* flickering when opening a new window showing a secure internal page
|
||||
* (eg. about:home)
|
||||
*/
|
||||
initIdentityBlock(initialURI) {
|
||||
if ((typeof initialURI != "string") || !initialURI.startsWith("about:"))
|
||||
return;
|
||||
|
||||
let uri = Services.io.newURI(initialURI);
|
||||
if (this._secureInternalUIWhitelist.test(uri.pathQueryRef)) {
|
||||
this._isSecureInternalUI = true;
|
||||
this._ignoreAboutBlankUntilFirstLoad = true;
|
||||
this.refreshIdentityBlock();
|
||||
// The identity label won't be visible without setting this.
|
||||
gURLBar.setAttribute("pageproxystate", "valid");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Click handler for the identity-box element in primary chrome.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user