@@ -8,7 +8,7 @@ import type PlatformSync from "../../platform/sync.js";
88import { CLIENT_INFO_STORAGE , KNOWN_CLIENT_ID } from "../constants.js" ;
99import { Configuration } from "../config.js" ;
1010import 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" ;
1212import { CoreMetricsSync } from "../internal_metrics/sync.js" ;
1313import { EventsDatabaseSync } from "../metrics/events_database/sync.js" ;
1414import { DatetimeMetric } from "../metrics/types/datetime.js" ;
@@ -39,7 +39,7 @@ type DebugOptionValue = keyof typeof DebugOption;
3939const 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