[Libreoffice-commits] online.git: loleaflet/reference.html loleaflet/src wsd/DocumentBroker.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon May 6 12:01:46 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 e62cdfae828bce64ab17ccce6620500a99236110
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Fri Apr 26 12:06:17 2019 +0200
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Mon May 6 14:01:26 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/71354
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos 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 d1a09583d..7f45eb73a 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -281,6 +281,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(' ') + 1);
 			this._map.updateModificationIndicator(time);
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 40465c0ce..4b0390ce9 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -480,7 +480,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