Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(recent-list) do not store room when inside an iframe

Saúl Ibarra Corretgéd9eedb0dadd8
diff --git a/config.js b/config.js
index 3f14ab3c7f..8e2dca3214 100644
--- a/config.js
+++ b/config.js
@@ -1009,7 +1009,8 @@ var config = {
// Disables all invite functions from the app (share, invite, dial out...etc)
// disableInviteFunctions: true,
- // Disables storing the room name to the recents list
+ // Disables storing the room name to the recents list. When in an iframe this is ignored and
+ // the room is never stored in the recents list.
// doNotStoreRoom: true,
// Deployment specific URLs.
diff --git a/react/features/analytics/functions.js b/react/features/analytics/functions.js
index 65ffd62b4b..950a4d2b13 100644
--- a/react/features/analytics/functions.js
+++ b/react/features/analytics/functions.js
@@ -12,6 +12,7 @@ import JitsiMeetJS, {
} from '../base/lib-jitsi-meet';
import { isAnalyticsEnabled } from '../base/lib-jitsi-meet/functions';
import { getJitsiMeetGlobalNS, loadScript, parseURIString } from '../base/util';
+import { inIframe } from '../base/util/iframeUtils';
import { AmplitudeHandler, MatomoHandler } from './handlers';
import logger from './logger';
@@ -221,24 +222,6 @@ export function initAnalytics({ getState }: { getState: Function }, handlers: Ar
}
}
-/**
- * Checks whether we are loaded in iframe.
- *
- * @returns {boolean} Returns {@code true} if loaded in iframe.
- * @private
- */
-export function inIframe() {
- if (navigator.product === 'ReactNative') {
- return false;
- }
-
- try {
- return window.self !== window.top;
- } catch (e) {
- return true;
- }
-}
-
/**
* Tries to load the scripts for the external analytics handlers and creates them.
*
diff --git a/react/features/base/jitsi-local-storage/setup.web.js b/react/features/base/jitsi-local-storage/setup.web.js
index 52c1e251b0..ae1659adda 100644
--- a/react/features/base/jitsi-local-storage/setup.web.js
+++ b/react/features/base/jitsi-local-storage/setup.web.js
@@ -4,6 +4,7 @@ import Bourne from '@hapi/bourne';
import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
import { browser } from '../lib-jitsi-meet';
+import { inIframe } from '../util/iframeUtils';
import { parseURLParams } from '../util/parseURLParams';
import logger from './logger';
@@ -11,19 +12,6 @@ import logger from './logger';
declare var APP: Object;
declare var config: Object;
-/**
- * Checks whether we are loaded in an iframe.
- *
- * @returns {boolean} Returns {@code true} if loaded in iframe.
- * @private
- */
-function _inIframe() {
- try {
- return window.self !== window.top;
- } catch (e) {
- return true;
- }
-}
/**
* Handles changes of the fake local storage.
@@ -55,7 +43,7 @@ function shouldUseHostPageLocalStorage(urlParams) {
return true;
}
- if (browser.isWebKitBased() && _inIframe()) {
+ if (browser.isWebKitBased() && inIframe()) {
// WebKit browsers don't persist local storage for third-party iframes.
return true;
diff --git a/react/features/base/util/iframeUtils.ts b/react/features/base/util/iframeUtils.ts
new file mode 100644
index 0000000000..44616cb25b
--- /dev/null
+++ b/react/features/base/util/iframeUtils.ts
@@ -0,0 +1,16 @@
+/**
+ * Checks whether we are loaded in iframe.
+ *
+ * @returns Whether the current page is loaded in an iframe.
+ */
+export function inIframe(): boolean {
+ if (navigator.product === 'ReactNative') {
+ return false;
+ }
+
+ try {
+ return window.self !== window.top;
+ } catch (e) {
+ return true;
+ }
+}
diff --git a/react/features/recent-list/middleware.js b/react/features/recent-list/middleware.js
index 53e509d946..aba036198a 100644
--- a/react/features/recent-list/middleware.js
+++ b/react/features/recent-list/middleware.js
@@ -9,6 +9,7 @@ import {
import { addKnownDomains } from '../base/known-domains';
import { MiddlewareRegistry } from '../base/redux';
import { parseURIString } from '../base/util';
+import { inIframe } from '../base/util/iframeUtils';
import { _storeCurrentConference, _updateConferenceDuration } from './actions';
import { isRecentListEnabled } from './functions';
@@ -88,7 +89,7 @@ function _appWillMount({ dispatch, getState }, next, action) {
function _conferenceWillLeave({ dispatch, getState }, next, action) {
const { doNotStoreRoom } = getState()['features/base/config'];
- if (!doNotStoreRoom) {
+ if (!doNotStoreRoom && !inIframe()) {
let locationURL;
/**
@@ -128,7 +129,7 @@ function _conferenceWillLeave({ dispatch, getState }, next, action) {
function _setRoom({ dispatch, getState }, next, action) {
const { doNotStoreRoom } = getState()['features/base/config'];
- if (!doNotStoreRoom && action.room) {
+ if (!doNotStoreRoom && !inIframe() && action.room) {
const { locationURL } = getState()['features/base/connection'];
if (locationURL) {