in glean/src/core/glean.ts [387:418]
export function setUploadEnabled(flag: boolean): void {
if (!Context.initialized) {
log(
LOG_TAG,
[
"Changing upload enabled before Glean is initialized is not supported.\n",
"Pass the correct state into `initialize`.\n",
"See documentation at https://mozilla.github.io/glean/book/user/general-api.html#initializing-the-glean-sdk`",
],
LoggingLevel.Error
);
return;
}
if (!isBoolean(flag)) {
log(
LOG_TAG,
"Unable to change upload state, new value must be a boolean. Ignoring.",
LoggingLevel.Error
);
return;
}
if (Context.uploadEnabled !== flag) {
if (flag) {
onUploadEnabled();
Context.coreMetrics.initialize();
} else {
onUploadDisabled(false);
}
}
}