Bug 1376888 - pageAction popup telemetry does not report the correct times, r?kmag
Move the call to TelemetryStopwatch.finish to after the contentReady promise of the PanelPopup resolves.
MozReview-Commit-ID: F1hfaDHVuJi
--- a/browser/components/extensions/ext-pageAction.js
+++ b/browser/components/extensions/ext-pageAction.js
@@ -227,30 +227,31 @@ this.pageAction = class extends Extensio
}
}
// Handles a click event on the page action button for the given
// window.
// If the page action has a |popup| property, a panel is opened to
// that URL. Otherwise, a "click" event is emitted, and dispatched to
// the any click listeners in the add-on.
- handleClick(window) {
+ async handleClick(window) {
TelemetryStopwatch.start(popupOpenTimingHistogram, this);
let tab = window.gBrowser.selectedTab;
let popupURL = this.tabContext.get(tab).popup;
this.tabManager.addActiveTabPermission(tab);
// If the widget has a popup URL defined, we open a popup, but do not
// dispatch a click event to the extension.
// If it has no popup URL defined, we dispatch a click event, but do not
// open a popup.
if (popupURL) {
- new PanelPopup(this.extension, this.getButton(window), popupURL,
- this.browserStyle);
+ let popup = new PanelPopup(this.extension, this.getButton(window),
+ popupURL, this.browserStyle);
+ await popup.contentReady;
TelemetryStopwatch.finish(popupOpenTimingHistogram, this);
} else {
TelemetryStopwatch.cancel(popupOpenTimingHistogram, this);
this.emit("click", tab);
}
}
handleLocationChange(eventType, tab, fromBrowse) {