Merge pull request #816 from semmel/semmel-inaccessible-localStorage

Tolerate inaccessible localStorage
pull/819/head
Pablo Fuente Pérez 2023-08-21 13:13:29 +02:00 committed by GitHub
commit 2f2001490a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -121,7 +121,13 @@ export class WebRtcStats {
}
public initWebRtcStats(): void {
const webrtcObj = localStorage.getItem(this.STATS_ITEM_NAME);
let webrtcObj = null;
// When cross-site (aka third-party) cookies are blocked by the browser,
// accessing localStorage in a third-party iframe throws a DOMException.
try {
webrtcObj = localStorage.getItem(this.STATS_ITEM_NAME);
}
catch(e){}
if (!!webrtcObj) {
this.webRtcStatsEnabled = true;