diff options
author | Gaming4JC <g4jc@bulletmail.org> | 2018-09-16 17:48:59 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@bulletmail.org> | 2018-09-16 17:48:59 -0400 |
commit | 6ffcc32071fafb765ba9ae889402d8563ca07aac (patch) | |
tree | 51cc36c8a60c51d4faa745dae3d4d2bb0ffa490a | |
parent | f131abda5692d959e4bc2401f6cc1f201550f774 (diff) | |
download | iceweasel-uxp-6ffcc32071fafb765ba9ae889402d8563ca07aac.tar.gz |
Remove telemetry from nsBrowserGlue.js
-rw-r--r-- | components/nsBrowserGlue.js | 173 |
1 files changed, 2 insertions, 171 deletions
diff --git a/components/nsBrowserGlue.js b/components/nsBrowserGlue.js index e3e9de7..eacd1d0 100644 --- a/components/nsBrowserGlue.js +++ b/components/nsBrowserGlue.js @@ -339,9 +339,6 @@ BrowserGlue.prototype = { } }); break; - case "autocomplete-did-enter-text": - this._handleURLBarTelemetry(subject.QueryInterface(Ci.nsIAutoCompleteInput)); - break; case "test-initialize-sanitizer": this._sanitizer.onStartup(); break; @@ -351,64 +348,6 @@ BrowserGlue.prototype = { } }, - _handleURLBarTelemetry(input) { - if (!input || - input.id != "urlbar" || - input.inPrivateContext || - input.popup.selectedIndex < 0) { - return; - } - let controller = - input.popup.view.QueryInterface(Ci.nsIAutoCompleteController); - let idx = input.popup.selectedIndex; - let value = controller.getValueAt(idx); - let action = input._parseActionUrl(value); - let actionType; - if (action) { - actionType = - action.type == "searchengine" && action.params.searchSuggestion ? - "searchsuggestion" : - action.type; - } - if (!actionType) { - let styles = new Set(controller.getStyleAt(idx).split(/\s+/)); - let style = ["autofill", "tag", "bookmark"].find(s => styles.has(s)); - actionType = style || "history"; - } - - Services.telemetry - .getHistogramById("FX_URLBAR_SELECTED_RESULT_INDEX") - .add(idx); - - // Ideally this would be a keyed histogram and we'd just add(actionType), - // but keyed histograms aren't currently shown on the telemetry dashboard - // (bug 1151756). - // - // You can add values but don't change any of the existing values. - // Otherwise you'll break our data. - let buckets = { - autofill: 0, - bookmark: 1, - history: 2, - keyword: 3, - searchengine: 4, - searchsuggestion: 5, - switchtab: 6, - tag: 7, - visiturl: 8, - remotetab: 9, - extension: 10, - }; - if (actionType in buckets) { - Services.telemetry - .getHistogramById("FX_URLBAR_SELECTED_RESULT_TYPE") - .add(buckets[actionType]); - } else { - Cu.reportError("Unknown FX_URLBAR_SELECTED_RESULT_TYPE type: " + - actionType); - } - }, - // initialization (called on application startup) _init: function BG__init() { let os = Services.obs; @@ -436,14 +375,10 @@ BrowserGlue.prototype = { os.addObserver(this, "distribution-customization-complete", false); os.addObserver(this, "handle-xul-text-link", false); os.addObserver(this, "profile-before-change", false); - if (AppConstants.MOZ_TELEMETRY_REPORTING) { - os.addObserver(this, "keyword-search", false); - } os.addObserver(this, "browser-search-engine-modified", false); os.addObserver(this, "restart-in-safe-mode", false); os.addObserver(this, "flash-plugin-hang", false); os.addObserver(this, "xpi-signature-changed", false); - os.addObserver(this, "autocomplete-did-enter-text", false); if (AppConstants.NIGHTLY_BUILD) { os.addObserver(this, AddonWatcher.TOPIC_SLOW_ADDON_DETECTED, false); @@ -490,13 +425,9 @@ BrowserGlue.prototype = { os.removeObserver(this, "places-database-locked"); os.removeObserver(this, "handle-xul-text-link"); os.removeObserver(this, "profile-before-change"); - if (AppConstants.MOZ_TELEMETRY_REPORTING) { - os.removeObserver(this, "keyword-search"); - } os.removeObserver(this, "browser-search-engine-modified"); os.removeObserver(this, "flash-plugin-hang"); os.removeObserver(this, "xpi-signature-changed"); - os.removeObserver(this, "autocomplete-did-enter-text"); }, _onAppDefaults: function BG__onAppDefaults() { @@ -524,31 +455,6 @@ BrowserGlue.prototype = { let notificationId = 'addon-slow:' + addonId; let notification = notificationBox.getNotificationWithValue(notificationId); - // Monitor the response of users - const STATE_WARNING_DISPLAYED = 0; - const STATE_USER_PICKED_DISABLE = 1; - const STATE_USER_PICKED_IGNORE_FOR_NOW = 2; - const STATE_USER_PICKED_IGNORE_FOREVER = 3; - const STATE_USER_CLOSED_NOTIFICATION = 4; - - let update = function(response) { - Services.telemetry.getHistogramById("SLOW_ADDON_WARNING_STATES").add(response); - } - - let complete = false; - let start = Date.now(); - let done = function(response) { - // Only report the first reason for closing. - if (complete) { - return; - } - complete = true; - update(response); - Services.telemetry.getHistogramById("SLOW_ADDON_WARNING_RESPONSE_TIME").add(Date.now() - start); - }; - - update(STATE_WARNING_DISPLAYED); - if (notification) { notification.label = message; } else { @@ -557,7 +463,6 @@ BrowserGlue.prototype = { label: win.gNavigatorBundle.getFormattedString("addonwatch.disable.label", [addon.name]), accessKey: "", // workaround for bug 1192901 callback: function() { - done(STATE_USER_PICKED_DISABLE); addon.userDisabled = true; if (addon.pendingOperations == addon.PENDING_NONE) { return; @@ -583,7 +488,6 @@ BrowserGlue.prototype = { label: win.gNavigatorBundle.getString("addonwatch.ignoreSession.label"), accessKey: win.gNavigatorBundle.getString("addonwatch.ignoreSession.accesskey"), callback: function() { - done(STATE_USER_PICKED_IGNORE_FOR_NOW); AddonWatcher.ignoreAddonForSession(addonId); } }, @@ -591,25 +495,14 @@ BrowserGlue.prototype = { label: win.gNavigatorBundle.getString("addonwatch.ignorePerm.label"), accessKey: win.gNavigatorBundle.getString("addonwatch.ignorePerm.accesskey"), callback: function() { - done(STATE_USER_PICKED_IGNORE_FOREVER); AddonWatcher.ignoreAddonPermanently(addonId); } }, ]; const priority = notificationBox.PRIORITY_WARNING_MEDIUM; - notification = notificationBox.appendNotification( - message, notificationId, "", - priority, buttons, - function(topic) { - if (topic == "removed") { - // Other callbacks are called before this one and only the first - // call to `done` is taken into account, so if this call to `done` - // gets through, this means that the user has closed the notification - // manually. - done(STATE_USER_CLOSED_NOTIFICATION); - } - }); + notificationBox.appendNotification(message, notificationId, "", + priority, buttons); } }; AddonManager.getAddonByID(addonId, addonCallback); @@ -886,27 +779,6 @@ BrowserGlue.prototype = { nb.PRIORITY_WARNING_MEDIUM, buttons); }, - _firstWindowTelemetry: function(aWindow) { - let SCALING_PROBE_NAME = ""; - switch (AppConstants.platform) { - case "win": - SCALING_PROBE_NAME = "DISPLAY_SCALING_MSWIN"; - break; - case "macosx": - SCALING_PROBE_NAME = "DISPLAY_SCALING_OSX"; - break; - case "linux": - SCALING_PROBE_NAME = "DISPLAY_SCALING_LINUX"; - break; - } - if (SCALING_PROBE_NAME) { - let scaling = aWindow.devicePixelRatio * 100; - try { - Services.telemetry.getHistogramById(SCALING_PROBE_NAME).add(scaling); - } catch (ex) {} - } - }, - // the first browser window has finished initializing _onFirstWindowLoaded: function BG__onFirstWindowLoaded(aWindow) { @@ -977,7 +849,6 @@ BrowserGlue.prototype = { AutoCompletePopup.init(); DateTimePickerHelper.init(); - this._firstWindowTelemetry(aWindow); this._firstWindowLoaded(); }, @@ -1156,20 +1027,6 @@ BrowserGlue.prototype = { Services.prefs.setIntPref("browser.shell.defaultBrowserCheckCount", promptCount); } - try { - // Report default browser status on startup to telemetry - // so we can track whether we are the default. - Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT") - .add(isDefault); - Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT_ERROR") - .add(isDefaultError); - Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_ALWAYS_CHECK") - .add(shouldCheck); - Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_DIALOG_PROMPT_RAWCOUNT") - .add(promptCount); - } - catch (ex) { /* Don't break the default prompt if telemetry is broken. */ } - if (willPrompt) { Services.tm.mainThread.dispatch(function() { DefaultBrowserCheck.prompt(RecentWindow.getMostRecentBrowserWindow()); @@ -1626,14 +1483,6 @@ BrowserGlue.prototype = { // available backup compared to that session. if (profileLastUse > lastBackupTime) { let backupAge = Math.round((profileLastUse - lastBackupTime) / 86400000); - // Report the age of the last available backup. - try { - Services.telemetry - .getHistogramById("PLACES_BACKUPS_DAYSFROMLAST") - .add(backupAge); - } catch (ex) { - Cu.reportError(new Error("Unable to report telemetry.")); - } if (backupAge > BOOKMARKS_BACKUP_MAX_INTERVAL_DAYS) this._bookmarksBackupIdleTime /= 2; @@ -2546,24 +2395,12 @@ var DefaultBrowserCheck = { if (isDefault || runTime > 600) { this._setAsDefaultTimer.cancel(); this._setAsDefaultTimer = null; - Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_TIME_TO_COMPLETION_SECONDS") - .add(runTime); } - Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT_ERROR") - .add(isDefaultError); }, 1000, Ci.nsITimer.TYPE_REPEATING_SLACK); } catch (ex) { setAsDefaultError = true; Cu.reportError(ex); } - // Here BROWSER_IS_USER_DEFAULT and BROWSER_SET_USER_DEFAULT_ERROR appear - // to be inverse of each other, but that is only because this function is - // called when the browser is set as the default. During startup we record - // the BROWSER_IS_USER_DEFAULT value without recording BROWSER_SET_USER_DEFAULT_ERROR. - Services.telemetry.getHistogramById("BROWSER_IS_USER_DEFAULT") - .add(!setAsDefaultError); - Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_ERROR") - .add(setAsDefaultError); }, _createPopup: function(win, notNowStrings, neverStrings) { @@ -2675,12 +2512,6 @@ var DefaultBrowserCheck = { } else if (!shouldAsk.value) { ShellService.shouldCheckDefaultBrowser = false; } - - try { - let resultEnum = rv * 2 + shouldAsk.value; - Services.telemetry.getHistogramById("BROWSER_SET_DEFAULT_RESULT") - .add(resultEnum); - } catch (ex) { /* Don't break if Telemetry is acting up. */ } } }, |