mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 20:55:39 +00:00
Bug 1368470 - Count search suggestions notification impressions only when the popup is really shown. r=past
Sometimes the platform doesn't open the autocomplete popup even if we openPopup and reach the xul popup manager. This ensures we only count real impressions. MozReview-Commit-ID: LadswltSv9V --HG-- extra : rebase_source : cb8f0848cd53788b0603430ea4db5fc2ea5d9c03
This commit is contained in:
parent
612120587c
commit
f6db8740aa
@ -1855,7 +1855,14 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
try {
|
||||
let whichNotification = aInput.whichSearchSuggestionsNotification;
|
||||
if (whichNotification != "none") {
|
||||
aInput.updateSearchSuggestionsNotificationImpressions(whichNotification);
|
||||
// Update the impressions count on real popupshown, since there's
|
||||
// no guarantee openPopup will be respected by the platform.
|
||||
// Though, we must ensure the handled event is the expected one.
|
||||
let impressionId = this._searchSuggestionsImpressionId = {};
|
||||
this.addEventListener("popupshown", () => {
|
||||
if (this._searchSuggestionsImpressionId == impressionId)
|
||||
aInput.updateSearchSuggestionsNotificationImpressions(whichNotification);
|
||||
}, {once: true});
|
||||
this._showSearchSuggestionsNotification(whichNotification, popupDirection);
|
||||
} else if (this.classList.contains("showSearchSuggestionsNotification")) {
|
||||
this._hideSearchSuggestionsNotification();
|
||||
|
Loading…
Reference in New Issue
Block a user