Bug 1600942 - Remove event telemetry for permission prompt studies. r=Ehsan

Depends on D56540

Differential Revision: https://phabricator.services.mozilla.com/D56541

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Johann Hofmann 2019-12-10 14:39:49 +00:00
parent 749da501d5
commit 841a3f40fb
6 changed files with 0 additions and 348 deletions

View File

@ -412,13 +412,6 @@ pref("permissions.fullscreen.allowed", false);
pref("permissions.postPrompt.animate", true);
// This is primarily meant to be enabled for studies.
#ifdef NIGHTLY_BUILD
pref("permissions.eventTelemetry.enabled", true);
#else
pref("permissions.eventTelemetry.enabled", false);
#endif
#ifdef NIGHTLY_BUILD
pref("permissions.delegation.enabled", true);
#else

View File

@ -1107,10 +1107,6 @@ BrowserGlue.prototype = {
os.removeObserver(this, "sync-ui-state:update");
os.removeObserver(this, "shield-init-complete");
Services.prefs.removeObserver(
"permissions.eventTelemetry.enabled",
this._togglePermissionPromptTelemetry
);
Services.prefs.removeObserver(
"privacy.trackingprotection",
this._matchCBCategory
@ -1657,24 +1653,6 @@ BrowserGlue.prototype = {
ContentBlockingCategoriesPrefs.updateCBCategory();
},
_togglePermissionPromptTelemetry() {
let enablePermissionPromptTelemetry = Services.prefs.getBoolPref(
"permissions.eventTelemetry.enabled",
false
);
Services.telemetry.setEventRecordingEnabled(
"security.ui.permissionprompt",
enablePermissionPromptTelemetry
);
if (!enablePermissionPromptTelemetry) {
// Remove the saved unique identifier to reduce the (remote) chance
// of leaking it to our servers in the future.
Services.prefs.clearUserPref("permissions.eventTelemetry.uuid");
}
},
_recordContentBlockingTelemetry() {
Services.telemetry.setEventRecordingEnabled(
"security.ui.protectionspopup",
@ -2044,14 +2022,6 @@ BrowserGlue.prototype = {
Discovery.update();
});
Services.tm.idleDispatchToMainThread(() => {
Services.prefs.addObserver(
"permissions.eventTelemetry.enabled",
this._togglePermissionPromptTelemetry
);
this._togglePermissionPromptTelemetry();
});
// Begin listening for incoming push messages.
Services.tm.idleDispatchToMainThread(() => {
try {

View File

@ -76,11 +76,6 @@ ChromeUtils.defineModuleGetter(
"PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"PermissionUITelemetry",
"resource:///modules/PermissionUITelemetry.jsm"
);
XPCOMUtils.defineLazyServiceGetter(
this,
@ -171,17 +166,6 @@ var PermissionPromptPrototype = {
return undefined;
},
/**
* A string that needs to be set to include this prompt in
* experimental event telemetry collection.
*
* This needs to conform to event telemetry string rules,
* i.e. it needs to be an alphabetic string under 20 characters.
*/
get permissionTelemetryKey() {
return undefined;
},
/**
* If true, user permissions will be read from and written to.
* When this is false, we still provide integration with
@ -463,8 +447,6 @@ var PermissionPromptPrototype = {
return;
}
this._buttonAction = null;
// Transform the PermissionPrompt actions into PopupNotification actions.
let popupNotificationActions = [];
for (let promptAction of this.promptActions) {
@ -507,16 +489,9 @@ var PermissionPromptPrototype = {
}
// Grant permission if action is ALLOW.
// Record buttonAction for telemetry.
if (promptAction.action == SitePermissions.ALLOW) {
this._buttonAction = "accept";
this.allow();
} else {
if (promptAction.scope == SitePermissions.SCOPE_PERSISTENT) {
this._buttonAction = "never";
} else {
this._buttonAction = "deny";
}
this.cancel();
}
} else if (this.permissionKey) {
@ -614,20 +589,6 @@ var PermissionPromptPrototype = {
let options = this.popupOptions;
let telemetryData = null;
if (this.request && this.permissionTelemetryKey) {
telemetryData = {
permissionTelemetryKey: this.permissionTelemetryKey,
permissionKey: this.permissionKey,
principal: this.principal,
documentDOMContentLoadedTimestamp: this.request
.documentDOMContentLoadedTimestamp,
isHandlingUserInput: this.request.isHandlingUserInput,
userHadInteractedWithDocument: this.request
.userHadInteractedWithDocument,
};
}
if (!options.hasOwnProperty("displayURI") || options.displayURI) {
options.displayURI = this.principal.URI;
}
@ -659,13 +620,6 @@ var PermissionPromptPrototype = {
// You can remove this restriction if you need it, but be
// mindful of other consumers.
if (topic == "removed" && !postPrompt) {
if (telemetryData) {
PermissionUITelemetry.onRemoved(
telemetryData,
this._buttonAction,
nextRemovalReason
);
}
if (isCancel) {
this.cancel();
}
@ -691,9 +645,6 @@ var PermissionPromptPrototype = {
secondaryActions,
options
);
if (telemetryData) {
PermissionUITelemetry.onShow(telemetryData);
}
}
},
};
@ -759,10 +710,6 @@ GeolocationPermissionPrompt.prototype = {
return "geo";
},
get permissionTelemetryKey() {
return "geo";
},
get popupOptions() {
let pref = "browser.geolocation.warning.infoURL";
let options = {
@ -925,10 +872,6 @@ DesktopNotificationPermissionPrompt.prototype = {
return "desktop-notification";
},
get permissionTelemetryKey() {
return "notifications";
},
get popupOptions() {
let learnMoreURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") + "push";

View File

@ -1,178 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["PermissionUITelemetry"];
ChromeUtils.defineModuleGetter(
this,
"Services",
"resource://gre/modules/Services.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"CryptoUtils",
"resource://services-crypto/utils.js"
);
const TELEMETRY_STAT_REMOVAL_LEAVE_PAGE = 6;
var PermissionUITelemetry = {
// Returns a hash of the host name in combination with a unique local user id.
// This allows us to track duplicate prompts on sites while not revealing the user's
// browsing history.
_uniqueHostHash(host) {
// Gets a unique user ID as salt, that needs to stay local to this profile and not be
// sent to any server!
let salt = Services.prefs.getStringPref(
"permissions.eventTelemetry.salt",
null
);
if (!salt) {
salt = Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator)
.generateUUID()
.toString();
Services.prefs.setStringPref("permissions.eventTelemetry.salt", salt);
}
let domain;
try {
domain = Services.eTLD.getBaseDomainFromHost(host);
} catch (e) {
domain = host;
}
return CryptoUtils.sha256(domain + salt);
},
_previousVisitCount(host) {
let historyService = Cc[
"@mozilla.org/browser/nav-history-service;1"
].getService(Ci.nsINavHistoryService);
let options = historyService.getNewQueryOptions();
options.resultType = options.RESULTS_AS_VISIT;
// Search for visits to this host before today
let query = historyService.getNewQuery();
query.endTimeReference = query.TIME_RELATIVE_TODAY;
query.endTime = 0;
query.domain = host;
let result = historyService.executeQuery(query, options);
result.root.containerOpen = true;
let cc = result.root.childCount;
result.root.containerOpen = false;
return cc;
},
_collectExtraKeys(prompt) {
let lastInteraction = 0;
// "storageAccessAPI" is the name of the permission that tells us whether the
// user has interacted with a particular site in the first-party context before.
let interactionPermission = Services.perms.getPermissionObject(
prompt.principal,
"storageAccessAPI",
false
);
if (interactionPermission) {
lastInteraction = interactionPermission.modificationTime;
}
let allPermsDenied = 0;
let allPermsGranted = 0;
let thisPermDenied = 0;
let thisPermGranted = 0;
let commonPermissions = [
"geo",
"desktop-notification",
"camera",
"microphone",
"screen",
];
for (let perm of Services.perms.all) {
if (!commonPermissions.includes(perm.type)) {
continue;
}
if (perm.capability == Services.perms.ALLOW_ACTION) {
allPermsGranted++;
if (perm.type == prompt.permissionKey) {
thisPermGranted++;
}
}
if (perm.capability == Services.perms.DENY_ACTION) {
allPermsDenied++;
if (perm.type == prompt.permissionKey) {
thisPermDenied++;
}
}
}
let promptHost = prompt.principal.URI.host;
return {
previousVisits: this._previousVisitCount(promptHost).toString(),
timeOnPage: (
Date.now() - prompt.documentDOMContentLoadedTimestamp
).toString(),
hasUserInput: prompt.isHandlingUserInput.toString(),
docHasUserInput: prompt.userHadInteractedWithDocument.toString(),
lastInteraction: lastInteraction.toString(),
allPermsDenied: allPermsDenied.toString(),
allPermsGranted: allPermsGranted.toString(),
thisPermDenied: thisPermDenied.toString(),
thisPermGranted: thisPermGranted.toString(),
};
},
onShow(prompt) {
let object = prompt.permissionTelemetryKey;
if (!object) {
return;
}
let extraKeys = this._collectExtraKeys(prompt);
let hostHash = this._uniqueHostHash(prompt.principal.URI.host);
Services.telemetry.recordEvent(
"security.ui.permissionprompt",
"show",
object,
hostHash,
extraKeys
);
},
onRemoved(prompt, buttonAction, telemetryReason) {
let object = prompt.permissionTelemetryKey;
if (!object) {
return;
}
let method = "other";
if (buttonAction == "accept") {
method = "accept";
} else if (buttonAction == "deny") {
method = "deny";
} else if (buttonAction == "never") {
method = "never";
} else if (telemetryReason == TELEMETRY_STAT_REMOVAL_LEAVE_PAGE) {
method = "leave";
}
let extraKeys = this._collectExtraKeys(prompt);
let hostHash = this._uniqueHostHash(prompt.principal.URI.host);
Services.telemetry.recordEvent(
"security.ui.permissionprompt",
method,
object,
hostHash,
extraKeys
);
},
};

View File

@ -79,9 +79,6 @@ with Files("OpenInTabsUtils.jsm"):
with Files("PermissionUI.jsm"):
BUG_COMPONENT = ("Firefox", "Site Permissions")
with Files("PermissionUITelemetry.jsm"):
BUG_COMPONENT = ("Firefox", "Site Permissions")
with Files("ProcessHangMonitor.jsm"):
BUG_COMPONENT = ("Core", "DOM: Content Processes")
@ -151,7 +148,6 @@ EXTRA_JS_MODULES += [
'OpenInTabsUtils.jsm',
'PageActions.jsm',
'PermissionUI.jsm',
'PermissionUITelemetry.jsm',
'PingCentre.jsm',
'ProcessHangMonitor.jsm',
'ReaderParent.jsm',

View File

@ -1778,78 +1778,6 @@ security:
extra_keys:
fileinfo: Information about the filename that was requested to be loaded
# This data collection is intended for study-only collection
# and is not meant to be enabled permanently on opt-in or opt-out.
# It is controlled by the permissions.eventTelemetry.enabled pref.
security.ui.permissionprompt:
show:
objects: [
"notifications",
"geo",
]
bug_numbers:
- 1536454
- 1578266
description: >
When a permission prompt was shown.
expiry_version: "74"
notification_emails:
- jhofmann@mozilla.com
- ehsan@mozilla.com
- seceng-telemetry@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- main
extra_keys:
previousVisits: How often the user has visited this site before today
timeOnPage: How much time the user has spent on this page so far
hasUserInput: Whether the prompt was handling user input (not including scrolling)
docHasUserInput: Whether the document has been interacted with (includes scrolling)
lastInteraction: When the site was last interacted with (includes scrolling)
allPermsDenied: How many permissions were denied by the user in total
allPermsGranted: How many permissions were granted by the user in total
thisPermDenied: How many permissions of the same kind were denied by the user in total
thisPermGranted: How many permissions of the same kind were granted by the user in total
products:
- firefox
remove:
objects: [
"notifications",
"geo",
]
methods: [
"accept",
"deny",
"never",
"leave",
"other",
]
bug_numbers:
- 1536454
- 1578266
description: >
When a permission prompt was removed, with the reasons being represented in the method field.
expiry_version: "74"
notification_emails:
- jhofmann@mozilla.com
- ehsan@mozilla.com
- seceng-telemetry@mozilla.com
release_channel_collection: opt-out
record_in_processes:
- main
extra_keys:
previousVisits: How often the user has visited this site before today
timeOnPage: How much time the user has spent on this page so far
hasUserInput: Whether the prompt was handling user input (not including scrolling)
docHasUserInput: Whether the document has been interacted with (includes scrolling)
lastInteraction: When the site was last interacted with (includes scrolling)
allPermsDenied: How many permissions were denied by the user in total
allPermsGranted: How many permissions were granted by the user in total
thisPermDenied: How many permissions of the same kind were denied by the user in total
thisPermGranted: How many permissions of the same kind were granted by the user in total
products:
- firefox
pictureinpicture:
create:
objects: ["player"]