Commit graph

1173 commits

Author SHA1 Message Date
Méven Car
dbfe0e880a Adjust size of custome properties dialog
Signed-off-by: Méven Car <meven.car@collabora.com>
Change-Id: I5a7020db5b9dbb2f8bccfbe9da491111459a6f65
2024-02-21 15:16:14 +00:00
Michael Meeks
2be1f8c345 UnitBadDocLoad - adapt to new jsdialog behavior.
Parse jsdialog responses, and send the right dialog id
to click items on.

Adapt to unexpected multiple updates for the corrupted document
warning dialog on load.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I0f934cdc60b2204afc493cf367f98a9cfa0aa6c0
2024-02-21 12:57:11 +00:00
Michael Meeks
c090b4fd21 notasync warning improvement.
Kit's GlobalCallback has an alarming habit of enabling
inputprocessing during a jsdialog popup occuring during
load, so use a stronger heuristic to avoid sending errors.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4a57685dcf63b4a3607c894e80a13e27bffaece5
2024-02-21 12:57:11 +00:00
Michael Meeks
01e47f08a8 torture testing: drastically simplify, and add odg test.
Removing the prior apparently fragile approach of summing
view-ids.

Instead check for lack of duplicate view-ids, and still
load & close lots of views in random orders.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ibcefc54597cc4e37a9728dab2f32002620b01c4c
2024-02-21 12:57:11 +00:00
Michael Meeks
eda61d1bb9 WOPI timestamp test fixes.
Adapt checks for empty or non-empty timestamps so that we can
match previous failures, and ensure coolwsd is sending us the
right override state.

Change-Id: I604e3aa0315753ae02e5a6e4173d6b3b3ffa3b3e
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-02-21 09:38:49 +00:00
Michael Meeks
7031c3b0ce cool#8328 - config header fixup.
config.h should be included as the 1st line in each source file.
It should not be included in headers.

config_version.h which changes on every commit should not be
included widely - so remove it from the HttpRequest heeader to
save tinderbox's ccache.

Fetch version info from helper methods rather than in-lining via
defines, to better encapsulate.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If449a36f1ac61940f04d70d5f4180db389d9b4c4
2024-02-21 09:35:25 +00:00
Henry Castro
f6a0c366db fix fail unit test "builddir != srcdir"
Change-Id: I7a5b96da9e892c1948cbbc52c57344a2b67daab6
Signed-off-by: Henry Castro <hcastro@collabora.com>
2024-02-14 09:12:12 +00:00
Ashod Nakashian
ae1c28c325 wsd: test: allow more time for repair dialog messages
Change-Id: If841daf76f1f7fb220205a3a04d695b261540eb4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-09 15:13:40 +00:00
Ashod Nakashian
0b47d8fc2a wsd: test: wait longer to load exoticlocale test
For some reason, the exoticlocale test takes
significantly longer to load. It often times
out when the CPU throttles or when it's
too loaded. Extending the timeout eliminates
the issue for me (no timeout over 175 runs).

Change-Id: I07cb099776af38206c0567f603cb6cc424eb0b93
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-09 15:13:40 +00:00
Ashod Nakashian
d28aab5020 wsd: test: empty file-substitution test
Change-Id: I192e54e7e850d1e4697f09e87b6397ae26c9391a
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-09 15:13:40 +00:00
Ashod Nakashian
d3905698b0 wsd: detect unencoded WOPISrc
We should always have an encoded WOPISrc.
We add detection logic to make sure
that all URIs that contain WOPISrc have
it encoded properly. We do this by
comparing the decoded WOPISrc with
the original URI.

Change-Id: Ia0c2a79b009ce105321ad35db3d4f81006e81cb3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-02-09 03:57:04 -05:00
Miklos Vajna
c41cfb1999 test: fix -Werror,-Winconsistent-missing-override in WhiteBoxTests
WhiteBoxTests.cpp:660:10: error: 'updateActivityHeader' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    void updateActivityHeader() const
         ^
../kit/ChildSession.hpp:89:18: note: overridden virtual function is here
    virtual void updateActivityHeader() const = 0;
                 ^

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I12f21fd9fbe0ba77d2196bfcd1cbdb5ef07e5d06
2024-02-07 15:10:07 +00:00
Michael Meeks
29fa4a40a1 signal activity dumping: enrich with session details and state.
Cue up some basic state for being signal safe dumped on crash/abort.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ibc6713aef2a0e7b878b178b05f0e13c8d40b47fc
2024-02-06 19:29:28 +00:00
Caolán McNamara
f04d3450cd rng::getHardRandomHexString is now the same impl as rng::getHexString
so remove one in favor of the other

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I47778f7bce24f0687565aa179b7a3bbea9d95120
2024-02-05 16:19:38 +00:00
Caolán McNamara
5432562801 getTempFileCopyPath is only used by tests so move to test-only code
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7c8a122425c689edb3eeb8c80e08470eac347bcc
2024-02-01 10:01:08 +00:00
Michael Meeks
fa80ecd2d0 sockets should use CLOEXEC ticket cool#8016
Change-Id: I5f59ed9446a1fda301bb4791f98ca7c1c137e606
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-01-29 21:01:39 +00:00
Miklos Vajna
82915ab865 unit-bad-doc-load: fix this to pass again
Probably went wrong with bf8b9945ab304c3c4604ff296ff33b3f127accf7 (Warn
on non-async dialog usage when in debug mode., 2024-01-26).

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ifb92e0d9431f252cdf26ac92dd428b87e5d6e8e0
2024-01-29 20:50:11 +01:00
Miklos Vajna
33310613cd wsd: fix reading past the end of the clipboard in postProcessCopyPayload()
Add a way to search with an offset in findInVector() and then we can
avoid strstr() which assumes a null-terminated input, which may not be
the case.

	READ of size 55 at 0x606000068a56 thread T8 (docbroker_001)
	    #0 0x55d0d6718a5a in StrstrCheck(void*, char*, char const*, char const*) /home/abuild/rpmbuild/BUILD/llvm-15.0.7.src/build/../projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:652:5
	    #1 0x55d0d6718882 in __interceptor_strstr /home/abuild/rpmbuild/BUILD/llvm-15.0.7.src/build/../projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:669:5
	    #2 0x55d0d71872c9 in ClientSession::postProcessCopyPayload(std::shared_ptr<Message> const&)::$_4::operator()(std::vector<char, std::allocator<char>>&) const /home/vmiklos/git/collaboraonline/online-23.05-san/wsd/ClientSession.cpp:1631:31

During unit-uno-command.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Id42669d912bab4746d9f7d99a192c4c3f1d175f7
2024-01-23 08:38:26 +00:00
Miklos Vajna
141e1ce7d0 cool#8023 Remove HTML marker in unit-copy-paste
This really just passed by accident in the past:

	Clipboard with 19 entries:
		[0] - size 5689 type: 'application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source (XML)"'
		[1] - size 159 type: 'application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object Descriptor (XML)";classname="47BBB4CB-CE4C-4E80-a591-42d9ae74950f";typename="Collabora OfficeDev 23.05 Spreadsheet";displayname="file:///tmp/user/docs/jexG9292sB0PuaWL/UnitCopyPaste1d0fdba5_empty.ods";viewaspect="1";width="6783";height="2712";posx="0";posy="0"'
		[2] - size 388 type: 'application/x-openoffice-gdimetafile;windows_formatname="GDIMetaFile"'
		[3] - size 1812 type: 'application/x-openoffice-emf;windows_formatname="Image EMF"'
		[4] - size 2222 type: 'application/x-openoffice-wmf;windows_formatname="Image WMF"'
		[5] - size 1073 type: 'image/png'
		[6] - size 79158 type: 'application/x-openoffice-bitmap;windows_formatname="Bitmap"'
		[7] - size 79158 type: 'image/bmp'
		[8] - size 1493 type: 'text/html'
		[9] - size 0 type: '    </tr>'
		[10] - size 0 type: '           <td align="left"><br></td>'
		[11] - size 0 type: '</table>'
		[12] - size 49 type: 'application/x-openoffice-sylk;windows_formatname="Sylk"'
		[13] - size 98 type: 'application/x-openoffice-link;windows_formatname="Link"'
		[14] - size 246 type: 'application/x-openoffice-dif;windows_formatname="DIF"'
		[15] - size 6 type: 'text/plain;charset=utf-8'
		[16] - size 6 type: 'application/x-libreoffice-tsvc'
		[17] - size 977 type: 'text/rtf'
		[18] - size 977 type: 'text/richtext'

Remove the marker, then sizes will match again.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I1edea3d3a64b9a54cc1c0a0cea703ae66c2aba82
2024-01-19 08:24:57 +01:00
Ashod Nakashian
765447caac wsd: buy url substitution
Change-Id: I38d2988680f5b383a2ada5515927631726ba5362
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
ca05b90d8f wsd: checkfileinfo_override substitution
Change-Id: I6339cb16917e73cfe45e59e42715e5cbc2ae8bb8
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
77ecca5a54 wsd: branding theme substitution
Change-Id: I05679b894d784e28eebf35bcc0e34ef2fe15d3e5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
72ba5ce154 wsd: postmessage substitution
Change-Id: I3b40148f58bab1e39d95d9dc0ee415ebd2450e79
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
9555f3228b wsd: test: Sustitution of PreProcessedFile
Change-Id: I2d409f959d31f6a4037c925c9f1ef482d20a4406
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
f8944385fb wsd: new Substitute helper for PreProcessedFile
And enable the round-trip test.

Change-Id: If9a54959514a31f9459e8596b2a4e3847465f1b9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
d7cbe7488b wsd: improved PreProcessedFile with SegmentType
Change-Id: I34609ae855ebbef395d13c4f77885dd6012685f2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
74a8f61586 wsd: better PreProcessedFile and new disabled test
Change-Id: I30a7698c54913f8eeef9a1e02cabaebd907cb7e3
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Ashod Nakashian
78f5b70695 wsd: new PreProcessedFile class
This class will be responsible for faster
variable replacement to serve the templates.

Change-Id: Ic0d75b0a197c0db75c0988c3b6af400a5b1c35a2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-18 19:25:59 +00:00
Michael Meeks
5bd1f1d0e8 convert-to: be more tolerant of unusual filenames.
But re-write them anyway to be more sensible.

Change-Id: Ie146f4f84b539ab7e826a1c1b947497acde7e384
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-01-15 11:57:55 +01:00
Miklos Vajna
d6822cd4d2 test, UnitUNOCommand: also accept json payloads for statechanged
The JS code does the same at
browser/src/layer/tile/CanvasTileLayer.js:3074.

In preparation of picking core.git
51d8a2ef54751403fa707816e27ddb4e7faa8231 (cool#7492 sfx2 lok: fix bad
view id / statusbar string on async binding update, 2024-01-08) to
core.git co-23.05: this online.git commit should go in first to avoid
breakage.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I652e5c738b7e137970a820de2d71f9c03ba6df7e
2024-01-09 08:36:29 +00:00
Ashod Nakashian
61cf7b9601 wsd: clean up unused header includes
Clang-tidy recommendation driven header
include clean-up.

Change-Id: I30c32866b7798e70df0463ee6bc7a0bcc3de5049
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-08 08:38:48 +01:00
Ashod Nakashian
b1f0834ac4 wsd: do not upload unmodified document
When always_save_on_exit=true we should
still not upload the document when it
isn't modified.

In this case, because we now always
save the document (forced) when
always_save_on_exit=true, and because
saving always generates a new file on
disk, with a new timestamp, we couldn't
detect that there are no modifications.

We now still force save, but ask Core
to skip it if the document is unmodified.

This is safe since we now always issue
the save, but rely on Core to do the
right thing. When the document is saved,
we do the normal upload as in that case
we know we have a new version of the
document, which must be uploaded.

Worth noting that the closedocument
command doesn't trigger the same path.
To reproduce the issue, we need a new
test that disconnects, instead of the
graceful closedocument command.

Change-Id: Iaa4e0363ed2eca124f2d1943393e65c0c187aa18
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-04 05:29:32 -05:00
Ashod Nakashian
7f2f946aec wsd: logging and cosmetics
Change-Id: I777db7d1879e84f341f11a90fce7abf8241f5ced
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-04 05:29:32 -05:00
Michael Meeks
b3a2d55194 remove unused code.
Change-Id: I328cf6783deae0a9be3aab10634b8d76e7efe965
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-01-04 09:26:55 +01:00
Ashod Nakashian
7a327c337b wsd: force autoSave on always_save_on_exit
This forces autoSave when always_save_on_exit
is true. This is needed so we can guarantee
that we don't have modification and that
we upload if there has every been one.
The latter case is checked in
DocumentBroker::needToUploadToStorage(),
which is called from
DocumentBroker::checkAndUploadToStorage().

A new test reproduces the issue and defends
the fix.

Change-Id: I0b2105a57cfd7049ba7b1f63e62a700fdc3744c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2024-01-02 08:17:01 -05:00
Ashod Nakashian
c4470a9687 wsd: do not remove quarantine files explicitly
Let clearOldQuarantineVersions() remove quarantined
files only when necessary and per the config settings.

Change-Id: Ie1fb18c02d61a710546e9b5962ab8b7973c2066e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-12-27 06:10:17 -05:00
Caolán McNamara
5a01a21e27 cid#336285 Dereference null return value
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ia0506d22a928fc810110895f3b00db33e3c28c5c
2023-12-11 09:25:59 +01:00
Michael Meeks
b45f4b8f93 spdx: improve machine and human readability of headers.
Change-Id: I71f1421debf31b8c6cd0fd75c0cb45e2563b8a5a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-20 14:30:02 +00:00
Michael Meeks
7183a3d3de spdx: improve machine and human readability of headers.
Change-Id: Ice934380029bf27054e830fffc07a5d037d1430f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-14 19:36:31 +00:00
Marco Cecchetti
4dfe164f3f Make wsd aware of LOK_CALLBACK_CORE_LOG callback
Signed-off-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Change-Id: Ief478ba97ac33f386d7b09aa551168e2c05259de
2023-11-14 13:16:30 +01:00
Hubert Figuière
1114af585a default-ui: Allow skipping the UI state saved in local storage.
Pass SavedUIState=false to the ui_defaults

Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I2cceffed338440d1fee5b0818e072ecc02379468
2023-11-08 10:12:42 -05:00
Michael Meeks
08d9081280 net: don't try to set TCP_NODELAY on local Unix sockets.
Change-Id: Ic0f720554080a01b7a46abbffda023834016c0ea
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2023-11-01 08:06:53 +00:00
Ashod Nakashian
184a4a522e killpoco: replace HTTPResponse in sendFileAndShutdown
We now use our http::Response in HttpHelper::sendFileAndShutdown.

Change-Id: I77503fce7a66a11435bad896d3d5d6df611544be
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
c3fb1d0dde wsd: helper to serialize pairs
Since we don't want to propagate Poco types
as well as our pair containers, it's best
to have these are named functions rather
than as operator<<.

Change-Id: I9772b8f314262147b6c445464bf3ce8cb598b56d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
bd056aef91 wsd: test: proper parsing of http header in UnitHttp
This removes the literal string comparison of the
received http header with proper parsing and
comparison.

Change-Id: I383794aa1dc791632ec9d5ed2191880a57d457ee
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
6ed5dc9a64 wsd: http: no need to pass the mime-type explicitly to sendFile
Since we already have an http response instance (in all but
one case, prior to this change), there is no need to pass
the mime-type explicitly to the sendFileAndShutdown
function, only to set it on the http response.

There are already too many arguments and the mime-type
is surely redundant.

Change-Id: Iab64074dc111573b87fb8fa9b907c26a4160910c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 21:33:02 -04:00
Ashod Nakashian
7e1a23f47a wsd: test: helper to wait for any of the given messages
Change-Id: Ice48f59202306134dbafb411b8078f416e56b1c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 09:20:32 +02:00
Ashod Nakashian
6de46d746e wsd: test: better run_unit.sh
Unfotunately, if our custom test driver run_unit.sh
fails, the report isn't generated at all.

So, instead, we have to go back to parsing the trs
file to detect success and failure.

We now make fast-fail an option instead.

Also fixes a typo in run_unit_standalone.sh.

Change-Id: I337c2a3edceda01df5f9c13c83eb176930b07e34
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2023-10-24 09:20:32 +02:00
Caolán McNamara
0ed831dfae restore TileCacheTests::testTileProcessed
with the original 25 expected results from 25 requests

from cid#318925 Structurally dead code

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I236876fadd5b5c82ecdbcc52a13fc58e8513aa12
2023-10-19 09:59:02 +02:00
Caolán McNamara
7233bce6c2 cid#318978 silence Using invalid iterator
for coverity always assert even if a previous test was to fail

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic48654d828a5311e043f412d9c30139e25b40262
2023-10-17 09:48:02 +02:00