Skip to content

Commit ad3361a

Browse files
committed
Merge branch 'release-v2.0.5' into release
2 parents 26a24d0 + 461067e commit ad3361a

File tree

5 files changed

+19
-12
lines changed

5 files changed

+19
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Unreleased changes
22

3-
[Full changelog](https://github.com/mozilla/glean.js/compare/v2.0.4...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v2.0.5...main)
4+
5+
# v2.0.5 (2023-10-16)
6+
7+
[Full changelog](https://github.com/mozilla/glean.js/compare/v2.0.4...v2.0.5)
8+
9+
* [#1788](https://github.com/mozilla/glean.js/pull/1788): Fix `window` is undefined error when setting up browser debugging.
410

511
# v2.0.4 (2023-10-10)
612

glean/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glean/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mozilla/glean",
3-
"version": "2.0.4",
3+
"version": "2.0.5",
44
"description": "An implementation of the Glean SDK, a modern cross-platform telemetry client, for JavaScript environments.",
55
"type": "module",
66
"sideEffects": false,

glean/src/core/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const GLEAN_SCHEMA_VERSION = 1;
88
//
99
// PACKAGE_VERSION is defined as a global by webpack,
1010
// we need a default here for testing when the app is not build with webpack.
11-
export const GLEAN_VERSION = "2.0.4";
11+
export const GLEAN_VERSION = "2.0.5";
1212

1313
// The name of a "ping" that will include Glean ping_info metrics,
1414
// such as ping sequence numbers.

glean/src/core/glean/sync.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type PlatformSync from "../../platform/sync.js";
88
import { CLIENT_INFO_STORAGE, KNOWN_CLIENT_ID } from "../constants.js";
99
import { Configuration } from "../config.js";
1010
import PingUploadManager from "../upload/manager/sync.js";
11-
import { extractBooleanFromString, isBoolean, isString, isUndefined, sanitizeApplicationId } from "../utils.js";
11+
import { extractBooleanFromString, isBoolean, isString, sanitizeApplicationId } from "../utils.js";
1212
import { CoreMetricsSync } from "../internal_metrics/sync.js";
1313
import { EventsDatabaseSync } from "../metrics/events_database/sync.js";
1414
import { DatetimeMetric } from "../metrics/types/datetime.js";
@@ -39,7 +39,7 @@ type DebugOptionValue = keyof typeof DebugOption;
3939
const setDebugOptionInSessionStorage = (option: DebugOptionValue, value: boolean | string | string[]) => {
4040
const key = `Glean.${option.toString()}`;
4141

42-
switch(option) {
42+
switch (option) {
4343
case DebugOption.DebugTag:
4444
sessionStorage.setItem(key, value as string);
4545
break;
@@ -48,6 +48,7 @@ const setDebugOptionInSessionStorage = (option: DebugOptionValue, value: boolean
4848
break;
4949
case DebugOption.SourceTags:
5050
sessionStorage.setItem(key, (value as string[]).join(","));
51+
break;
5152
}
5253
};
5354

@@ -183,22 +184,22 @@ namespace Glean {
183184
*/
184185
function setDebugOptionsFromSessionStorage() {
185186
// If we cannot access browser APIs, we do nothing.
186-
if (isUndefined(window) || isUndefined(window.sessionStorage)) {
187+
if (typeof window === "undefined" || typeof window.sessionStorage === "undefined") {
187188
return;
188189
}
189190

190191
const logPings = getDebugOptionFromSessionStorage(DebugOption.LogPings);
191-
if (!isUndefined(logPings)) {
192+
if (logPings) {
192193
preInitLogPings = extractBooleanFromString(logPings);
193194
}
194195

195196
const debugViewTag = getDebugOptionFromSessionStorage(DebugOption.DebugTag);
196-
if (!isUndefined(debugViewTag)) {
197+
if (debugViewTag) {
197198
preInitDebugViewTag = debugViewTag;
198199
}
199200

200201
const sourceTags = getDebugOptionFromSessionStorage(DebugOption.SourceTags);
201-
if (!isUndefined(sourceTags)) {
202+
if (sourceTags) {
202203
preInitSourceTags = sourceTags.split(",");
203204
}
204205
}
@@ -512,7 +513,7 @@ declare global {
512513
}
513514

514515
// Only set `Glean` values whenever running inside of a browser.
515-
if (!isUndefined(window) && !isUndefined(window.sessionStorage)) {
516+
if (typeof window !== "undefined" && typeof window.sessionStorage !== "undefined") {
516517
window.Glean = {
517518
setLogPings: (flag: boolean) => {
518519
setDebugOptionInSessionStorage(DebugOption.LogPings, flag);

0 commit comments

Comments
 (0)