tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

head.js (1158B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 // Bug 1799977: Using workaround to test telemetry in plain mochitests
      8 const GleanTest = new Proxy(
      9  {},
     10  {
     11    get(target, categoryName, receiver) {
     12      return new Proxy(
     13        {},
     14        {
     15          // eslint-disable-next-line no-shadow
     16          get(target, metricName, receiver) {
     17            return {
     18              async testGetValue() {
     19                return SpecialPowers.spawnChrome(
     20                  [categoryName, metricName],
     21                  // eslint-disable-next-line no-shadow
     22                  async (categoryName, metricName) => {
     23                    await Services.fog.testFlushAllChildren();
     24                    const window = this.browsingContext.topChromeWindow;
     25                    return window.Glean[categoryName][
     26                      metricName
     27                    ].testGetValue();
     28                  }
     29                );
     30              },
     31            };
     32          },
     33        }
     34      );
     35    },
     36  }
     37 );