Skip to content

Commit

Permalink
Bug 1715542 - Give Glean and GleanPings a BackstagePass r=janerik,app…
Browse files Browse the repository at this point in the history
…lication-update-reviewers,nalexander

Differential Revision: https://phabricator.services.mozilla.com/D131824
  • Loading branch information
chutten committed Dec 14, 2021
1 parent 048171d commit a1187db
Show file tree
Hide file tree
Showing 16 changed files with 8 additions and 32 deletions.
2 changes: 0 additions & 2 deletions browser/modules/BrowserUsageTelemetry.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
"browser.engagement.recent_visited_origins.expiry"
);

Cu.importGlobalProperties(["Glean"]);

// The upper bound for the count of the visited unique domain names.
const MAX_UNIQUE_VISITED_DOMAINS = 100;

Expand Down
11 changes: 0 additions & 11 deletions js/xpconnect/src/Sandbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@
#include "mozilla/dom/XMLSerializerBinding.h"
#include "mozilla/dom/FormDataBinding.h"
#include "mozilla/dom/nsCSPContext.h"
#include "mozilla/glean/bindings/Glean.h"
#include "mozilla/glean/bindings/GleanPings.h"
#include "mozilla/BasePrincipal.h"
#include "mozilla/DeferredFinalize.h"
#include "mozilla/ExtensionPolicyService.h"
Expand Down Expand Up @@ -967,10 +965,6 @@ bool xpc::GlobalProperties::Parse(JSContext* cx, JS::HandleObject obj) {
indexedDB = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "isSecureContext")) {
isSecureContext = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "Glean")) {
glean = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "GleanPings")) {
gleanPings = true;
#ifdef MOZ_WEBRTC
} else if (JS_LinearStringEqualsLiteral(nameStr, "rtcIdentityProvider")) {
rtcIdentityProvider = true;
Expand Down Expand Up @@ -1150,11 +1144,6 @@ bool xpc::GlobalProperties::DefineInXPCComponents(JSContext* cx,
if (indexedDB && !IndexedDatabaseManager::DefineIndexedDB(cx, obj))
return false;

if (glean && !mozilla::glean::Glean::DefineGlean(cx, obj)) return false;
if (gleanPings && !mozilla::glean::GleanPings::DefineGleanPings(cx, obj)) {
return false;
}

return Define(cx, obj);
}

Expand Down
6 changes: 6 additions & 0 deletions js/xpconnect/src/nsXPConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,12 @@ nsresult InitClassesWithNewWrappedGlobal(JSContext* aJSContext,
if (!JS_DefineProfilingFunctions(aJSContext, global)) {
return UnexpectedFailure(NS_ERROR_OUT_OF_MEMORY);
}
if (aPrincipal->IsSystemPrincipal()) {
if (!glean::Glean::DefineGlean(aJSContext, global) ||
!glean::GleanPings::DefineGleanPings(aJSContext, global)) {
return UnexpectedFailure(NS_ERROR_FAILURE);
}
}
}

aNewGlobal.set(global);
Expand Down
2 changes: 0 additions & 2 deletions js/xpconnect/src/xpcprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -2270,8 +2270,6 @@ struct GlobalProperties {
bool indexedDB : 1;
bool isSecureContext : 1;
bool rtcIdentityProvider : 1;
bool glean : 1;
bool gleanPings : 1;

private:
bool Define(JSContext* cx, JS::HandleObject obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"use strict";

Cu.importGlobalProperties(["Glean"]);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/glean/tests/xpcshell/test_FOGPrefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"use strict";

Cu.importGlobalProperties(["Glean"]);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

const TELEMETRY_SERVER_PREF = "toolkit.telemetry.server";
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/glean/tests/xpcshell/test_GIFFT.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"use strict";

Cu.importGlobalProperties(["Glean"]);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/glean/tests/xpcshell/test_Glean.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"use strict";

Cu.importGlobalProperties(["Glean", "GleanPings"]);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/glean/tests/xpcshell/test_GleanIPC.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

"use strict";

Cu.importGlobalProperties(["Glean"]);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

Cu.importGlobalProperties(["Glean"]);

const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");

var cpuThreadCount;
Expand Down
2 changes: 0 additions & 2 deletions toolkit/components/telemetry/pings/TelemetrySession.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
TelemetryScheduler: "resource://gre/modules/TelemetryScheduler.jsm",
});

Cu.importGlobalProperties(["Glean"]);

const Utils = TelemetryUtils;

const myScope = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const { TelemetrySession } = ChromeUtils.import(
"resource://gre/modules/TelemetrySession.jsm"
);

Cu.importGlobalProperties(["Glean"]);

function tick(aHowMany) {
for (let i = 0; i < aHowMany; i++) {
Services.obs.notifyObservers(null, "user-interaction-active");
Expand Down
2 changes: 0 additions & 2 deletions toolkit/mozapps/update/BackgroundTask_backgroundupdate.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
return new ConsoleAPI(consoleOptions);
});

Cu.importGlobalProperties(["Glean", "GleanPings"]);

const backgroundTaskTimeoutSec = Services.prefs.getIntPref(
"app.update.background.timeoutSec",
10 * 60
Expand Down
2 changes: 0 additions & 2 deletions toolkit/mozapps/update/BackgroundUpdate.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIApplicationUpdateService"
);

Cu.importGlobalProperties(["Glean"]);

// We may want to change the definition of the task over time. When we do this,
// we need to remove and re-register the task. We will make sure this happens
// by storing the installed version number of the task to a pref and comparing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIApplicationUpdateService"
);

Cu.importGlobalProperties(["Glean"]);

add_task(function test_setup() {
// FOG needs a profile directory to put its data in.
do_get_profile();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ module.exports = {
GamepadHapticActuator: false,
GamepadPose: false,
GamepadServiceTest: false,
Glean: false,
GleanPings: false,
Grid: false,
GridArea: false,
GridDimension: false,
Expand Down

0 comments on commit a1187db

Please sign in to comment.