зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1589972 - Don't stop tracking search telemetry when the location change is for the same document. r=mikedeboer
Differential Revision: https://phabricator.services.mozilla.com/D49949 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
70553d3b77
Коммит
70b07bd990
|
@ -294,3 +294,38 @@ add_task(async function test_track_ad_click() {
|
|||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(async function test_track_ad_click_with_location_change_same_doc() {
|
||||
searchCounts.clear();
|
||||
Services.telemetry.clearScalars();
|
||||
const url = getSERPUrl(getPageUrl(false, true));
|
||||
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, url);
|
||||
|
||||
await assertTelemetry(
|
||||
{ "example.in-content:sap:ff": 1 },
|
||||
{
|
||||
"browser.search.with_ads": { example: 1 },
|
||||
}
|
||||
);
|
||||
|
||||
// Simulate a LOCATION_CHANGE_SAME_DOCUMENT
|
||||
await ContentTask.spawn(tab.linkedBrowser, { url }, args => {
|
||||
content.history.pushState({}, "", args.url);
|
||||
});
|
||||
|
||||
let pageLoadPromise = BrowserTestUtils.waitForLocationChange(gBrowser);
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, () => {
|
||||
content.document.getElementById("ad1").click();
|
||||
});
|
||||
await pageLoadPromise;
|
||||
|
||||
await assertTelemetry(
|
||||
{ "example.in-content:sap:ff": 1 },
|
||||
{
|
||||
"browser.search.with_ads": { example: 1 },
|
||||
"browser.search.ad_clicks": { example: 1 },
|
||||
}
|
||||
);
|
||||
|
||||
BrowserTestUtils.removeTab(tab);
|
||||
});
|
||||
|
|
|
@ -186,8 +186,10 @@ let URICountListener = {
|
|||
},
|
||||
|
||||
onLocationChange(browser, webProgress, request, uri, flags) {
|
||||
// By default, assume we no longer need to track this tab.
|
||||
SearchTelemetry.stopTrackingBrowser(browser);
|
||||
if (!(flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT)) {
|
||||
// By default, assume we no longer need to track this tab.
|
||||
SearchTelemetry.stopTrackingBrowser(browser);
|
||||
}
|
||||
|
||||
// Don't count this URI if it's an error page.
|
||||
if (flags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче