Backed out changeset 2bc69d6f8a0c (bug 1729576) for causing crashes in browser_urlbar_telemetry_quicksuggest.js

CLOSED TREE
This commit is contained in:
Alexandru Michis 2021-09-08 23:34:10 +03:00
parent 71eae85801
commit b8ec12a7f7
3 changed files with 7 additions and 63 deletions

View File

@ -267,23 +267,11 @@ class ProviderQuickSuggest extends UrlbarProvider {
sponsoredClickUrl,
sponsoredBlockId,
} = result.payload;
let searchQuery = "";
let matchedKeywords = "";
let scenario = UrlbarPrefs.get("quickSuggestScenario");
// Only collect the search query and matched keywords for "online" scenario.
// For other scenarios, those fields are set as empty strings.
if (scenario === "online") {
matchedKeywords = qsSuggestion || details.searchString;
searchQuery = details.searchString;
}
// impression
PartnerLinkAttribution.sendContextualServicesPing(
{
scenario,
search_query: searchQuery,
matched_keywords: matchedKeywords,
search_query: details.searchString,
matched_keywords: qsSuggestion || details.searchString,
advertiser: sponsoredAdvertiser,
block_id: sponsoredBlockId,
position: telemetryResultIndex,
@ -296,7 +284,6 @@ class ProviderQuickSuggest extends UrlbarProvider {
if (isQuickSuggestLinkClicked) {
PartnerLinkAttribution.sendContextualServicesPing(
{
scenario,
advertiser: sponsoredAdvertiser,
block_id: sponsoredBlockId,
position: telemetryResultIndex,

View File

@ -447,8 +447,6 @@ QuickSuggest Impression
The Name of the advertiser.
- ``reporting_url``
The reporting URL of the QuickSuggest link, normally pointing to the ad partner's reporting endpoint.
- ``scenario``
The scenario of the QuickSuggest, could be one of "history", "offline", and "online".
QuickSuggest Click
This records a click ping when a QuickSuggest link is clicked by the user.
@ -464,8 +462,6 @@ QuickSuggest Click
The placement of the QuickSuggest link in the Urlbar (1-based).
- ``reporting_url``
The reporting URL of the QuickSuggest link, normally pointing to the ad partner's reporting endpoint.
- ``scenario``
The scenario of the QuickSuggest, could be one of "history", "offline", and "online".
Other telemetry relevant to the Address Bar

View File

@ -46,8 +46,6 @@ const TELEMETRY_EVENT_CATEGORY = "contextservices.quicksuggest";
const EXPERIMENT_PREF = "browser.urlbar.quicksuggest.enabled";
const SUGGEST_PREF = "suggest.quicksuggest";
const DEFAULT_SCENARIO = UrlbarPrefs.get("quickSuggestScenario");
// Spy for the custom impression/click sender
let spy;
@ -112,35 +110,6 @@ add_task(async function impression() {
await PlacesUtils.history.clear();
});
// Tests the impression scalar and the custom impression ping for "online" scenario.
add_task(async function impression_online() {
await UrlbarTestUtils.withExperiment({
valueOverrides: {
quickSuggestScenario: "online",
quickSuggestEnabled: true,
quickSuggestShouldShowOnboardingDialog: false,
},
callback: async () => {
spy.resetHistory();
await BrowserTestUtils.withNewTab("about:blank", async () => {
await UrlbarTestUtils.promiseAutocompleteResultPopup({
window,
value: TEST_SEARCH_STRING,
fireInputEvent: true,
});
let index = 1;
await assertIsQuickSuggest(index);
await UrlbarTestUtils.promisePopupClose(window, () => {
EventUtils.synthesizeKey("KEY_Enter");
});
assertScalars({ [TELEMETRY_SCALARS.IMPRESSION]: index + 1 });
assertCustomImpression(index, "online");
});
await PlacesUtils.history.clear();
},
});
});
// Makes sure the impression scalar and the custom impression are not incremented
// when the urlbar engagement is abandoned.
add_task(async function noImpression_abandonment() {
@ -547,17 +516,11 @@ async function assertNoQuickSuggestResults() {
*
* @param {number} [index]
* The expected index of the Quick Suggest result.
* @param {string} [scenario]
* The scenario of the Quick Suggest, should be one of "offline", "history", "online".
*/
function assertCustomImpression(index, scenario = DEFAULT_SCENARIO) {
function assertCustomImpression(index) {
Assert.ok(spy.calledOnce, "Should send a custom impression ping");
// Validate the impression ping
let [payload, endpoint] = spy.firstCall.args;
let expectedSearchQuery = scenario === "online" ? TEST_SEARCH_STRING : "";
let expectedMatchedKeywords = scenario === "online" ? TEST_SEARCH_STRING : "";
let expectedScenario = scenario;
Assert.ok(
endpoint.includes(CONTEXTUAL_SERVICES_PING_TYPES.QS_IMPRESSION),
"Should set the endpoint for QuickSuggest impression"
@ -577,15 +540,14 @@ function assertCustomImpression(index, scenario = DEFAULT_SCENARIO) {
Assert.equal(payload.position, index + 1, "Should set the position");
Assert.equal(
payload.search_query,
expectedSearchQuery,
"Should set the search_query"
TEST_SEARCH_STRING,
"Should set the search_query to an empty string"
);
Assert.equal(
payload.matched_keywords,
expectedMatchedKeywords,
"Should set the matched_keywords"
TEST_SEARCH_STRING,
"Should set the matched_keywords to an empty string"
);
Assert.equal(payload.scenario, expectedScenario, "Should set the scenario");
}
/**
@ -623,7 +585,6 @@ function assertCustomClick(index) {
);
Assert.equal(payload.block_id, 1, "Should set the block_id");
Assert.equal(payload.position, index + 1, "Should set the position");
Assert.equal(payload.scenario, DEFAULT_SCENARIO, "Should set the scenario");
}
/**