Bug 1478348 - Dont show doorhanger on about:newtab. r=johannh

MozReview-Commit-ID: EmHV3OS6Kra
This commit is contained in:
Dale Harvey
2018-08-24 16:43:22 +01:00
parent 609a3f271e
commit 02db992aaa
6 changed files with 61 additions and 12 deletions

View File

@@ -2656,8 +2656,11 @@ function BrowserPageInfo(documentURL, initialTab, imageElement, frameOuterWindow
*
* @param aURI [optional]
* nsIURI to set. If this is unspecified, the current URI will be used.
* @param updatePopupNotifications [optional]
* Passed though to SetPageProxyState, indicates whether the
* PopupNotifications need updated.
*/
function URLBarSetURI(aURI) {
function URLBarSetURI(aURI, updatePopupNotifications) {
var value = gBrowser.userTypedValue;
var valid = false;
@@ -2702,7 +2705,7 @@ function URLBarSetURI(aURI) {
gURLBar.selectionStart = gURLBar.selectionEnd = 0;
}
SetPageProxyState(valid ? "valid" : "invalid");
SetPageProxyState(valid ? "valid" : "invalid", updatePopupNotifications);
}
function losslessDecodeURI(aURI) {
@@ -2799,8 +2802,9 @@ function UpdateUrlbarSearchSplitterState() {
}
function UpdatePageProxyState() {
if (gURLBar && gURLBar.value != gLastValidURLStr)
SetPageProxyState("invalid");
if (gURLBar && gURLBar.value != gLastValidURLStr) {
SetPageProxyState("invalid", true);
}
}
/**
@@ -2813,8 +2817,12 @@ function UpdatePageProxyState() {
* related user interface elments should be shown because the URI in the
* location bar matches the loaded page. The string "invalid" indicates
* that the URI in the location bar is different than the loaded page.
* @param updatePopupNotifications
* Boolean that indicates whether we should update the PopupNotifications
* visibility due to this change, otherwise avoid doing so as it is being
* handled somewhere else.
*/
function SetPageProxyState(aState) {
function SetPageProxyState(aState, updatePopupNotifications) {
if (!gURLBar)
return;
@@ -2835,7 +2843,7 @@ function SetPageProxyState(aState) {
// After we've ensured that we've applied the listeners and updated the value
// of gLastValidURLStr, return early if the actual state hasn't changed.
if (oldPageProxyState == aState) {
if (oldPageProxyState == aState || !updatePopupNotifications) {
return;
}
@@ -4756,7 +4764,7 @@ var XULBrowserWindow = {
}
},
onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags) {
onLocationChange(aWebProgress, aRequest, aLocationURI, aFlags, aIsSimulated) {
var location = aLocationURI ? aLocationURI.spec : "";
let pageTooltip = document.getElementById("aHTMLTooltip");
@@ -4808,7 +4816,11 @@ var XULBrowserWindow = {
this.reloadCommand.removeAttribute("disabled");
}
URLBarSetURI(aLocationURI);
// We want to update the popup visibility if we received this notification
// via simulated locationchange events such as switching between tabs, however
// if this is a document navigation then PopupNotifications will be updated
// via TabsProgressListener.onLocationChange and we do not want it called twice
URLBarSetURI(aLocationURI, aIsSimulated);
BookmarkingUI.onLocationChange();