1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 import { RemotePageChild } from "resource://gre/actors/RemotePageChild.sys.mjs";
10 ChromeUtils.defineESModuleGetters(lazy, {
11 NimbusFeatures: "resource://nimbus/ExperimentAPI.sys.mjs",
12 ExperimentAPI: "resource://nimbus/ExperimentAPI.sys.mjs",
15 export class AboutPrivateBrowsingChild extends RemotePageChild {
18 let window = this.contentWindow;
20 Cu.exportFunction(this.PrivateBrowsingRecordClick.bind(this), window, {
21 defineAs: "PrivateBrowsingRecordClick",
24 this.PrivateBrowsingShouldHideDefault.bind(this),
27 defineAs: "PrivateBrowsingShouldHideDefault",
31 this.PrivateBrowsingPromoExposureTelemetry.bind(this),
33 { defineAs: "PrivateBrowsingPromoExposureTelemetry" }
35 Cu.exportFunction(this.FeltPrivacyExposureTelemetry.bind(this), window, {
36 defineAs: "FeltPrivacyExposureTelemetry",
40 PrivateBrowsingRecordClick(source) {
41 const experiment = lazy.ExperimentAPI.getExperimentMetaData({
42 featureId: "pbNewtab",
45 Services.telemetry.recordEvent("aboutprivatebrowsing", "click", source);
50 PrivateBrowsingShouldHideDefault() {
51 const config = lazy.NimbusFeatures.pbNewtab.getAllVariables() || {};
52 return config?.content?.hideDefault;
55 PrivateBrowsingPromoExposureTelemetry() {
56 lazy.NimbusFeatures.pbNewtab.recordExposureEvent({ once: false });
59 FeltPrivacyExposureTelemetry() {
60 lazy.NimbusFeatures.feltPrivacy.recordExposureEvent({ once: true });