jail-id is already used a sub-directory of each tmp dir,
so there is no more "information leak" in making the tmp directory name itself match the jail-id
further naming it with jail id helps in referencing that directory for hard linking when quarantining a file
Signed-off-by: Pranam Lashkari <lpranam@collabora.com>
Change-Id: Iaa635f44d1cd99571a9571113ce1cc92e203fddb
This prevents additional strings from being allocated.
Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: I84b1e5cf4d11bf8512febe068b3097770b63dc5c
There was a pattern of calling Util::startsWith on StringVector
elements:
- Util::startsWith(tokens[0], "boo")
- Util::startsWith(tokens.getParam(token), "boo")
These two expressions would cause a new string to be allocated and
immediately released. To optimize this, a StringVector::startsWith
method is introduced.
This method works by calling compare directly on the underlying
StringVector string, avoiding creating a temporary string.
Signed-off-by: Hugo Peixoto <hugo.peixoto@gmail.com>
Change-Id: I6f27d5bb13783f39c7d4ce0644a11e57b0071244
This should take care e.g. for SharePoint user IDs, which have the
form of "domain\username", and the backslash must be escaped.
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I75936070ad1661dc9b03e05a19b64159b0758018
Unfortunately the sequence message sent
from LO core is important, and the status
indicator finish should arrive to client side
before any dialog interactivity (i.e. Macros Warning Dialog).
However the LO core sends like 3 times status
finish for now we cannot duplicate them.
Change-Id: Ieee2ee93555b50b0e67507aae36096e10728a038
Signed-off-by: Henry Castro <hcastro@collabora.com>
This adds a new service render-search-result, which renders an
image of the position where, the search fund a hit. The search
result contains the information in which object or paragraph,
which is just the node id and node type from the document model.
The service takes the document and the search result (xml file)
as the input and returns a PNG image as the output.
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Iffc158c5b0a3c9a63f8d05830314c9bc1616b3b1
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I12660822829c874179ccffd84dcdd33f5dde27e3
(cherry picked from commit 5a1c42c4e610a9265dfe3527c964413f029060ae)
Conflicts:
loleaflet/src/layer/tile/TileLayer.js
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: Ief814741df4818000cef7499a8b1c9c1ce1f4371
(cherry picked from commit bfed92dffecc3b574f24920733c74565fb1ae29c)
When building against core.git master:
kit/ChildSession.cpp:2668:13: error: enumeration value 'LOK_CALLBACK_SC_FOLLOW_JUMP' not handled in switch [-Werror,-Wswitch]
It's not clear how we want to handle this in Online, so have a default
label in debug builds as well.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ia0b1cef33e8a5a7fbc1518586ea1e3bb13aa5f22
Normally (ideally), tiles (.bmp files) are removed as soon as the JS
has displayed them. But occasionally something goes wrong and they are
left behind. (For instance, it seems to happen if the user closes the
document immediately when it shows up.)
Do not leave them on disk until the app starts the next time.
Change-Id: I0c764280a69a16ad3b7b67c329832fd5331c2e1e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Remove the app's copy of the document after core has saved it and we
have stored the edited version at its real location.
Remove possible leftover tile bitmaps when the app starts.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ibc41be38c2cfb689c532640d148116bc06a248ab
Add profile zone around kitPoll function and SocketPoll constructor to
improve trace event generation
Signed-off-by: Gopi Krishna Menon <krishnagopi487.github@outlook.com>
Change-Id: Ia46e9add59a57935997649fe39861a8d851e1ff0
issue wrt busypopup sending string id for dialogEvent
was already fixed on JS side.
remove unnecessary comment from commit 48f7449
Ignore conversion error from std::stoull for "busypopup"
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I7640b4f693d9d018ae17acb3a9eb292a2423bb68
We cannot rely on wsd being slower than the kit. The rename
has to happen before wsd / DocumentBroker gets to trying to access
the filename. fixes#2874.
Change-Id: Ie1e67cd059fb6a663048967c47759238c067172d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Records the uno commands from different instances of ChildSession and
dumps the last 4 uno commands into the crashlog during a fatal crash
Signed-off-by: Gopi Krishna Menon <krishnagopi487.github@outlook.com>
Change-Id: I838f71769dc08df7076c040f3d72c15f7607e9d3
Makes unit-rendering-options fail reliably.
This reverts commit 175c9c5b2a.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Id05c911991baaae0dbc52678a192fc01639352e0
By passing a traceevent=yes query parameter in the URL. Note that if
Trace Event generation is not enabled in loolwsd.xml this will have no
effect.
It is a bit silly to notice this query parameter only in loleaflet and
then send the information back to the server. Would be better if the
server noticed it itself before sending the URL to loleaflet.
While at it, let's not bother ever enabling Trace Event generation in
the WSD process. That is not what we are interested in.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I985bfd1e2dbd14aa5a55b386b4762fb64bcb4008
The vectors are accessing the elements without pushing to the back.
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: Ia01b54f80b70173b994e776e05710e92248f0e23
This can be used to accelerate unit tests by allowing us to ensure
that all pending work is done between a 'processtoidle' message being
sent and an 'idle' being returned. This can be much faster than waiting
a defined length of time.
Change-Id: I6d96de205d1fd34a22e0ddbd2709bf806a97b33c
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Write to the Trace Event JSON file in just one place, protected by a
mutex.
Handle metadata events separately. We want them to propagate to the
output if Event Trace generation is just enabled, regardless whether
it has been turned on or not.
We can send the metadata for the Kit process only after we have opened
the docuemnt as sending a Trace Event to WSD uses the (singleton)
Document object in Kit.
Introduce some new functions for the above and adapt callers
appropriately.
Generate a Complete event for the handling of one image tile, from
setting the src attribute of the Image object to finishing the onload
function.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5978e0fb2495e0d2dc479bf861eb4ac7da03fa50
Just for clarity, so that each object ends up on a line of its own in
the Trace Event output JSON file.
The stringified object already should contain the comma separator at
the end. Probably should change that, make it so that the comma
separators are added when emitting to the file (or sending to WSD.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ibef117afbe9f099c26b42ce32d280055df86d984
Move the generic dummy implementation of
TraceEvent::emitOneRecording() to a source file of its own. (That is
the one which is used in test and tool executables.)
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I81cab07e5a6852b42d278a5446c13c3825cf546e
Templates are special because the file that gets
loaded is not in the same format as the final one.
An implicit save-as is issued in Kit for template
loads right after loading to create the final
document format. It is this file (as opposed to the
template) that needs to be uploaded, which we do
right after we get the 'status:' message in
DocBroker to actually create the first version
in storage.
Change-Id: I23cbf527f1059b0b4059f15069737ab35ac860e7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
To avoid writing (saving) while reading (uploading) or
any other undesirable racse on the document file,
we atomically rename the file after saving on disk
to pass ownership.
After saving in Core, we rename the document in the
jail to .upload (by appending it). DocumentBroker
looks for the file with that extension and atomically
renames it to .uploading (by appening the 'ing' suffix).
This way, the Kit only renames from the original to
.upload and DocBroker renames only .upload to .uploading.
This guarantees that we never rename the same file
concurrently.
Uploading decision is strictly based on the modified
timestamp of the .uploading file, compared to the
timestamp of the last file we uploaded successfully.
Change-Id: I03520cd8c87605f6dad417e7a978204f76fc0c38
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
And only insert the new pixmap after the check.
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Change-Id: I310d321443152967b3aed8992ece3b55287d01cc
While we are processing data in the poll handler, we can have
another helpful thread from the core sending things to us:
loolforkit(Socket::assertCorrectThread(char const*, int))
loolforkit(WebSocketHandler::sendFrame(std::shared_ptr<StreamSocket> const&, char const*, unsigned long, unsigned char, bool) const)
loolforkit(WebSocketHandler::sendMessage(char const*, unsigned long, WSOpCode, bool) const)
loolforkit(Document::postMessage(char const*, int, WSOpCode) const)
loolforkit(Document::sendFrame(char const*, int, WSOpCode))
loolforkit(ChildSession::sendTextFrame(char const*, int))
loolforkit(ChildSession::loKitCallback(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))
loolforkit(Document::GlobalCallback(int, char const*, void*))
/core/instdir/program/libsofficeapp.so()
/core/instdir/program/../program/libfwklo.so()
/core/instdir/program/libscfiltlo.so()
/core/instdir/program/libexpwraplo.so()
/core/instdir/program/libooxlo.so(oox::core::FastParser::parseStream(com::sun:⭐:xml::sax::InputSource const&, bool))
/core/instdir/program/libooxlo.so(oox::core::FastParser::parseStream(com::sun:⭐:uno::Reference<com::sun:⭐:io::XInputStream> const&, rtl::OUString const&))
/core/instdir/program/libooxlo.so(oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&))
/core/instdir/program/libscfiltlo.so()
/core/instdir/program/libcomphelper.so(comphelper::ThreadTask::exec())
/core/instdir/program/libcomphelper.so()
/core/instdir/program/libuno_salhelpergcc3.so.3(salhelper::Thread::run())
/core/instdir/program/libuno_salhelpergcc3.so.3()
/core/instdir/program/libuno_sal.so.3()
/lib/x86_64-linux-gnu/libpthread.so.0()
/lib/x86_64-linux-gnu/libc.so.6(clone)
This is most likely from eg. threaded parsing of various file formats,
or progress messages while loading / saving, sent while the SolarMutex
is locked.
We assume that:
+ there will only ever be one thread running inside kitPoll
this is enforced by vcl/headless.
+ and so, we can safely mutate SocketPoll and Socket buffer
state from this thread.
+ there are only two entry points for callbacks from threads
in core - which are both instrumented, and if necessary
their work is shifted to this thread.
Memory corruptions matching the above trace, suggesting that
multiple writes have collided between kitPoll and an event
callback have been seen in the wild.
Change-Id: I5b084cbfec1ea326b6e17c9e5590a8c8e35b3854
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Calc has transparent tiles due to client side grid/bg rendering, so do
alpha blending in calc for transparent pixels. As before do alpha
blending for the font rendering phase, no change there.
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Change-Id: I30ab21475b6654a9375574be825e01edbdabf82a
(cherry picked from commit 7b7a73c17d4f6213e78f0b8737ce70cbaccbb56d)
While we are processing data in the poll handler, we can have
another helpful thread from the core sending things to us:
loolforkit(Socket::assertCorrectThread(char const*, int))
loolforkit(WebSocketHandler::sendFrame(std::shared_ptr<StreamSocket> const&, char const*, unsigned long, unsigned char, bool) const)
loolforkit(WebSocketHandler::sendMessage(char const*, unsigned long, WSOpCode, bool) const)
loolforkit(Document::postMessage(char const*, int, WSOpCode) const)
loolforkit(Document::sendFrame(char const*, int, WSOpCode))
loolforkit(ChildSession::sendTextFrame(char const*, int))
loolforkit(ChildSession::loKitCallback(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&))
loolforkit(Document::GlobalCallback(int, char const*, void*))
/core/instdir/program/libsofficeapp.so()
/core/instdir/program/../program/libfwklo.so()
/core/instdir/program/libscfiltlo.so()
/core/instdir/program/libexpwraplo.so()
/core/instdir/program/libooxlo.so(oox::core::FastParser::parseStream(com::sun:⭐:xml::sax::InputSource const&, bool))
/core/instdir/program/libooxlo.so(oox::core::FastParser::parseStream(com::sun:⭐:uno::Reference<com::sun:⭐:io::XInputStream> const&, rtl::OUString const&))
/core/instdir/program/libooxlo.so(oox::core::XmlFilterBase::importFragment(rtl::Reference<oox::core::FragmentHandler> const&, oox::core::FastParser&))
/core/instdir/program/libscfiltlo.so()
/core/instdir/program/libcomphelper.so(comphelper::ThreadTask::exec())
/core/instdir/program/libcomphelper.so()
/core/instdir/program/libuno_salhelpergcc3.so.3(salhelper::Thread::run())
/core/instdir/program/libuno_salhelpergcc3.so.3()
/core/instdir/program/libuno_sal.so.3()
/lib/x86_64-linux-gnu/libpthread.so.0()
/lib/x86_64-linux-gnu/libc.so.6(clone)
This is most likely from eg. threaded parsing of various file formats,
or progress messages while loading / saving, sent while the SolarMutex
is locked.
We assume that:
+ there will only ever be one thread running inside kitPoll
this is enforced by vcl/headless.
+ and so, we can safely mutate SocketPoll and Socket buffer
state from this thread.
+ there are only two entry points for callbacks from threads
in core - which are both instrumented, and if necessary
their work is shifted to this thread.
Memory corruptions matching the above trace, suggesting that
multiple writes have collided between kitPoll and an event
callback have been seen in the wild.
Change-Id: I5b084cbfec1ea326b6e17c9e5590a8c8e35b3854
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>