зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1457226 - Revert Savant Shield study commits; r=rhelmer
The Savant pref flip Shield study was ended on 08-20-18 (https://bugzilla.mozilla.org/show_bug.cgi?id=1457226#c28), so this patch removes all temporary study code from Firefox. Differential Revision: https://phabricator.services.mozilla.com/D4285 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
fe373d9322
Коммит
16d89ecabc
|
@ -1738,10 +1738,6 @@ pref("app.shield.optoutstudies.enabled", true);
|
|||
pref("app.shield.optoutstudies.enabled", false);
|
||||
#endif
|
||||
|
||||
// Savant Shield study preferences
|
||||
pref("shield.savant.enabled", false);
|
||||
pref("shield.savant.loglevel", "warn");
|
||||
|
||||
// Multi-lingual preferences
|
||||
pref("intl.multilingual.enabled", false);
|
||||
|
||||
|
|
|
@ -1014,7 +1014,6 @@ window._gBrowser = {
|
|||
}
|
||||
});
|
||||
newTab.dispatchEvent(event);
|
||||
Services.telemetry.recordEvent("savant", "tab", "select", null, { subcategory: "frame" });
|
||||
|
||||
this._tabAttrModified(oldTab, ["selected"]);
|
||||
this._tabAttrModified(newTab, ["selected"]);
|
||||
|
@ -2472,7 +2471,6 @@ window._gBrowser = {
|
|||
// even if the event listener opens or closes tabs.
|
||||
let evt = new CustomEvent("TabOpen", { bubbles: true, detail: eventDetail || {} });
|
||||
t.dispatchEvent(evt);
|
||||
Services.telemetry.recordEvent("savant", "tab", "open", null, { subcategory: "frame" });
|
||||
|
||||
if (!usingPreloadedContent && originPrincipal && aURI) {
|
||||
let { URI_INHERITS_SECURITY_CONTEXT } = Ci.nsIProtocolHandler;
|
||||
|
@ -2886,7 +2884,6 @@ window._gBrowser = {
|
|||
// inspect the tab that's about to close.
|
||||
var evt = new CustomEvent("TabClose", { bubbles: true, detail: { adoptedBy: aAdoptedByTab } });
|
||||
aTab.dispatchEvent(evt);
|
||||
Services.telemetry.recordEvent("savant", "tab", "close", null, { subcategory: "frame" });
|
||||
|
||||
if (this.tabs.length == 2) {
|
||||
// We're closing one of our two open tabs, inform the other tab that its
|
||||
|
|
|
@ -429,7 +429,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
RemoteSettings: "resource://services-settings/remote-settings.js",
|
||||
SafeBrowsing: "resource://gre/modules/SafeBrowsing.jsm",
|
||||
Sanitizer: "resource:///modules/Sanitizer.jsm",
|
||||
SavantShieldStudy: "resource:///modules/SavantShieldStudy.jsm",
|
||||
SessionStartup: "resource:///modules/sessionstore/SessionStartup.jsm",
|
||||
SessionStore: "resource:///modules/sessionstore/SessionStore.jsm",
|
||||
ShellService: "resource:///modules/ShellService.jsm",
|
||||
|
@ -525,9 +524,6 @@ const listeners = {
|
|||
"RemoteLogins:autoCompleteLogins": ["LoginManagerParent"],
|
||||
"RemoteLogins:removeLogin": ["LoginManagerParent"],
|
||||
"RemoteLogins:insecureLoginFormPresent": ["LoginManagerParent"],
|
||||
// For Savant Shield study, bug 1465685. Study on desktop only.
|
||||
"LoginStats:LoginFillSuccessful": ["LoginManagerParent"],
|
||||
"LoginStats:LoginEncountered": ["LoginManagerParent"],
|
||||
// PLEASE KEEP THIS LIST IN SYNC WITH THE MOBILE LISTENERS IN BrowserCLH.js
|
||||
"WCCR:registerProtocolHandler": ["Feeds"],
|
||||
"rtcpeer:CancelRequest": ["webrtcUI"],
|
||||
|
@ -1400,8 +1396,6 @@ BrowserGlue.prototype = {
|
|||
}
|
||||
|
||||
Normandy.uninit();
|
||||
|
||||
SavantShieldStudy.uninit();
|
||||
},
|
||||
|
||||
// All initial windows have opened.
|
||||
|
@ -1558,10 +1552,6 @@ BrowserGlue.prototype = {
|
|||
Services.tm.idleDispatchToMainThread(() => {
|
||||
Blocklist.loadBlocklistAsync();
|
||||
});
|
||||
|
||||
Services.tm.idleDispatchToMainThread(() => {
|
||||
SavantShieldStudy.init();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -366,10 +366,6 @@ let urlbarListener = {
|
|||
Services.telemetry
|
||||
.getKeyedHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX_BY_TYPE")
|
||||
.add(actionType, idx);
|
||||
if (actionType === "bookmark" || actionType === "history") {
|
||||
Services.telemetry.recordEvent("savant", "follow_urlbar_link", actionType, null,
|
||||
{ subcategory: "navigation" });
|
||||
}
|
||||
} else {
|
||||
Cu.reportError("Unknown FX_URLBAR_SELECTED_RESULT_TYPE type: " +
|
||||
actionType);
|
||||
|
@ -503,9 +499,6 @@ let BrowserUsageTelemetry = {
|
|||
scalarKey, 1);
|
||||
Services.telemetry.recordEvent("navigation", "search", source, action,
|
||||
{ engine: getSearchEngineId(engine) });
|
||||
Services.telemetry.recordEvent("savant", "search", source, action,
|
||||
{ subcategory: "navigation",
|
||||
engine: getSearchEngineId(engine) });
|
||||
},
|
||||
|
||||
_handleSearchAction(engine, source, details) {
|
||||
|
|
|
@ -1,530 +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/. */
|
||||
|
||||
/* eslint semi: error */
|
||||
|
||||
"use strict";
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SavantShieldStudy"];
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AddonManager: "resource://gre/modules/AddonManager.jsm",
|
||||
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm"
|
||||
});
|
||||
|
||||
// See LOG_LEVELS in Console.jsm. Examples: "all", "info", "warn", & "error".
|
||||
const PREF_LOG_LEVEL = "shield.savant.loglevel";
|
||||
|
||||
// Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {}).ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
maxLogLevelPref: PREF_LOG_LEVEL,
|
||||
prefix: "SavantShieldStudy",
|
||||
};
|
||||
return new ConsoleAPI(consoleOptions);
|
||||
});
|
||||
|
||||
class SavantShieldStudyClass {
|
||||
constructor() {
|
||||
this.STUDY_PREF = "shield.savant.enabled";
|
||||
this.STUDY_TELEMETRY_CATEGORY = "savant";
|
||||
this.ALWAYS_PRIVATE_BROWSING_PREF = "browser.privatebrowsing.autostart";
|
||||
this.STUDY_DURATION_OVERRIDE_PREF = "shield.savant.duration_override";
|
||||
this.STUDY_EXPIRATION_DATE_PREF = "shield.savant.expiration_date";
|
||||
// ms = 'x' weeks * 7 days/week * 24 hours/day * 60 minutes/hour
|
||||
// * 60 seconds/minute * 1000 milliseconds/second
|
||||
this.DEFAULT_STUDY_DURATION_MS = 4 * 7 * 24 * 60 * 60 * 1000;
|
||||
// If on startupStudy(), user is ineligible or study has expired,
|
||||
// no probe listeners from this module have been added yet
|
||||
this.shouldRemoveListeners = true;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.telemetryEvents = new TelemetryEvents(this.STUDY_TELEMETRY_CATEGORY);
|
||||
this.addonListener = new AddonListener(this.STUDY_TELEMETRY_CATEGORY);
|
||||
this.bookmarkObserver = new BookmarkObserver(this.STUDY_TELEMETRY_CATEGORY);
|
||||
this.menuListener = new MenuListener(this.STUDY_TELEMETRY_CATEGORY);
|
||||
|
||||
// check the pref in case Normandy flipped it on before we could add the pref listener
|
||||
this.shouldCollect = Services.prefs.getBoolPref(this.STUDY_PREF);
|
||||
if (this.shouldCollect) {
|
||||
this.startupStudy();
|
||||
}
|
||||
Services.prefs.addObserver(this.STUDY_PREF, this);
|
||||
}
|
||||
|
||||
observe(subject, topic, data) {
|
||||
if (topic === "nsPref:changed" && data === this.STUDY_PREF) {
|
||||
// toggle state of the pref
|
||||
this.shouldCollect = !this.shouldCollect;
|
||||
if (this.shouldCollect) {
|
||||
this.startupStudy();
|
||||
} else {
|
||||
// The pref has been turned off
|
||||
this.endStudy("study_disable");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
startupStudy() {
|
||||
// enable before any possible calls to endStudy, since it sends an 'end_study' event
|
||||
this.telemetryEvents.enableCollection();
|
||||
|
||||
if (!this.isEligible()) {
|
||||
this.shouldRemoveListeners = false;
|
||||
this.endStudy("ineligible");
|
||||
return;
|
||||
}
|
||||
|
||||
this.initStudyDuration();
|
||||
|
||||
if (this.isStudyExpired()) {
|
||||
log.debug("Study expired in between this and the previous session.");
|
||||
this.shouldRemoveListeners = false;
|
||||
this.endStudy("expired");
|
||||
}
|
||||
|
||||
this.addonListener.init();
|
||||
this.bookmarkObserver.init();
|
||||
this.menuListener.init();
|
||||
}
|
||||
|
||||
isEligible() {
|
||||
const isAlwaysPrivateBrowsing = Services.prefs.getBoolPref(this.ALWAYS_PRIVATE_BROWSING_PREF);
|
||||
if (isAlwaysPrivateBrowsing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
initStudyDuration() {
|
||||
if (Services.prefs.getStringPref(this.STUDY_EXPIRATION_DATE_PREF, "")) {
|
||||
return;
|
||||
}
|
||||
Services.prefs.setStringPref(
|
||||
this.STUDY_EXPIRATION_DATE_PREF,
|
||||
this.getExpirationDateString()
|
||||
);
|
||||
}
|
||||
|
||||
getDurationFromPref() {
|
||||
return Services.prefs.getIntPref(this.STUDY_DURATION_OVERRIDE_PREF, 0);
|
||||
}
|
||||
|
||||
getExpirationDateString() {
|
||||
const now = Date.now();
|
||||
const studyDurationInMs =
|
||||
this.getDurationFromPref()
|
||||
|| this.DEFAULT_STUDY_DURATION_MS;
|
||||
const expirationDateInt = now + studyDurationInMs;
|
||||
return new Date(expirationDateInt).toISOString();
|
||||
}
|
||||
|
||||
isStudyExpired() {
|
||||
const expirationDateInt =
|
||||
Date.parse(Services.prefs.getStringPref(
|
||||
this.STUDY_EXPIRATION_DATE_PREF,
|
||||
this.getExpirationDateString()
|
||||
));
|
||||
|
||||
if (isNaN(expirationDateInt)) {
|
||||
log.error(
|
||||
`The value for the preference ${this.STUDY_EXPIRATION_DATE_PREF} is invalid.`
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Date.now() > expirationDateInt) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
endStudy(reason) {
|
||||
log.debug(`Ending the study due to reason: ${ reason }`);
|
||||
const isStudyEnding = true;
|
||||
Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, "end_study", reason, null,
|
||||
{ subcategory: "shield" });
|
||||
this.telemetryEvents.disableCollection();
|
||||
this.uninit(isStudyEnding);
|
||||
// These prefs needs to persist between restarts, so only reset on endStudy
|
||||
Services.prefs.clearUserPref(this.STUDY_PREF);
|
||||
Services.prefs.clearUserPref(this.STUDY_EXPIRATION_DATE_PREF);
|
||||
}
|
||||
|
||||
// Called on every Firefox shutdown and endStudy
|
||||
uninit(isStudyEnding = false) {
|
||||
// if just shutting down, check for expiration, so the endStudy event can
|
||||
// be sent along with this session's main ping.
|
||||
if (!isStudyEnding && this.isStudyExpired()) {
|
||||
log.debug("Study expired during this session.");
|
||||
this.endStudy("expired");
|
||||
return;
|
||||
}
|
||||
|
||||
this.addonListener.uninit();
|
||||
this.bookmarkObserver.uninit();
|
||||
this.menuListener.uninit();
|
||||
|
||||
Services.prefs.removeObserver(this.ALWAYS_PRIVATE_BROWSING_PREF, this);
|
||||
Services.prefs.removeObserver(this.STUDY_PREF, this);
|
||||
Services.prefs.removeObserver(this.STUDY_DURATION_OVERRIDE_PREF, this);
|
||||
Services.prefs.clearUserPref(PREF_LOG_LEVEL);
|
||||
Services.prefs.clearUserPref(this.STUDY_DURATION_OVERRIDE_PREF);
|
||||
}
|
||||
}
|
||||
|
||||
// References:
|
||||
// - https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/normandy/lib/TelemetryEvents.jsm
|
||||
// - https://hg.mozilla.org/mozilla-central/file/tip/toolkit/components/normandy/lib/PreferenceExperiments.jsm#l357
|
||||
class TelemetryEvents {
|
||||
constructor(studyCategory) {
|
||||
this.STUDY_TELEMETRY_CATEGORY = studyCategory;
|
||||
}
|
||||
|
||||
enableCollection() {
|
||||
log.debug("Study has been enabled; turning ON data collection.");
|
||||
Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, true);
|
||||
}
|
||||
|
||||
disableCollection() {
|
||||
log.debug("Study has been disabled; turning OFF data collection.");
|
||||
Services.telemetry.setEventRecordingEnabled(this.STUDY_TELEMETRY_CATEGORY, false);
|
||||
}
|
||||
}
|
||||
|
||||
class AddonListener {
|
||||
constructor(studyCategory) {
|
||||
this.STUDY_TELEMETRY_CATEGORY = studyCategory;
|
||||
this.METHOD = "addon";
|
||||
this.EXTRA_SUBCATEGORY = "customize";
|
||||
}
|
||||
|
||||
init() {
|
||||
this.listener = {
|
||||
onInstalling: (addon, needsRestart) => {
|
||||
const addon_id = addon.id;
|
||||
this.recordEvent("install_start", addon_id);
|
||||
},
|
||||
|
||||
onInstalled: (addon) => {
|
||||
const addon_id = addon.id;
|
||||
this.recordEvent("install_finish", addon_id);
|
||||
},
|
||||
|
||||
onEnabled: (addon) => {
|
||||
const addon_id = addon.id;
|
||||
this.recordEvent("enable", addon_id);
|
||||
},
|
||||
|
||||
onDisabled: (addon) => {
|
||||
const addon_id = addon.id;
|
||||
this.recordEvent("disable", addon_id);
|
||||
},
|
||||
|
||||
onUninstalling: (addon, needsRestart) => {
|
||||
const addon_id = addon.id;
|
||||
this.recordEvent("remove_start", addon_id);
|
||||
},
|
||||
|
||||
onUninstalled: (addon) => {
|
||||
const addon_id = addon.id;
|
||||
this.recordEvent("remove_finish", addon_id);
|
||||
}
|
||||
};
|
||||
this.addListeners();
|
||||
}
|
||||
|
||||
addListeners() {
|
||||
AddonManager.addAddonListener(this.listener);
|
||||
}
|
||||
|
||||
recordEvent(event, addon_id) {
|
||||
log.debug(`Addon ID: ${addon_id}; event: ${ event }`);
|
||||
Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY,
|
||||
this.METHOD,
|
||||
event,
|
||||
addon_id,
|
||||
{ subcategory: this.EXTRA_SUBCATEGORY });
|
||||
}
|
||||
|
||||
removeListeners() {
|
||||
AddonManager.removeAddonListener(this.listener);
|
||||
}
|
||||
|
||||
uninit() {
|
||||
if (SavantShieldStudy.shouldRemoveListeners) {
|
||||
this.removeListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class BookmarkObserver {
|
||||
constructor(studyCategory) {
|
||||
this.STUDY_TELEMETRY_CATEGORY = studyCategory;
|
||||
// there are two probes: bookmark and follow_bookmark
|
||||
this.METHOD_1 = "bookmark";
|
||||
this.EXTRA_SUBCATEGORY_1 = "feature";
|
||||
this.METHOD_2 = "follow_bookmark";
|
||||
this.EXTRA_SUBCATEGORY_2 = "navigation";
|
||||
this.TYPE_BOOKMARK = Ci.nsINavBookmarksService.TYPE_BOOKMARK;
|
||||
// Ignore "fake" bookmarks created for bookmark tags
|
||||
this.skipTags = true;
|
||||
}
|
||||
|
||||
init() {
|
||||
this.addObservers();
|
||||
}
|
||||
|
||||
addObservers() {
|
||||
PlacesUtils.bookmarks.addObserver(this);
|
||||
}
|
||||
|
||||
onItemAdded(itemID, parentID, index, itemType, uri, title, dateAdded, guid, parentGUID, source) {
|
||||
this.handleItemAddRemove(itemType, uri, source, "save");
|
||||
}
|
||||
|
||||
onItemRemoved(itemID, parentID, index, itemType, uri, guid, parentGUID, source) {
|
||||
this.handleItemAddRemove(itemType, uri, source, "remove");
|
||||
}
|
||||
|
||||
handleItemAddRemove(itemType, uri, source, event) {
|
||||
/*
|
||||
* "place:query" uris are used to create containers like Most Visited or
|
||||
* Recently Bookmarked. These are added as default bookmarks.
|
||||
*/
|
||||
if (itemType === this.TYPE_BOOKMARK && !uri.schemeIs("place")
|
||||
&& source === PlacesUtils.bookmarks.SOURCE_DEFAULT) {
|
||||
const isBookmarkProbe = true;
|
||||
this.recordEvent(event, isBookmarkProbe);
|
||||
}
|
||||
}
|
||||
|
||||
// This observer is only fired for TYPE_BOOKMARK items.
|
||||
onItemVisited(itemID, visitID, time, transitionType, uri, parentID, guid, parentGUID) {
|
||||
const isBookmarkProbe = false;
|
||||
this.recordEvent("open", isBookmarkProbe);
|
||||
}
|
||||
|
||||
recordEvent(event, isBookmarkProbe) {
|
||||
const method = isBookmarkProbe ? this.METHOD_1 : this.METHOD_2;
|
||||
const subcategory = isBookmarkProbe ? this.EXTRA_SUBCATEGORY_1 : this.EXTRA_SUBCATEGORY_2;
|
||||
Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, method, event, null,
|
||||
{
|
||||
subcategory
|
||||
});
|
||||
}
|
||||
|
||||
removeObservers() {
|
||||
PlacesUtils.bookmarks.removeObserver(this);
|
||||
}
|
||||
|
||||
uninit() {
|
||||
if (SavantShieldStudy.shouldRemoveListeners) {
|
||||
this.removeObservers();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class MenuListener {
|
||||
constructor(studyCategory) {
|
||||
this.STUDY_TELEMETRY_CATEGORY = studyCategory;
|
||||
this.NAVIGATOR_TOOLBOX_ID = "navigator-toolbox";
|
||||
this.OVERFLOW_PANEL_ID = "widget-overflow";
|
||||
this.LIBRARY_PANELVIEW_ID = "appMenu-libraryView";
|
||||
this.HAMBURGER_PANEL_ID = "appMenu-popup";
|
||||
this.DOTDOTDOT_PANEL_ID = "pageActionPanel";
|
||||
this.windowWatcher = new WindowWatcher();
|
||||
}
|
||||
|
||||
init() {
|
||||
this.windowWatcher.init(this.loadIntoWindow.bind(this),
|
||||
this.unloadFromWindow.bind(this),
|
||||
this.onWindowError.bind(this));
|
||||
}
|
||||
|
||||
loadIntoWindow(win) {
|
||||
this.addListeners(win);
|
||||
}
|
||||
|
||||
unloadFromWindow(win) {
|
||||
this.removeListeners(win);
|
||||
}
|
||||
|
||||
onWindowError(msg) {
|
||||
log.error(msg);
|
||||
}
|
||||
|
||||
addListeners(win) {
|
||||
const doc = win.document;
|
||||
const navToolbox = doc.getElementById(this.NAVIGATOR_TOOLBOX_ID);
|
||||
const overflowPanel = doc.getElementById(this.OVERFLOW_PANEL_ID);
|
||||
const hamburgerPanel = doc.getElementById(this.HAMBURGER_PANEL_ID);
|
||||
const dotdotdotPanel = doc.getElementById(this.DOTDOTDOT_PANEL_ID);
|
||||
|
||||
/*
|
||||
* the library menu "ViewShowing" event bubbles up on the navToolbox in its
|
||||
* default location. A separate listener is needed if it is moved to the
|
||||
* overflow panel via Hamburger > Customize
|
||||
*/
|
||||
navToolbox.addEventListener("ViewShowing", this);
|
||||
overflowPanel.addEventListener("ViewShowing", this);
|
||||
hamburgerPanel.addEventListener("popupshown", this);
|
||||
dotdotdotPanel.addEventListener("popupshown", this);
|
||||
}
|
||||
|
||||
handleEvent(evt) {
|
||||
switch (evt.type) {
|
||||
case "ViewShowing":
|
||||
if (evt.target.id === this.LIBRARY_PANELVIEW_ID) {
|
||||
log.debug("Library panel opened.");
|
||||
this.recordEvent("library_menu");
|
||||
}
|
||||
break;
|
||||
case "popupshown":
|
||||
switch (evt.target.id) {
|
||||
case this.HAMBURGER_PANEL_ID:
|
||||
log.debug("Hamburger panel opened.");
|
||||
this.recordEvent("hamburger_menu");
|
||||
break;
|
||||
case this.DOTDOTDOT_PANEL_ID:
|
||||
log.debug("Dotdotdot panel opened.");
|
||||
this.recordEvent("dotdotdot_menu");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
recordEvent(method) {
|
||||
Services.telemetry.recordEvent(this.STUDY_TELEMETRY_CATEGORY, method, "open", null,
|
||||
{ subcategory: "menu" });
|
||||
}
|
||||
|
||||
removeListeners(win) {
|
||||
const doc = win.document;
|
||||
const navToolbox = doc.getElementById(this.NAVIGATOR_TOOLBOX_ID);
|
||||
const overflowPanel = doc.getElementById(this.OVERFLOW_PANEL_ID);
|
||||
const hamburgerPanel = doc.getElementById(this.HAMBURGER_PANEL_ID);
|
||||
const dotdotdotPanel = doc.getElementById(this.DOTDOTDOT_PANEL_ID);
|
||||
|
||||
try {
|
||||
navToolbox.removeEventListener("ViewShowing", this);
|
||||
overflowPanel.removeEventListener("ViewShowing", this);
|
||||
hamburgerPanel.removeEventListener("popupshown", this);
|
||||
dotdotdotPanel.removeEventListener("popupshown", this);
|
||||
} catch (err) {
|
||||
// Firefox is shutting down; elements have already been removed.
|
||||
}
|
||||
}
|
||||
|
||||
uninit() {
|
||||
if (SavantShieldStudy.shouldRemoveListeners) {
|
||||
this.windowWatcher.uninit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The WindowWatcher is used to add/remove listeners from MenuListener
|
||||
* to/from all windows.
|
||||
*/
|
||||
class WindowWatcher {
|
||||
constructor() {
|
||||
this._isActive = false;
|
||||
this._loadCallback = null;
|
||||
this._unloadCallback = null;
|
||||
this._errorCallback = null;
|
||||
}
|
||||
|
||||
// It is expected that loadCallback, unloadCallback, and errorCallback are bound
|
||||
// to a `this` value.
|
||||
init(loadCallback, unloadCallback, errorCallback) {
|
||||
if (this._isActive) {
|
||||
errorCallback("Called init, but WindowWatcher was already running");
|
||||
return;
|
||||
}
|
||||
|
||||
this._isActive = true;
|
||||
this._loadCallback = loadCallback;
|
||||
this._unloadCallback = unloadCallback;
|
||||
this._errorCallback = errorCallback;
|
||||
|
||||
// Add loadCallback to existing windows
|
||||
for (const win of Services.wm.getEnumerator("navigator:browser")) {
|
||||
try {
|
||||
this._loadCallback(win);
|
||||
} catch (ex) {
|
||||
this._errorCallback(`WindowWatcher code loading callback failed: ${ ex }`);
|
||||
}
|
||||
}
|
||||
|
||||
// Add loadCallback to future windows
|
||||
// This will call the observe method on WindowWatcher
|
||||
Services.ww.registerNotification(this);
|
||||
}
|
||||
|
||||
uninit() {
|
||||
if (!this._isActive) {
|
||||
this._errorCallback("Called uninit, but WindowWatcher was already uninited");
|
||||
return;
|
||||
}
|
||||
|
||||
for (const win of Services.wm.getEnumerator("navigator:browser")) {
|
||||
try {
|
||||
this._unloadCallback(win);
|
||||
} catch (ex) {
|
||||
this._errorCallback(`WindowWatcher code unloading callback failed: ${ ex }`);
|
||||
}
|
||||
}
|
||||
|
||||
Services.ww.unregisterNotification(this);
|
||||
|
||||
this._loadCallback = null;
|
||||
this._unloadCallback = null;
|
||||
this._errorCallback = null;
|
||||
this._isActive = false;
|
||||
}
|
||||
|
||||
observe(win, topic) {
|
||||
switch (topic) {
|
||||
case "domwindowopened":
|
||||
this._onWindowOpened(win);
|
||||
break;
|
||||
case "domwindowclosed":
|
||||
this._onWindowClosed(win);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_onWindowOpened(win) {
|
||||
win.addEventListener("load", this, { once: true });
|
||||
}
|
||||
|
||||
// only one event type expected: "load"
|
||||
handleEvent(evt) {
|
||||
const win = evt.target.ownerGlobal;
|
||||
|
||||
// make sure we only add window listeners to a DOMWindow (browser.xul)
|
||||
const winType = win.document.documentElement.getAttribute("windowtype");
|
||||
if (winType === "navigator:browser") {
|
||||
this._loadCallback(win);
|
||||
}
|
||||
}
|
||||
|
||||
_onWindowClosed(win) {
|
||||
this._unloadCallback(win);
|
||||
}
|
||||
}
|
||||
|
||||
const SavantShieldStudy = new SavantShieldStudyClass();
|
|
@ -138,7 +138,6 @@ EXTRA_JS_MODULES += [
|
|||
'ReaderParent.jsm',
|
||||
'RemotePrompt.jsm',
|
||||
'Sanitizer.jsm',
|
||||
'SavantShieldStudy.jsm',
|
||||
'SchedulePressure.jsm',
|
||||
'SiteDataManager.jsm',
|
||||
'SitePermissions.jsm',
|
||||
|
|
|
@ -436,14 +436,8 @@ var LoginManagerContent = {
|
|||
_fetchLoginsFromParentAndFillForm(form, window) {
|
||||
this._detectInsecureFormLikes(window);
|
||||
|
||||
const isPrivateWindow = PrivateBrowsingUtils.isContentWindowPrivate(window);
|
||||
|
||||
let messageManager = window.docShell.messageManager;
|
||||
messageManager.sendAsyncMessage("LoginStats:LoginEncountered",
|
||||
{
|
||||
isPrivateWindow,
|
||||
isPwmgrEnabled: gEnabled,
|
||||
});
|
||||
messageManager.sendAsyncMessage("LoginStats:LoginEncountered");
|
||||
|
||||
if (!gEnabled) {
|
||||
return;
|
||||
|
|
|
@ -94,13 +94,6 @@ var LoginManagerParent = {
|
|||
data.oldPasswordField,
|
||||
msg.objects.openerTopWindow,
|
||||
msg.target);
|
||||
|
||||
const flow_id = msg.target.ownerGlobal.gBrowser.getTabForBrowser(msg.target).linkedPanel;
|
||||
Services.telemetry.recordEvent("savant", "login_form", "submit", null,
|
||||
{
|
||||
subcategory: "encounter",
|
||||
flow_id,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -119,28 +112,6 @@ var LoginManagerParent = {
|
|||
AutoCompletePopup.removeLogin(login);
|
||||
break;
|
||||
}
|
||||
|
||||
case "LoginStats:LoginFillSuccessful": {
|
||||
const flow_id = msg.target.ownerGlobal.gBrowser.getTabForBrowser(msg.target).linkedPanel;
|
||||
Services.telemetry.recordEvent("savant", "pwmgr_use", "use", null,
|
||||
{
|
||||
subcategory: "feature",
|
||||
flow_id,
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
case "LoginStats:LoginEncountered": {
|
||||
const canRecordSubmit = (!data.isPrivateWindow && data.isPwmgrEnabled).toString();
|
||||
const flow_id = msg.target.ownerGlobal.gBrowser.getTabForBrowser(msg.target).linkedPanel;
|
||||
Services.telemetry.recordEvent("savant", "login_form", "load", null,
|
||||
{
|
||||
subcategory: "encounter",
|
||||
flow_id,
|
||||
canRecordSubmit,
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
|
|
@ -823,14 +823,6 @@ LoginManagerPrompter.prototype = {
|
|||
histogram.add(PROMPT_DISPLAYED);
|
||||
Services.obs.notifyObservers(null, "weave:telemetry:histogram", histogramName);
|
||||
|
||||
const promptType = type == "password-save" ? "save" : "update";
|
||||
const flow_id = browser.ownerGlobal.gBrowser.getTabForBrowser(browser).linkedPanel;
|
||||
Services.telemetry.recordEvent("savant", "pwmgr", "ask", promptType,
|
||||
{
|
||||
subcategory: "prompt",
|
||||
flow_id,
|
||||
});
|
||||
|
||||
let chromeDoc = browser.ownerDocument;
|
||||
|
||||
let currentNotification;
|
||||
|
@ -958,20 +950,8 @@ LoginManagerPrompter.prototype = {
|
|||
accessKey: this._getLocalizedString(initialMsgNames.buttonAccessKey),
|
||||
callback: () => {
|
||||
histogram.add(PROMPT_ADD_OR_UPDATE);
|
||||
const flow_id = browser.ownerGlobal.gBrowser.getTabForBrowser(browser).linkedPanel;
|
||||
if (histogramName == "PWMGR_PROMPT_REMEMBER_ACTION") {
|
||||
Services.obs.notifyObservers(null, "LoginStats:NewSavedPassword");
|
||||
Services.telemetry.recordEvent("savant", "pwmgr", "save", null,
|
||||
{
|
||||
subcategory: "prompt",
|
||||
flow_id,
|
||||
});
|
||||
} else if (histogramName == "PWMGR_PROMPT_UPDATE_ACTION") {
|
||||
Services.telemetry.recordEvent("savant", "pwmgr", "update", null,
|
||||
{
|
||||
subcategory: "prompt",
|
||||
flow_id,
|
||||
});
|
||||
}
|
||||
readDataFromUI();
|
||||
persistData();
|
||||
|
|
|
@ -98,9 +98,6 @@ var ReaderMode = {
|
|||
* if not, append the about:reader page in the history instead.
|
||||
*/
|
||||
enterReaderMode(docShell, win) {
|
||||
Services.telemetry.recordEvent("savant", "readermode", "on", null,
|
||||
{ subcategory: "feature" });
|
||||
|
||||
let url = win.document.location.href;
|
||||
let readerURL = "about:reader?url=" + encodeURIComponent(url);
|
||||
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
|
@ -122,8 +119,6 @@ var ReaderMode = {
|
|||
* if not, append the original page in the history instead.
|
||||
*/
|
||||
leaveReaderMode(docShell, win) {
|
||||
Services.telemetry.recordEvent("savant", "readermode", "off", null,
|
||||
{ subcategory: "feature" });
|
||||
let url = win.document.location.href;
|
||||
let originalURL = this.getOriginalUrl(url);
|
||||
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||
|
|
|
@ -113,206 +113,6 @@ navigation:
|
|||
extra_keys:
|
||||
engine: The id of the search engine used.
|
||||
|
||||
# This category contains event entries used for the Savant Shield study.
|
||||
savant:
|
||||
# Mostly a dupe of "search" event from "navigation" category to ensure only Savant
|
||||
# code enables/disables it.
|
||||
search:
|
||||
objects: ["about_home", "about_newtab", "contextmenu", "oneoff",
|
||||
"suggestion", "alias", "enter", "searchbar", "urlbar"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded on each search navigation.
|
||||
The value field records the action used to trigger the search:
|
||||
"enter", "oneoff", "suggestion", "alias", null (for contextmenu)
|
||||
bug_numbers: [1316281, 1457226, 1462725]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
engine: The id of the search engine used.
|
||||
end_study:
|
||||
objects: ["ineligible", "study_disable", "expired"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time a study ending condition occurs for the Savant
|
||||
Shield study. The object field records the reason that caused the ending.
|
||||
bug_numbers: [1457226, 1462725]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
readermode:
|
||||
objects: ["on", "off"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["content"]
|
||||
description: >
|
||||
This is recorded any time Reader Mode is turned on or off.
|
||||
bug_numbers: [1457226, 1465698]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
addon:
|
||||
objects: ["install_start", "install_finish", "remove_start", "remove_finish",
|
||||
"enable", "disable" ]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time an addon event as listed in the objects field fires.
|
||||
The value field records the addon ID for the event.
|
||||
bug_numbers: [1457226, 1465707]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
bookmark:
|
||||
objects: ["save", "remove"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time a bookmark is saved or removed.
|
||||
bug_numbers: [1457226, 1465703]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
follow_bookmark:
|
||||
objects: ["open"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time a bookmark is visited.
|
||||
bug_numbers: [1457226, 1465703]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
follow_urlbar_link:
|
||||
objects: ["bookmark", "history"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded when the user selects a urlbar bookmark or history result.
|
||||
bug_numbers: [1457226, 1465704]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
library_menu:
|
||||
objects: ["open"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time the library menu is opened.
|
||||
bug_numbers: [1457226, 1465697]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
hamburger_menu:
|
||||
objects: ["open"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time the hamburger menu is opened.
|
||||
bug_numbers: [1457226, 1465697]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
dotdotdot_menu:
|
||||
objects: ["open"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time the dotdotdot (aka pageAction) menu is opened.
|
||||
bug_numbers: [1457226, 1465697]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
pwmgr_use:
|
||||
objects: ["use"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
Client uses saved login information from the Password Manager
|
||||
bug_numbers: [1457226, 1465685]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
flow_id: A tab identifier to associate events occuring in the same tab
|
||||
pwmgr:
|
||||
objects: ["ask", "save", "update"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
Password Manager asks the user to save or update login information.
|
||||
For ask prompts, the value field indicate a save versus update ask.
|
||||
bug_numbers: [1457226, 1465685]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
flow_id: A tab identifier to associate events occuring in the same tab
|
||||
login_form:
|
||||
objects: ["load", "submit"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
A login form has been loaded or submitted. Login form submit events only
|
||||
fire in non-private windows with Password Manager enabled.
|
||||
bug_numbers: [1457226, 1465685]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
flow_id: A tab identifier to associate events occuring in the same tab
|
||||
canRecordSubmit: True if a login form loads in a non-private window with Password Manager enabled.
|
||||
tab:
|
||||
objects: ["open", "close", "select"]
|
||||
release_channel_collection: opt-out
|
||||
record_in_processes: ["main"]
|
||||
description: >
|
||||
This is recorded any time a tab is opened, closed or selected.
|
||||
bug_numbers: [1457226, 1465694]
|
||||
notification_emails:
|
||||
- "bdanforth@mozilla.com"
|
||||
- "shong@mozilla.com"
|
||||
expiry_version: "65"
|
||||
extra_keys:
|
||||
subcategory: The broad event category for this probe. E.g. navigation
|
||||
|
||||
# This category contains event entries used for Telemetry tests.
|
||||
# They will not be sent out with any pings.
|
||||
telemetry.test:
|
||||
|
|
Загрузка…
Ссылка в новой задаче