File tree Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Expand file tree Collapse file tree 2 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 22
33[ Full changelog] ( https://github.com/mozilla/glean.js/compare/v0.8.1...main )
44
5+ * [ #201 ] ( https://github.com/mozilla/glean.js/pull/201 ) : BUGFIX: Do not let the platform be changed after Glean is initialized.
6+
57# v0.8.1 (2021-04-14)
68
79[ Full changelog] ( https://github.com/mozilla/glean.js/compare/v0.8.0...v0.8.1 )
810
911* [ #206 ] ( https://github.com/mozilla/glean.js/pull/206 ) : BUGFIX: Fix ping URL path.
1012 * Application ID was being reporting as ` undefined ` .
1113
12- * [ #201 ] ( https://github.com/mozilla/glean.js/pull/201 ) : BUGFIX: Do not let the platform be changed after Glean is initialized.
1314# v0.8.0 (2021-04-13)
1415
1516[ Full changelog] ( https://github.com/mozilla/glean.js/compare/v0.7.0...v0.8.0 )
Original file line number Diff line number Diff line change @@ -443,14 +443,26 @@ class Glean {
443443 * Please check out the available environments in the platform/ module.
444444 */
445445 static setPlatform ( platform : Platform ) : void {
446+ // Platform can only be changed if Glean is uninitialized,
447+ // because Glean.initialize will make sure to recreate any
448+ // databases with the platform specific databases in this case.
449+ //
450+ // Users should only be able to replace the platform in testing situations,
451+ // if they call Glean.initialize before calling Glean.testResetGlean. We want
452+ // to replace whatever platform was set by Glean.initialize with the testing platforms
453+ // in this case.
446454 if ( Context . initialized ) {
447- console . info (
448- "Attempted to set the platform but Glean has already been initialized. Ignoring." ,
449- `Current platform is: ${ Glean . platform . name } }`
450- ) ;
451455 return ;
452456 }
453457
458+ // In case platform is being swapped in the test scenario descrbied above,
459+ // we log a debug message about the change.
460+ if ( Glean . instance . _platform && Glean . instance . _platform . name !== platform . name ) {
461+ console . debug (
462+ `Changing Glean platform from "${ Glean . platform . name } " to "${ platform . name } ".`
463+ ) ;
464+ }
465+
454466 Glean . instance . _platform = platform ;
455467 }
456468
You can’t perform that action at this time.
0 commit comments