Selaa lähdekoodia

fix(local-storage) use local storage on WebKit when not in an iframe

There should be no need to use the workaround when visiting the site normally.
master
Saúl Ibarra Corretgé 4 vuotta sitten
vanhempi
commit
11382cfda6
1 muutettua tiedostoa jossa 17 lisäystä ja 1 poistoa
  1. 17
    1
      react/features/base/jitsi-local-storage/setup.web.js

+ 17
- 1
react/features/base/jitsi-local-storage/setup.web.js Näytä tiedosto

11
 declare var APP: Object;
11
 declare var APP: Object;
12
 declare var config: Object;
12
 declare var config: Object;
13
 
13
 
14
+/**
15
+ * Checks whether we are loaded in an iframe.
16
+ *
17
+ * @returns {boolean} Returns {@code true} if loaded in iframe.
18
+ * @private
19
+ */
20
+ function _inIframe() {
21
+    try {
22
+        return window.self !== window.top;
23
+    } catch (e) {
24
+        return true;
25
+    }
26
+}
27
+
14
 /**
28
 /**
15
  * Handles changes of the fake local storage.
29
  * Handles changes of the fake local storage.
16
  *
30
  *
41
         return true;
55
         return true;
42
     }
56
     }
43
 
57
 
44
-    if (browser.isWebKitBased()) { // Webkit browsers don't persist local storage for third-party iframes.
58
+    if (browser.isWebKitBased() && _inIframe()) {
59
+        // WebKit browsers don't persist local storage for third-party iframes.
60
+
45
         return true;
61
         return true;
46
     }
62
     }
47
 
63
 

Loading…
Peruuta
Tallenna