[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/reference.html loleaflet/src wsd/DocumentBroker.cpp
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri May 3 15:55:13 UTC 2019
loleaflet/reference.html | 5 +++--
loleaflet/src/core/Socket.js | 11 +++++++++++
wsd/DocumentBroker.cpp | 11 ++++++++++-
3 files changed, 24 insertions(+), 3 deletions(-)
New commits:
commit 5cd5fb1c33f0e1b6df280d6fd78b163e0ea44471
Author: Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Apr 26 12:06:17 2019 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Fri May 3 17:54:49 2019 +0200
Handle storage load errors
Pass information about storage loading failures
to the wopi host.
Change-Id: I8da3a80e47b15f246343dc8e4199d8f860e1fb8a
Reviewed-on: https://gerrit.libreoffice.org/71526
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index 58bdb351b..2fb7c801f 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -2765,10 +2765,11 @@ Editor to WOPI host
can be shown. <br/>
Accompanying keys: <i>Features</i>: This client's capabilities.
Supported values are: <i>VersionStates</i>. Tells the host that client supports different version states. See <a href="#loleaflet-postmessage-versioning">Version Restore</a> for more details.<br/>
- When Status is Document_Loaded, document has been completely
+ When Status is <i>Document_Loaded</i>, document has been completely
loaded and host can also start using PostMessage API.<br/>
Accompanying keys:
- <i>DocumentLoadedTime</i>
+ <i>DocumentLoadedTime</i><br/>
+ When Status is <i>Failed</i>, document hasn't been loaded but host can show the loleaflet frame to present an error for a user.
</td>
</tr>
</table>
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index a73c71e00..0e27a7096 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -307,6 +307,17 @@ L.Socket = L.Class.extend({
this._map.fire('wopiprops', wopiInfo);
return;
}
+ else if (textMsg.startsWith('loadstorage: ')) {
+ if (textMsg.substring(textMsg.indexOf(':') + 2) === 'failed') {
+ console.debug('Loading document from a storage failed');
+ this._map.fire('postMessage', {
+ msgId: 'App_LoadingStatus',
+ args: {
+ Status: 'Failed'
+ }
+ });
+ }
+ }
else if (textMsg.startsWith('lastmodtime: ')) {
var time = textMsg.substring(textMsg.indexOf(' '));
this._map.updateModificationIndicator(time);
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index b6d6bef07..191c76ce8 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -492,7 +492,16 @@ bool DocumentBroker::load(const std::shared_ptr<ClientSession>& session, const s
const Poco::URI& uriPublic = session->getPublicUri();
LOG_DBG("Loading, and creating new storage instance for URI [" << LOOLWSD::anonymizeUrl(uriPublic.toString()) << "].");
- _storage = StorageBase::create(uriPublic, jailRoot, jailPath.toString());
+ try
+ {
+ _storage = StorageBase::create(uriPublic, jailRoot, jailPath.toString());
+ }
+ catch (...)
+ {
+ session->sendMessage("loadstorage: failed");
+ throw;
+ }
+
if (_storage == nullptr)
{
// We should get an exception, not null.
More information about the Libreoffice-commits
mailing list