Bug 1416044 - Add telemetry probe for if userChrome.css is loaded. r?francois, r?jwatt draft
authorSam Foster <sfoster@mozilla.com>
Tue, 28 Nov 2017 12:14:02 -0800
changeset 704707 e421efc6a9201cf26998aa33c8917ea3592b5dba
parent 704706 c2248f85346939d3e0b01f57276c440ccb2d16a1
child 742129 dfc5df8c9c0d60bc1f1ca95e166b880609d2b71e
push id91211
push userbmo:sfoster@mozilla.com
push dateTue, 28 Nov 2017 21:04:41 +0000
reviewersfrancois, jwatt
bugs1416044
milestone59.0a1
Bug 1416044 - Add telemetry probe for if userChrome.css is loaded. r?francois, r?jwatt * New USER_CHROME_CSS_LOADED histogram * Just log a boolean to reflect if the userChrome.css was successfully loaded MozReview-Commit-ID: 8ffSNUot43I
layout/style/nsLayoutStylesheetCache.cpp
toolkit/components/telemetry/Histograms.json
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -8,16 +8,17 @@
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "mozilla/StyleSheetInlines.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Omnijar.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/StyleSheet.h"
 #include "mozilla/StyleSheetInlines.h"
+#include "mozilla/Telemetry.h"
 #include "mozilla/css/Loader.h"
 #include "mozilla/dom/SRIMetadata.h"
 #include "MainThreadUtils.h"
 #include "nsColor.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryService.h"
 #include "nsExceptionHandler.h"
 #include "nsIChromeRegistry.h"
@@ -429,23 +430,28 @@ nsLayoutStylesheetCache::InitFromProfile
   NS_GetSpecialDirectory(NS_APP_USER_CHROME_DIR,
                          getter_AddRefs(contentFile));
   if (!contentFile) {
     // if we don't have a profile yet, that's OK!
     return;
   }
 
   contentFile->Clone(getter_AddRefs(chromeFile));
-  if (!chromeFile) return;
+  if (!chromeFile) {
+    Telemetry::Accumulate(Telemetry::USER_CHROME_CSS_LOADED, 0);
+    return;
+  }
 
   contentFile->Append(NS_LITERAL_STRING("userContent.css"));
   chromeFile->Append(NS_LITERAL_STRING("userChrome.css"));
 
   LoadSheetFile(contentFile, &mUserContentSheet, eUserSheetFeatures, eLogToConsole);
   LoadSheetFile(chromeFile, &mUserChromeSheet, eUserSheetFeatures, eLogToConsole);
+
+  Telemetry::Accumulate(Telemetry::USER_CHROME_CSS_LOADED, mUserChromeSheet != nullptr);
 }
 
 void
 nsLayoutStylesheetCache::LoadSheetURL(const char* aURL,
                                       RefPtr<StyleSheet>* aSheet,
                                       SheetParsingMode aParsingMode,
                                       FailureAction aFailureAction)
 {
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -13787,16 +13787,25 @@
     "record_in_processes": ["main", "content"],
     "alert_emails": ["seceng-telemetry@mozilla.com", "francois@mozilla.com"],
     "bug_numbers": [1375277],
     "expires_in_version": "never",
     "kind": "enumerated",
     "n_values": 64,
     "description": "URL CLassifier-related (aka Safe Browsing) UI events. See nsIUrlClassifierUITelemetry.idl for the specific values."
   },
+  "USER_CHROME_CSS_LOADED": {
+    "record_in_processes": ["main"],
+    "bug_numbers": [1416044],
+    "expires_in_version": "62",
+    "alert_emails": ["sfoster@mozilla.com"],
+    "kind": "boolean",
+    "releaseChannelCollection": "opt-out",
+    "description": "Was a userChrome.css stylesheet loaded with this profile?"
+  },
  "WEBAUTHN_CREATE_CREDENTIAL_MS": {
     "record_in_processes": ["main"],
     "alert_emails": ["seceng-telemetry@mozilla.com", "jjones@mozilla.com"],
     "expires_in_version": "70",
     "releaseChannelCollection": "opt-out",
     "kind": "exponential",
     "high": 120000,
     "n_buckets": 100,