Bug 827976 - Use an existing window for media telemetry. r=Gijs
authorFelipe Gomes <felipc@gmail.com>
Mon, 04 Mar 2019 18:53:29 +0000
changeset 520356 5f4cebc62cbd61b5062724f78dfb9cfadaf84a3f
parent 520355 1960442645ea613e13d326252b33448b4d49587f
child 520357 cd731fe8a50f93d96d36698d84a838d382df458b
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs827976
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 827976 - Use an existing window for media telemetry. r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D21086
browser/components/BrowserGlue.jsm
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -1438,19 +1438,21 @@ BrowserGlue.prototype = {
     }
 
     Services.telemetry.scalarSet("contentblocking.fingerprinting_blocking_enabled", fpEnabled);
     Services.telemetry.scalarSet("contentblocking.cryptomining_blocking_enabled", cmEnabled);
     Services.telemetry.scalarSet("contentblocking.category", categoryPref);
   },
 
   _sendMediaTelemetry() {
-    let win = Services.appShell.hiddenDOMWindow;
-    let v = win.document.createElementNS("http://www.w3.org/1999/xhtml", "video");
-    v.reportCanPlayTelemetry();
+    let win = Services.wm.getMostRecentWindow("navigator:browser");
+    if (win) {
+      let v = win.document.createElementNS("http://www.w3.org/1999/xhtml", "video");
+      v.reportCanPlayTelemetry();
+    }
   },
 
   /**
    * Application shutdown handler.
    */
   _onQuitApplicationGranted() {
     // This pref must be set here because SessionStore will use its value
     // on quit-application.