Skip to content

Commit 1b6e44d

Browse files
committed
Merge branch 'release-v5.0.5' into release
2 parents adc8cf0 + d42bb56 commit 1b6e44d

File tree

8 files changed

+45
-21
lines changed

8 files changed

+45
-21
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ commands:
1616
parameters:
1717
python-version:
1818
type: string
19-
default: "3.9.4"
19+
default: "3.13"
2020
jobs:
2121
spellcheck:
2222
docker:
@@ -72,7 +72,7 @@ jobs:
7272
- run:
7373
name: Install Firefox related dependencies
7474
command: |
75-
sudo add-apt-repository ppa:ubuntu-mozilla-daily/ppa
75+
sudo add-apt-repository -y ppa:ubuntu-mozilla-daily/ppa
7676
sudo apt update
7777
sudo apt install firefox-trunk
7878
- run:

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/v5.0.4...main)
3+
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.5...main)
4+
5+
# v5.0.5 (2025-07-17)
6+
7+
* [#1993](https://github.com/mozilla/glean.js/pull/1993): Add try-catch around uses of sessionStorage and localStorage in core.
8+
9+
[Full changelog](https://github.com/mozilla/glean.js/compare/v5.0.4...v5.0.5)
410

511
# v5.0.4 (2025-04-02)
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": "5.0.4",
3+
"version": "5.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 = "5.0.4";
11+
export const GLEAN_VERSION = "5.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.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,20 @@ const setDebugOptionInSessionStorage = (
4747
) => {
4848
const key = `Glean.${option.toString()}`;
4949

50-
switch (option) {
51-
case DebugOption.DebugTag:
52-
sessionStorage.setItem(key, value as string);
53-
break;
54-
case DebugOption.LogPings:
55-
sessionStorage.setItem(key, (value as boolean).toString());
56-
break;
57-
case DebugOption.SourceTags:
58-
sessionStorage.setItem(key, (value as string[]).join(","));
59-
break;
50+
try {
51+
switch (option) {
52+
case DebugOption.DebugTag:
53+
sessionStorage.setItem(key, value as string);
54+
break;
55+
case DebugOption.LogPings:
56+
sessionStorage.setItem(key, (value as boolean).toString());
57+
break;
58+
case DebugOption.SourceTags:
59+
sessionStorage.setItem(key, (value as string[]).join(","));
60+
break;
61+
}
62+
} catch (e) {
63+
console.warn(e);
6064
}
6165
};
6266

@@ -69,7 +73,12 @@ const setDebugOptionInSessionStorage = (
6973
const getDebugOptionFromSessionStorage = (
7074
option: DebugOptionValue
7175
): string | undefined => {
72-
return sessionStorage.getItem(`Glean.${option.toString()}`) || undefined;
76+
try {
77+
return sessionStorage.getItem(`Glean.${option.toString()}`) || undefined;
78+
} catch (e) {
79+
console.warn(e);
80+
return undefined;
81+
}
7382
};
7483

7584
namespace Glean {

glean/src/core/internal_metrics.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,12 @@ export class CoreMetrics {
209209
this.generateNewSession();
210210
}
211211

212-
// Update the last-active timestamp in LocalStorage to the current time.
213-
localStorage.setItem("glean_session_last_active", Date.now().toString());
212+
try {
213+
// Update the last-active timestamp in LocalStorage to the current time.
214+
localStorage.setItem("glean_session_last_active", Date.now().toString());
215+
} catch (e) {
216+
console.warn(e);
217+
}
214218
}
215219

216220
/**

glean/src/core/sessions.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
* @returns {boolean} If the current session is inactive.
1010
*/
1111
export function isSessionInactive(sessionLengthInMinutes = 30): boolean {
12-
const lastActive = localStorage.getItem("glean_session_last_active");
12+
let lastActive: string | null = null;
13+
try {
14+
lastActive = localStorage.getItem("glean_session_last_active");
15+
} catch (e) {
16+
console.warn(e);
17+
}
1318
const lastActiveDate = new Date(Number(lastActive));
1419

1520
// Subtract the session length from the current date.

0 commit comments

Comments
 (0)