Commit graph

4113 commits

Author SHA1 Message Date
Pranav Kant
25db37484c tdf#103697: Fix color value for spreadsheets and presentations
Change-Id: I89f871f829abd847321bee927b98e9a96e8babbb
2016-11-11 16:22:44 +05:30
Pranav Kant
dacf16f2d8 tdf#103671: 'true' -> true
Treat booleans as booleans, not string

Change-Id: Id0d3bee44b42461671379754e64e5e2f9b318045
2016-11-10 23:06:15 +05:30
Pranav Kant
d060b242e8 More documentation about post message API
Change-Id: I362e159c32d2ea93139be58ca647a2f4c5678dee
2016-11-10 22:37:38 +05:30
Pranav Kant
08a365302e loleaflet: Fix browser print
Accessing the parent iframe, atleast on my local box, where
parent frame and loleaflet frame have different origin, is not
allowed by browser security policy.

Change-Id: Ia3a356fa1d8a81f38bbc27d256471302be8b6729
2016-11-10 22:03:17 +05:30
Pranav Kant
e850ac836f tdf#103641: Another Post message API - Get_Export_Formats
Change-Id: I8a502d3c88c83cc7fb6c3113522ed637bf349a0e
2016-11-10 22:03:17 +05:30
Pranav Kant
5219baaab0 tdf#103641: WOPI: Implement Action_Save, Action_Print, Action_Export
WOPI hosts can now send above mentioned messages to loleaflet so
that loleaflet does stuff accordingly.

Change-Id: I50e10a62c5b629bd12f7d9ce51bcd13cb13cdd8a
2016-11-10 22:03:17 +05:30
Pranav Kant
9bfd5a512e loleaflet: Factor out save uno command
Change-Id: I155329f9dfa37cb47cbac34aa885b3d7a0cbb573
2016-11-10 22:03:17 +05:30
Pranav Kant
2168617d60 tdf#103641: Implement ability to hide save, print, export options
Add more WOPI extensions for this - HidePrintOption,
HideSaveOption, HideExportOption. Setting HideExportOption to
'true' in WOPI CheckFileInfo response would hide the 'Download
as' option from the File menu.

Change-Id: Ia2259ee9525cc6c4331a52e2221af4df188eab07
2016-11-10 22:03:17 +05:30
Pranav Kant
9c5928a87b tdf#103641: Convert 'wopi:' message to JSON formatted message
... to accomdate other WOPI properties easily in future.

Change-Id: Ic92364f06f4f16ebe8f9f128cd49087f6d72a4d1
2016-11-10 22:03:17 +05:30
Pranav Kant
7cacabad40 loleaflet: Give id to these menu items
So that it is easy to manipulate them in future by their
identifier.

Change-Id: I252aa448c26c23a00f0a3e717e1603b0d0277e67
2016-11-10 22:03:17 +05:30
Pranav Kant
df50c8fd34 loleaflet: Fix some silliness
Change-Id: I8977d2f3a569d2442c34248a9b86fec9761fb0e2
2016-11-10 22:03:17 +05:30
Jan Holesovsky
b8b469c9b2 Block when working via http.
It looks like that the implementation details of POCO are thread-unsafe when
in non-blocking mode, and that is even when the actual sending of the frames
is guarded by a mutex.

Needs more research; but for the moment, enable non-blocking mode for HTTP.

Change-Id: Idcce3fb55bae73c17d9fc321a2273256c0396664
2016-11-10 13:12:56 +01:00
Pranav Kant
b1cec28cc3 This was only meant for debugging.
Change-Id: Ia31847ab45c1aa18b5d9d4187ac552d7486331e7
2016-11-10 16:30:38 +05:30
Andras Timar
4526d54d58 add LOOLWebSocket.hpp to dist tarball 2016-11-10 11:01:33 +01:00
Jan Holesovsky
0674e87831 Implement a thread-safe websocket inherited from Poco::Net::WebSocket.
sendFrame() implemented in LOOLWebSocket is thread safe, and also deals with
large messages - sends the "nextmessage: size=..." frame before the actual
large frame.

The problem this is attempting to solve was that when sending a large frame,
it was split to multiple packets.  During that, another frame was sent from a
different thread; which lead to confusion, and the resulting frame was
corrupted (because it ended up composed from unrelated packets).

Change-Id: Ie85952e431b1cad2fdc6e3c64df8a444ea0ae971
2016-11-10 10:44:48 +01:00
Pranav Kant
b0933b063e tdf#103640: Implement OwnerTermination; send application-level close frame
This implements a new feature 'OwnerTermination' for WOPI based
hosts. WOPI hosts now have to enable this feature by mentioning
'EnableOwnerTermination' as 'true' in their CheckFileInfo
response. If the OwnerId of the file matches that of the UserId
of the session, this session would be able to terminate all other
sessions currently editing the same document.

The reason for this kind of document termination is sent to all
sessions in a new application-level 'close:' message. This new message is
similar to the CLOSE frame of WebSocket protocol which doesn't
seem to work across all browsers as of now. Eg: Chrome -
https://bugs.chromium.org/p/chromium/issues/detail?id=426798
After receiving this 'close: ' message, loleaflet acts
accordingly and tells the WOPI host why the websocket was closed
via post message API.

Change-Id: I997aa2e7805157ed599a3946a877fd32477cee1b
2016-11-10 15:04:21 +05:30
Pranav Kant
410936b600 loolwsd: This is not used anymore
Change-Id: I7a0405faad5a2c1e15788c084d51bb6a4a39f82f
2016-11-10 14:45:20 +05:30
Pranav Kant
a6d2fe80a1 loolwsd: Read and store session owner ids
Change-Id: If905344475eb6d9585eaa5a1df6882dc3a7bdb2b
2016-11-10 14:45:20 +05:30
Pranav Kant
7f77618f38 Document PostMessage API in reference.html
Change-Id: Ibdd3fc060a99f3b6185362fa3143014710873079
2016-11-10 14:45:20 +05:30
Pranav Kant
1a1792cdc1 loleaflet: Group map getters together
Change-Id: I576f78aaa215b6ba3aff6a5ce8498a3449080927
2016-11-10 14:45:20 +05:30
Pranav Kant
f1f5c4ed66 loleaflet: A more OO approach for WOPI post message API
Abstract all the WOPI related logic in a map handler which is
enabled only if map.options.wopi is set during map
initialization.

Change-Id: I54c5d6eecf33f88e4fd4d2b5ac9e8cf9dd001966
2016-11-10 14:45:17 +05:30
Ashod Nakashian
8b5f112ebf loolwsd: recover when forkit dies
Change-Id: Idc1e08fb496d3c68b22e1d8eab2da9a9064ef070
Reviewed-on: https://gerrit.libreoffice.org/30743
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-10 05:17:15 +00:00
Ashod Nakashian
4c6aae20d5 loolwsd: don't error when killing a dead child process
Change-Id: I615911fb40a5218a6d1992dd94b63bff428699ee
Reviewed-on: https://gerrit.libreoffice.org/30742
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-10 05:16:23 +00:00
Ashod Nakashian
c5bff2b6e6 loolwsd: IoUtil logs updated
Change-Id: I632968753673089e8199b37a11f73286f88b20f4
Reviewed-on: https://gerrit.libreoffice.org/30741
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-10 05:15:38 +00:00
Ashod Nakashian
d5d31055c7 loolwsd: Admin formatting and cleanup
Change-Id: I0c0a9800bdd0a8ad1b652f8c5c05dc529ef04fe4
Reviewed-on: https://gerrit.libreoffice.org/30740
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-10 05:07:21 +00:00
Ashod Nakashian
793e00e134 loolwsd: use ostringstream when concatinating many strings
Change-Id: I55d4d0a14c81977568032d8a7dd1655b2f69ae67
Reviewed-on: https://gerrit.libreoffice.org/30739
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-10 05:02:02 +00:00
László Németh
8ef5c5fa36 loleaflet: hide debug control in disabled tile debug mode 2016-11-09 12:16:46 +01:00
Ashod Nakashian
462f71a632 loolwsd: no need to ping to check for live socket
Ping message needs to be echoed and that messes
up reading large messages that come in two parts.

Luckily, it's not necessary to do so as it's
sufficient to poll the state of the socket.

It's true polling is less accurate as there is
a timeout when a socket is disconnected, but
that doesn't seem to be an issue in practice.

Change-Id: I7a5744a621c4416b8f9d003871f6d613cc6ca7dc
Reviewed-on: https://gerrit.libreoffice.org/30705
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-09 06:07:38 +00:00
Andras Timar
7f80400dea loleaflet: typo: No-with -> No-width 2016-11-09 00:28:27 +01:00
Andras Timar
937d8754b7 Updated Slovenian translation 2016-11-09 00:27:13 +01:00
Jan Holesovsky
024a6048a0 Move sendLargeFrame() from Util to IoUtil.
Change-Id: Id5db865b0bcf936651e3c89a0333a101e58ace92
2016-11-08 19:57:03 +01:00
Jan Holesovsky
5f6858f782 Factor out creation of nextmessage: and improve its logging.
Change-Id: I552bc2599835b4f6c9d4ef423889b464c5701221
2016-11-08 18:25:46 +01:00
Jan Holesovsky
66053621bd Make sure we resize the payload to the amount of read bytes.
Change-Id: I33f032182912b4f03d073258c91974518db327fd
2016-11-08 14:54:15 +01:00
Andras Timar
127b39d5b6 fix l10n of word count (thousand separator!) 2016-11-08 14:25:18 +01:00
Ashod Nakashian
d978dc83cf loolwsd: minor improvement to logging while running tests
Change-Id: Id602e52ceb42923f19d902f653e2d6477b8b8e1f
Reviewed-on: https://gerrit.libreoffice.org/30676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-08 00:21:53 +00:00
Ashod Nakashian
0164df61a5 loolwsd: alertAllUsersOfDocument must be called while holding lock
Change-Id: I266a61402973c9418eb293d2f66601d00be76754
Reviewed-on: https://gerrit.libreoffice.org/30675
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-08 00:21:37 +00:00
Ashod Nakashian
d8c2bb9195 loolwsd: minimize holding locks beyond the necessary point
Change-Id: I379a649469622682d7ebe98b8a7ebe29eddd1dfa
Reviewed-on: https://gerrit.libreoffice.org/30674
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-08 00:21:18 +00:00
Andras Timar
7b83a5f90b loleaflet: update pot file 2016-11-07 18:52:50 +01:00
Andras Timar
b4dd01a3c8 loleaflet: update uno command translations 2016-11-07 18:51:25 +01:00
Andras Timar
f6a694716c loolwsd: copy 'debian' dir to tarball, silence tar 2016-11-07 15:20:01 +01:00
Pranav Kant
5f9a9264e4 Fix menubar l10n, set String.locale before requiring loleaflet
Change-Id: Ic5a22f05d0a11bd0485d0c88dfa34dcc6bfe29cf
2016-11-07 17:59:42 +05:30
Pranav Kant
9f65377c42 getViewIdHexColor -> getViewIdColor
This doesn't return a hex value anymore, it returns a rgb
integer.

Change-Id: I2fc234d7ba09e7b750c63dd9cf93356d02707fce
2016-11-07 17:31:15 +05:30
Miklos Vajna
121a471203 loolwsd: clean up unused using declarations
Change-Id: Ib7fc0d2dbc10cbccacde327b29fe70f255d58a05
2016-11-07 08:27:19 +01:00
Ashod Nakashian
ea0e5e9344 loolwsd: echo the unit-test command-line before running
Change-Id: Ib061732bccd18112c5d3842c01e8d20d441816c0
Reviewed-on: https://gerrit.libreoffice.org/30647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:43:29 +00:00
Ashod Nakashian
2507f7f89c loolwsd: refactor DocumentBroker load and addSession
Change-Id: I01db44561f79280f152bdf802efcbc064b22ab89
Reviewed-on: https://gerrit.libreoffice.org/30646
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:43:12 +00:00
Ashod Nakashian
f3ffd59860 loolwsd: assert ChildProcess doesn't destroy DocumentBroker
Change-Id: Iff20323f809f255557e05652ba08f7688b823fe1
Reviewed-on: https://gerrit.libreoffice.org/30645
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:42:40 +00:00
Ashod Nakashian
f669891892 loolwsd: name the child socket thread
Change-Id: I079d821522b016cbd70a958b6a3e908a32b61f37
Reviewed-on: https://gerrit.libreoffice.org/30644
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:41:22 +00:00
Ashod Nakashian
a1d846b431 loolwsd: correct wsd initialization and preconditions
For unit-tests at least listening to the public port before
having forked forkit, let alone having a single child process
ready, means we could starve and fail tests randomly.

Here we first correct the order of initialization, such that
the public port listening happens last. Second, we wait until
we have at least one child successfully connected and ready.

Change-Id: I7a31ad1ca4b30746f3cbf9c6b315670207cb7716
Reviewed-on: https://gerrit.libreoffice.org/30643
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:40:43 +00:00
Ashod Nakashian
86fb4dc03b loolwsd: extend the lifetime of lokit to avoid destroying
Lokit's destroy is prone to throw (at least in dbgutil).

This exception brings the binary down with a core-dump.

To avoid this, we extend the lifetime of lokit to the end
of the process, where we invoke std::_Exit to promptly
kill the process and exit.

For reference, the exception is thrown as follows:
 #0  0x00007f0ba5a43bcd in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
 #1  0x00007f0b76303248 in (anonymous namespace)::ModuleManager::identify (this=0x7f0b5328e6d0, xModule=empty uno::Reference) at /home/ash/prjx/cp51/framework/source/services/modulemanager.cxx:198
 #2  0x00007f0b762606dc in (anonymous namespace)::JobExecutor::notifyEvent (this=0x7f0b77176b30, aEvent=...) at /home/ash/prjx/cp51/framework/source/jobs/jobexecutor.cxx:274
 #3  0x00007f0ba13ea455 in (anonymous namespace)::SfxGlobalEvents_Impl::implts_notifyJobExecution (this=0x7f0b77176a30, aEvent=...) at /home/ash/prjx/cp51/sfx2/source/notify/globalevents.cxx:397
 #4  0x00007f0ba13e9346 in (anonymous namespace)::SfxGlobalEvents_Impl::documentEventOccured (this=0x7f0b77176a30, _Event=...) at /home/ash/prjx/cp51/sfx2/source/notify/globalevents.cxx:241
 #5  0x00007f0ba0fe5717 in SfxTerminateListener_Impl::notifyTermination (this=0x7f0b772462c8, aEvent=...) at /home/ash/prjx/cp51/sfx2/source/appl/appinit.cxx:125
 #6  0x00007f0b762ebc39 in framework::Desktop::terminate (this=0x7f0b7721d530) at /home/ash/prjx/cp51/framework/source/services/desktop.cxx:330
 #7  0x00007f0ba47940ce in lo_destroy (pThis=0x154de60) at /home/ash/prjx/cp51/desktop/source/lib/init.cxx:2926
 #8  0x0000000000429681 in lok::Office::~Office (this=<optimized out>, __in_chrg=<optimized out>) at LibreOfficeKit.hpp:516
 #9  __gnu_cxx::new_allocator<lok::Office>::destroy<lok::Office> (this=<optimized out>, __p=<optimized out>) at /usr/include/c++/5/ext/new_allocator.h:124
 #10 std::allocator_traits<std::allocator<lok::Office> >::_S_destroy<lok::Office> (__p=<optimized out>, __a=...) at /usr/include/c++/5/bits/alloc_traits.h:285
 #11 std::allocator_traits<std::allocator<lok::Office> >::destroy<lok::Office> (__a=..., __p=<optimized out>) at /usr/include/c++/5/bits/alloc_traits.h:414
 #12 std::_Sp_counted_ptr_inplace<lok::Office, std::allocator<lok::Office>, (__gnu_cxx::_Lock_policy)2>::_M_dispose (this=0xb04f40) at /usr/include/c++/5/bits/shared_ptr_base.h:531
 #13 0x000000000042dfb6 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0xb04f40) at /usr/include/c++/5/bits/shared_ptr_base.h:150
 #14 0x0000000000425797 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x7ffce7430468, __in_chrg=<optimized out>) at /usr/include/c++/5/bits/shared_ptr_base.h:659
 #15 std::__shared_ptr<lok::Office, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x7ffce7430460, __in_chrg=<optimized out>) at /usr/include/c++/5/bits/shared_ptr_base.h:925
 #16 std::shared_ptr<lok::Office>::~shared_ptr (this=0x7ffce7430460, __in_chrg=<optimized out>) at /usr/include/c++/5/bits/shared_ptr.h:93
 #17 lokit_main (childRoot="/home/ash/prj/lo/online/loolwsd/test/../jails/", sysTemplate="/home/ash/prj/lo/online/loolwsd/test/../systemplate", loTemplate="/home/ash/prj/lo/instdir", loSubPath="lo", noCapabilities=<optimized out>, queryVersion=queryVersion@entry=true, displayVersion=false) at LOOLKit.cpp:1441
 #18 0x000000000041df41 in createLibreOfficeKit (childRoot="/home/ash/prj/lo/online/loolwsd/test/../jails/", sysTemplate="/home/ash/prj/lo/online/loolwsd/test/../systemplate", loTemplate="/home/ash/prj/lo/instdir", loSubPath="lo", queryVersion=queryVersion@entry=true) at LOOLForKit.cpp:228
 #19 0x000000000041aea4 in main (argc=7, argv=0x7ffce7431ec8) at LOOLForKit.cpp:389

194         {
195             throw css::lang::IllegalArgumentException(
196                     OUString("Given module is not a frame nor a window, controller or model."),
197                     static_cast< ::cppu::OWeakObject* >(this),
198                     1);
199         }

Change-Id: Idaef5e0a28021a73f4c03ee3bee80968d9c57bd5
Reviewed-on: https://gerrit.libreoffice.org/30642
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:39:22 +00:00
Ashod Nakashian
8cd8ca27a6 loolwsd: new 'exit' command to request child process termination
Change-Id: Id3f9bc67096b422630e04f59ed4ccbca012ddd4a
Reviewed-on: https://gerrit.libreoffice.org/30641
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-07 06:38:39 +00:00