Commit graph

257 commits

Author SHA1 Message Date
Ashod Nakashian
6c18aa7e88 kit: anonymize usernames and filenames in Kit
Change-Id: Id7928136db71ded7bf6b1a5e8e387db7251f8a35
2018-10-16 20:12:23 -04:00
Ashod Nakashian
380c55d9eb wsd: disable tracing after initialization
The first child had tracing enabled even after
initial startup is completed. This would leak
user details when anonymization is enabled.

Change-Id: I5325e02d1a1078bff6640af85f5672b556c00aeb
2018-10-16 20:12:23 -04:00
Ashod Nakashian
f3d02cb9e2 wsd: support polling on client thread
Previously SocketPoll expected to be
running its own thread for polling.
This is unnecessary when we have a
spare thread (e.g. main) that can
(and should, for efficiency) be used
for polling rather than starting
dedicated thread.

Not starting the SocketPoll's thread
and calling SocketPoll::poll() directly
worked, the warning logs on each activity
notwithstanding.

The warnings aren't just noisy, they are
a performance drain as well, and signal
that something is wrong. The new code
now makes the API cleaner and avoids
unnecessary warning logs, while being
faster.

Change-Id: Ibf9a223c59dae6522a5fc2e5d84a8ef191b577b1
2018-10-16 20:12:23 -04:00
Ashod Nakashian
a7a03c3c5d wsd: send copied text to client upon .uno:Copy
Change-Id: I39181a0e29e00a0eae389fbab6ee253cf2f23f84
2018-10-16 20:12:23 -04:00
Tor Lillqvist
ef3e09728f Revert "Drop one use of TerminationFlag"
Turns out not to be useful for the iOS app after all.

This reverts commit bff5c17693.

Change-Id: I93367e9de1b6e66b1cbb7587259f1136564e53a4
2018-10-16 01:03:47 +03:00
Tor Lillqvist
c05079d6d5 Mention TerminationFlag in a couple more log lines
Why log something vague like "Stop flagged" when we can log what we
actually do?

Also, the log lines already include the name of the thread, so no need
to prefix with "Kit:".

Change-Id: I5a05492aa4e8a26714889cc6341a26862c80e4d0
2018-10-16 00:08:44 +03:00
Tor Lillqvist
bff5c17693 Drop one use of TerminationFlag
Doesn't help my current issue in the iOS app, but the less use of
TerminationFlag the better, I think. (Doesn't break 'make check' on
Linux.)

Change-Id: I8fef271d6e0e81dea92e0da76ecb7211239adab6
2018-10-15 17:59:40 +03:00
Tor Lillqvist
8ead4af199 Say "TerminationFlag" in logging when that is what we mean
We already did in other places.
2018-10-15 15:36:51 +03:00
Tor Lillqvist
7073d4feca Don't call std::_Exit() in the mobile app
Instead we should just exit the thread(s) that serve the document that
was being edited, and the app should return to showing the document
browser. (Or whatever we eventually will have as its state when the
user is not editing or viewing a document.) Work in progress.
2018-10-15 15:36:51 +03:00
Tor Lillqvist
ab54f21a54 Adapt to change in core: paintTile() now takes a buffer pointer also on iOS
Makes the code here a little bit simpler.
2018-10-10 16:31:38 +03:00
Tor Lillqvist
1f6eabafce Bin leftover verbose dump of part of a tile 2018-10-09 15:54:46 +03:00
Tamás Zolnai
07e99ad336 Fix tilesBeingRendered tracking by client
I changed the code in this commit:
c2a5f6acb0

To make kit send a tilecombine message even if it does not
send actual tile data so we can track that the rendering was
done and so we can update the clients' _tilesBeingRendered
list. The issue is that tileBeingRendered object
belongs to not only one client, but more and so we don't
know which client gets the actual empty tile response.

So revert this method and rather use a smaller timeout for "waiting" the
arrival of the rendered tile.

Change-Id: I2dbbab1a62b81cbbb5314f2f37fdbc3415c69130
2018-09-29 09:27:06 +02:00
Tor Lillqvist
f3786f5cb7 Pass correct argument on iOS as pBuffer to lok::Document::paintTile()
On iOS it shouldn't actually be pointer to a pixel char buffer, but a
craphics context reference. (This is how it has been since the
experimental TiledLibreOffice app, maybe five years ago? Sadly it
wasn't documented in the LibreOfficeKit include file. But it is how
LibreOfficeLight used the API, too.)

In TiledLibreOffice we rendered tiles directly into the CALayer of the
view. In this Online-based app we of course do render tiles into pixel
char buffers, just like in real Online, but we need to create bitmap
graphics contexts for them and pass that to paintTile().

Now I get white tiles, not totally zero-filled ones. But still no
document contents rendered.

I don't yet want to change the pBuffer parameter to actually be a
buffer pointer on iOS, too, like on other platforms. Also, changing it
will mean the LibreOfficeLight app would need changing, too, and I
don't feel like doing that. But ideally, sure, that should be done.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
7fd28d5676 Revert part of my iOS related commit, causes compilation warning with Clang
Won't actually be needed anyway, the way the code is going in my work
tree.

Change-Id: I4480ed59fe96ddcfad8483517f2a23452606f332
Reviewed-on: https://gerrit.libreoffice.org/60576
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-17 12:51:07 +02:00
Tor Lillqvist
87b85ff8f0 Be consistent in how we name "interface" abstract classes
We already use a suffix "Interface" for SocketHandlerInterface, so
rename IDocumentManager to DocumentManagerInterface.

Naming "interface" classes with an "I" prefix is C# and COM style.
Sure, that is a convention as good as any other, but let's try to be
consistent within this rather small code-base.

Change-Id: I9c356df327debd780f23ed2b2e6d6e630328861e
2018-09-12 19:27:23 +03:00
Tor Lillqvist
b59d160a08 Intermediate commit of work in progress on an iOS app
The app is unimaginatively called "Mobile" for now.

Runs but crashes pretty quickly after loading the document by the LO
core. Will need some heavy changes to get a ClientSession object
created in there, too, to handle the (emulated) WebSocket messages
from the JavaScript. It would then handle some of these messages
itself, and forwards some to the ChildSession, which in this case is
in the same process. Now the messsages from the JavaScript go to a
ChildSession, which is wrong. As the assertion says, "Tile traffic
should go through the DocumentBroker-LoKit WS"
2018-09-12 18:32:05 +03:00
Tor Lillqvist
290137c99b Bin unnecessary assert(loKit)
We already explicitly check earlier, after attempting to create it,
and log a fatal error and exit on failure.

Change-Id: Ia3fde4026839a255d4d19932300e16a05f9a33d2
2018-09-12 13:36:00 +03:00
Tor Lillqvist
d5f913486a Add a clarifying comment
Change-Id: Ia32b3ad65dd410e0f9f9d18c11be2d566ca0d6e0
2018-09-11 13:01:37 +03:00
Tor Lillqvist
3110bea2ea Add two missing values to kitCallbackTypeToString() 2018-09-10 19:55:29 +03:00
Tor Lillqvist
75438baa70 More mobile app stuff, very much early state of work in progress
Re-think Linux vs mobile ifdefs a bit. Use #ifdef __linux only to
surround code that actually is Linux-specific. Use #ifdef MOBILEAPP
for code that is for a mobile version (with no separste wsd, forkit,
and kit processes, and with no WebSocket protocol used).

Bypass UnitFoo for mobile. Possibly we do want the UnitFoo stuff after
all on mobile, to run in some special testing mode? Hard to say, let's
skipt it for now.
2018-09-10 15:13:43 +03:00
Miklos Vajna
9ed7c1065c common, kit, test, wsd: these parameters are copied for each invocation ...
... but passing by const ref is enough
2018-08-13 09:26:15 +02:00
Jan Holesovsky
ac7d67f43e Fix networking in the chroot.
The needed files were not copied, and consequently the hostname
resolution did not work in the chroot.

Change-Id: Id3dccc4f70cd1deeddb83c8e672f240e06748e34
2018-08-03 05:22:03 +02:00
Tamás Zolnai
c2a5f6acb0 Store number of tiles sent to kit for rendering
and use that info also to avoid sending to much tiles on the network.

Change-Id: Iab2d7af64693047a3c1cfe9f73de80a7100bbc13
2018-07-24 20:52:53 +02:00
Tor Lillqvist
a8b41b0cbb Log also when retrying the saveAs
Although, at least for me, after calling LOK's saveAs with an
intentionally bogus file extension 'file:///user/docs/u0.frobozz'
retrying with 'file:///user/docs/u0.frobozz.odt' does not work either.

Actually, I am not sure how useful this retry feature is as it is now.
If the user tries to save as some unsupported format, why can we
assume that maybe they want to save in some other format instead, and
possibly overwrite an existing file? Maybe the retry should be done
only if the file name to saveAs was without extension? But that was
already discussed in gerrit, I see.

Change-Id: I8bd4fbf241cb492d9654ae893af4baaf28b6b3a0
2018-07-11 12:15:26 +03:00
Michael Meeks
7e6e81eb46 Implement client websocket masking.
Disable this for easy strace debugging and a bit of perf. to the forkit.

Change-Id: Ia330582817481410d26df50db5eb42b4692ad01c
2018-06-15 14:54:19 +01:00
Ashod Nakashian
b9db83518b wsd: warn when we have no kits and we are not exiting just yet
Change-Id: I8c19dcea3eb900a989aebac7ef96793af31bdce8
Reviewed-on: https://gerrit.libreoffice.org/55576
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-06-14 17:05:46 +02:00
Miklos Vajna
d718b1c054 kit: let alphaBlend() take an std::vector<char> instead of raw pointer
So that it's more obvious that the two for loops don't read past the end
of the vector.

Change-Id: I49752c1bc316b6d73568ab334b07727ef60bdce5
2018-05-28 09:12:30 +02:00
Miklos Vajna
8f4c348be3 kit: let getPixmap() return an std::vector<char> instead of raw pointer
So the callers can know not only the address of the pixmap, but also the
size of it.

Change-Id: I3aecc33cb354f5878364b11398c276fcabd3103e
2018-05-25 09:11:54 +02:00
Miklos Vajna
51631b4e22 kit: remove unused using declarations
Change-Id: Ide76d327b3b064180aa4eaa28f13827d665edaa5
2018-05-23 09:14:04 +02:00
Michael Meeks
c5cef26fb6 Shutdown kit process if connection dies.
Change-Id: I34e627a03a9859ccd3ae9f9925fe6ab080697b72
2018-05-18 16:06:03 +01:00
Jan Holesovsky
6c31b7793c Post the message to the poll thread.
Change-Id: Ibd28090a420b5396b64fdfe676bef8cf06991116
2018-05-18 15:16:40 +02:00
Jan Holesovsky
6996139e5f Use correct path in the client websockets.
Change-Id: Ie0bf6646ff3f6e6cf99b505143a416c86a3a33b8
2018-05-18 15:16:40 +02:00
Jan Holesovsky
98ed24257b Move the functionality from connectToMonitor() to SocketPoll.
Change-Id: Iab2ac09638323f5e59f7a2ea0d880f52989ad64d
2018-05-18 15:16:40 +02:00
Jan Holesovsky
35ec3649bb Change Kit to use the new client websocket code.
Change-Id: Ib4e62ea618da5bd8992b51165b0d7ee955c61637
2018-05-18 15:16:40 +02:00
Jan Holesovsky
62df2c114f Revert "ChildSession: use NoFileSync as default during convert-to as well"
This reverts commit 684d730221.

Change-Id: I4500e09f678f889ee5ea35cb0f36896de1e11824
2018-05-10 09:51:38 +02:00
Jan Holesovsky
7f3c4b9dd8 Revert "kit: use NoFileSync flag for save"
Turned out this might corrupt .ods files...

This reverts commit d0d87401c1.

Change-Id: I251de8c7d450fffb3b13a3c8eccf3921eddb9f80
2018-05-10 09:51:36 +02:00
Miklos Vajna
7e9ba2e8c6 tdf#117077 kit: opt-in to embed images in HTML export
Changing the default in core.git has various up and downsides, so just
opt in for embedding here.

Change-Id: I3f8013800e3fdf759fcb09bce848e8754c8aa44c
2018-04-27 14:32:32 +02:00
Miklos Vajna
cb761748ed Avoid unnecessary copy-initialization
These are copy-constructed from a const reference but are only used as
const reference; make them a const reference.

Change-Id: Id193905b65224c2db4aab88999a92e60d3af3fdf
2018-04-17 09:13:54 +02:00
Michael Meeks
03bbe52665 Ensure the forkit does not have lingering threads after preinit.
Change-Id: I216a03a0ada628189355ebfd4016bf6033430eef
2018-04-16 20:04:23 +01:00
Tamás Zolnai
ffd7151443 Writer: View jumps to cursor position even if it is moved by an other view.
Need to get the viewid which moved our visible cursor, so we can check
whether it positioned changed by the owner of the cursor or not.

Change-Id: Ie7b1fafc8d8f11fba0c0b0d5f02d755e15284514
Reviewed-on: https://gerrit.libreoffice.org/52571
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-04-10 17:00:21 +02:00
Marco Cecchetti
89f37b5dd5 calc: drop down button marker
Change-Id: Ic069ad40e6749f43709760e7f4f0d96b39d5a4ce
Reviewed-on: https://gerrit.libreoffice.org/51598
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2018-04-03 21:42:27 +02:00
Marco Cecchetti
d887b08d60 calc: added support for hidden sheets and validation of cell content
Change-Id: I5db971b8826de7d5be2f88354925cd107082da77
Reviewed-on: https://gerrit.libreoffice.org/49112
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2018-04-03 21:41:22 +02:00
Tor Lillqvist
e9ea5e8bc7 Python is also a special snowflake
Change-Id: I1689f992494e1abe50c45b1ae975b76b00e1b080
2018-03-28 20:17:32 +03:00
Michael Meeks
ad21717498 Avoid copying most code into the chroot jail.
Last lingering bits are the xpdfimport import support and
some horrors required for NSS.

This requires a reasonably new core.

Change-Id: I2e08b841668722af0e3b947cf2b06687cca73b53
2018-03-28 16:38:10 +01:00
Tor Lillqvist
630d8d736c We want notifications from vnd.sun.star.script: thingies, too
Change-Id: Ic407bcc1a2534854812c2732cc262f859d4adfe5
2018-03-28 12:28:13 +03:00
Tor Lillqvist
bb4c1a7fa7 Don't filter out all scripts, just Java and JavaScript ones
Change-Id: I3054a3f36ae1777b162fb5a1b9a456f1bce9248b
Reviewed-on: https://gerrit.libreoffice.org/51991
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-03-28 11:18:43 +02:00
Miklos Vajna
684d730221 ChildSession: use NoFileSync as default during convert-to as well
This already worked for normal save, but not for convert-to.

Depends on core.git commit 0518bb5c3a98d973c3675fdd4cb8c52a669a3507
(desktop lok: handle NoFileSync in saveAs(), 2018-03-26).

Change-Id: Iec1a92fba2094f3954cc1a4ed6ee3372076fddc5
2018-03-27 09:20:50 +02:00
Michael Meeks
8f134aa1a9 Allow running without seccomp and capabilities.
There are some significant security trade-offs here which are now
at least configurable.

Change-Id: I1d879d69e91392f4ccf5db250a2277f53df60db7
2018-03-19 20:46:17 +00:00
Michael Meeks
6803ee4087 Use a hard random /tmp directory for document intermediates.
Requires a lok tweak to reset the tmpdir globals on init.

Change-Id: I602705f20fa016ef415088be8d1ada6d465d2a8d
2018-03-15 11:01:51 +00:00