Commit 66237e3c authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: add compatibility for Firefox in private mode

Firefox disables IndexedDB in private mode.
Use memory storage in such case. This allows user to have a normal erp5js usage until the window is reloaded.
parent 72046a82
...@@ -387,8 +387,14 @@ ...@@ -387,8 +387,14 @@
.push(function (result) { .push(function (result) {
setting_gadget = result; setting_gadget = result;
return setting_gadget.createJio({ return setting_gadget.createJio({
type: "fallback",
sub_storage: {
type: "indexeddb", type: "indexeddb",
database: "setting" database: "setting"
},
fallback_storage: {
type: "memory"
}
}); });
}) })
.push(function () { .push(function () {
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>994.35438.36279.54937</string> </value> <value> <string>994.54001.34070.45704</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1630683787.8</float> <float>1631797534.82</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
/*global window, rJS, RSVP, document, jIO, URI, URL, Blob */ /*global window, rJS, RSVP, document, jIO, URI, URL, Blob, navigator */
/*jslint nomen: true, indent: 2 */ /*jslint nomen: true, indent: 2 */
(function (window, rJS, RSVP, loopEventListener, document, jIO, URI, URL, Blob) { (function (window, rJS, RSVP, loopEventListener, document, jIO, URI, URL, Blob,
navigator) {
"use strict"; "use strict";
// Keep reference of the latest allDocs params which reach to this view // Keep reference of the latest allDocs params which reach to this view
...@@ -1068,9 +1069,15 @@ ...@@ -1068,9 +1069,15 @@
gadget.props.jio_gadget = jio_gadget; gadget.props.jio_gadget = jio_gadget;
return jio_gadget.createJio({ return jio_gadget.createJio({
type: "sha", type: "sha",
sub_storage: {
type: "fallback",
sub_storage: { sub_storage: {
type: "indexeddb", type: "indexeddb",
database: "selection" database: "selection"
},
fallback_storage: {
type: "memory"
}
} }
}); });
}); });
...@@ -1081,9 +1088,15 @@ ...@@ -1081,9 +1088,15 @@
gadget.props.jio_navigation_gadget = jio_gadget; gadget.props.jio_navigation_gadget = jio_gadget;
return jio_gadget.createJio({ return jio_gadget.createJio({
type: "query", type: "query",
sub_storage: {
type: "fallback",
sub_storage: { sub_storage: {
type: "indexeddb", type: "indexeddb",
database: "navigation_history" database: "navigation_history"
},
fallback_storage: {
type: "memory"
}
} }
}); });
}); });
...@@ -1093,8 +1106,14 @@ ...@@ -1093,8 +1106,14 @@
.push(function (jio_gadget) { .push(function (jio_gadget) {
gadget.props.jio_state_gadget = jio_gadget; gadget.props.jio_state_gadget = jio_gadget;
return jio_gadget.createJio({ return jio_gadget.createJio({
type: "fallback",
sub_storage: {
type: "indexeddb", type: "indexeddb",
database: "document_state" database: "document_state"
},
fallback_storage: {
type: "memory"
}
}); });
}); });
}()), }()),
...@@ -1177,6 +1196,19 @@ ...@@ -1177,6 +1196,19 @@
gadget.props.keep_message = false; gadget.props.keep_message = false;
gadget.props.is_cancelled = false; gadget.props.is_cancelled = false;
return result; return result;
/*
})
.push(undefined, function (error) {
if (!navigator.onLine) {
console.log('not online');
// XXX couscous
return loopEventListener(window, 'online', false,
function backOnline() {
return location.reload();
});
}
throw error;
*/
}); });
} }
}); });
...@@ -1239,4 +1271,5 @@ ...@@ -1239,4 +1271,5 @@
false false
); );
}); });
}(window, rJS, RSVP, rJS.loopEventListener, document, jIO, URI, URL, Blob)); }(window, rJS, RSVP, rJS.loopEventListener, document, jIO, URI, URL, Blob,
\ No newline at end of file navigator));
\ No newline at end of file
...@@ -236,7 +236,7 @@ ...@@ -236,7 +236,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>991.63596.55319.30839</string> </value> <value> <string>994.53726.18332.61542</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -254,7 +254,7 @@ ...@@ -254,7 +254,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1620663195.92</float> <float>1631797697.91</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment