Commit graph

4404 commits

Author SHA1 Message Date
Pranav Kant
6f212ee49d loleaflet: Fix L.Browser.pointer
window.PointerEvent is available even on non-touch devices in
chrome and Edge (and maybe others too, firefox doesn't have it).

So it results in L.Browser.pointer resulting in true on Chrome,
Edge while false in firefox which leads to click event not
working on these browsers.

Fallout from a0036f24ba

Change-Id: I73b5824882e1cc1f87cdfbc9e7e31f22320367b1
2016-12-14 21:09:56 +05:30
Pranav Kant
07df52e45a loleaflet: Refresh the toolbar
Change-Id: I16fed0dd508ce6d3863157d316ab17898b680df5
2016-12-14 19:32:00 +05:30
Pranav Kant
7c6d4719da loleaflet: Print dialog for MS edge too
MS Edge seems to be very problematic when one tries to load the
pdf blob into the print iframe and issue a print command to it.

Lets fallback to print prompt as we have in firefox

Change-Id: I97fc394d0053030231c524efb6bf808d32a9aa07
2016-12-14 19:06:26 +05:30
Pranav Kant
1bfbd6990c loleaflet: Reuse L.Browser instead of our own logic
Change-Id: I479d6aa3de657ba032e3bb7e5039d5744a859163
2016-12-14 19:06:12 +05:30
Pranav Kant
a0036f24ba Pick changes from upstream Leaflet
Only the changes made to src/core/Browser.js

Change-Id: I96f95e59a50fabea7dad1a8836e78aebac9112c8
2016-12-14 19:03:13 +05:30
Pranav Kant
7ed38a2011 loleaflet: Pass print frame as argument to close function
Removing this._printIframe may still cause leakage here as
this._printIframe is overwritten everytime user issues a print
command.

Change-Id: I06f45604940380b809bc262f07b9b6a8aa7d9a87
2016-12-14 18:18:11 +05:30
Pranav Kant
e255fe64d2 loleaflet: bump timeout for closing print iframe to 5 minutes
Change-Id: If58a28ef5c856b4ab5e497028fbcabf7b954b282
2016-12-14 18:18:11 +05:30
Pranav Kant
9d039cbd5a Revert "loleaflet: print dialog: it seems that this magic hack is no more needed"
This reverts commit 8c522c44d1.

We need to remove the iframe otherwise it will leak.
2016-12-14 18:18:11 +05:30
Pranav Kant
23ab220259 Document owner termination feature
Change-Id: If9e09ba781e0cb53a6a96a6acdaac8995fa8f348
2016-12-14 18:18:11 +05:30
Andras Timar
9ee4062935 Bump version to 2.0.1+
Change-Id: I1a670d3b9a3a5d3711f1a83b2a8978e032ded774
2016-12-14 11:34:11 +01:00
Ashod Nakashian
fe38e0e1e6 loolwsd: per-socket dedicated sending thread
To avoid degrading performance for everyone
because of a single slow/bad connection, we
send data to clients each in its own thread.

Change-Id: I6f980c25a404c4d05bcdb1979849ea3d2776c7b9
Reviewed-on: https://gerrit.libreoffice.org/31984
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-14 04:21:20 +00:00
Ashod Nakashian
875d11f88b loolwsd: simplify checking for closed socket
Change-Id: I1f41c40bdd42ad6ab9224a2b13af97f84175492c
Reviewed-on: https://gerrit.libreoffice.org/31983
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-14 04:14:57 +00:00
Pranav Kant
1459223c69 wsd: Document expanding WOPI extensions
Change-Id: I1c2c510154a0a987095ff1f4c343c033150f8ae6
2016-12-13 20:17:32 +05:30
Pranav Kant
49193b3f58 tdf#104157: Fix Content-Type and add Content-Disposition for pdf
Change-Id: I07a02a621f0f067b9810d0f92bd3b9fff112af54
2016-12-13 19:39:25 +05:30
Miklos Vajna
d11997337e wsd: mark AppConfigMap as a final class
The call to the setRaw() virtual function during construction will not
dispatch to derived class, so the ctor is correct only in case there are
no subclasses.

Change-Id: I484d276dd05e53211b513373100b70586a5857c0
2016-12-13 13:56:42 +01:00
Pranav Kant
b914aa4222 wsd: If Disabled, turn their corresponding Hide options on
loleaflet will then automatically hide these options from the UI

Change-Id: I65a320850a35b5af4291d896d5942dddfaaa0c98
2016-12-13 18:03:37 +05:30
Pranav Kant
a76825728e Pass Disable{Print,Export,Copy} options to client and handle them
Change-Id: I59a9432bbdd06d8b184f96882c5f4009fcd0be54
2016-12-13 17:59:02 +05:30
Pranav Kant
3ce8c3158a wsd: Allow disabling copy/paste to/from the document to browser
Change-Id: I73c70f46f1db11d69ebff582f72127d304689aa2
2016-12-13 17:45:16 +05:30
Pranav Kant
6affbb307c wsd: Allow hosts to disable print, export
using these WOPI protocol extensions: DisablePrint,
DisableExport, DisableCopy. All assumed to be false if not
provided.

Change-Id: I415597d710107f9d8cbb8757f361365cc2a88eb1
2016-12-13 17:45:16 +05:30
Pranav Kant
1ddd85c77c Document downloadas protocol message
Change-Id: Iad8775c441e8fbb531b4608bd6ccb391435e7dcf
2016-12-13 17:45:16 +05:30
Pranav Kant
8135e678bb loleaflet: Use readable id= argument in downloadas
Change-Id: Ica9ba833f487f2c75f8629fd91f31b216c4797b5
2016-12-13 17:45:16 +05:30
Pranav Kant
348653a73c wsd: Use EnableOwnerTermination property for ownertermination
We want document owners (sessions with their WOPI UserId =
OwnerId) close the document (for all sessions) only if
EnableOwnerTermination property is specified. Note that
EnableOwnerTermination is an extension to WOPI, and not part of
original WOPI standard.

Change-Id: I7237d172c4c54477572bc132336910250af075a3
2016-12-13 17:45:16 +05:30
Pranav Kant
3e2a9df6dd wsd: Store wopifileinfo separately per client session
Client needs to act accordingly as per permissions/settings set
by the WOPI host.

Change-Id: I7c9f311be50d4aff2562da0cfef2fff889f111d0
2016-12-13 17:45:16 +05:30
Andras Timar
0b596ae51d wsd: do not warn about missing access_token_ttl, when there is no access_token
Change-Id: I6ac7014dee21892dfd8b3b594cafe2dc030b6b2a
2016-12-13 09:56:29 +01:00
Ashod Nakashian
4bc318fb88 loolwsd: LOG_CHECK to replace assertion when logging suffices
Change-Id: I077c6394579f432c0aa9da053d20ccb9c6d31907
Reviewed-on: https://gerrit.libreoffice.org/31934
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:37:05 +00:00
Ashod Nakashian
aa1d721444 loolwsd: harden against socket errors and lock while receiving
Change-Id: I402d387272e0e30d2fe035842c50f40c3806e20d
Reviewed-on: https://gerrit.libreoffice.org/31933
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:36:27 +00:00
Ashod Nakashian
6b8ed0dac6 loolwsd: handle socket error and close better
If the socket is in error, SELECT_READ returns
immediatly as failure. In this case we sit
in a tight loop polling read over and over.
We now check for SELECT_ERROR when SElECT_READ
fails to properly close the socket and break.

When receiveFrame returns -1, we should first
check the flags for socket close, as that
is a legitimate case of returning -ve.

Change-Id: I7bbc948638a8395d28990ba92eddb9a1a9f1e6f2
Reviewed-on: https://gerrit.libreoffice.org/31932
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:35:50 +00:00
Ashod Nakashian
477ca6f414 loolwsd: cleanup the Sessions
Change-Id: I3cd065ab84e17f943fa7de7e094db574ff6fde07
Reviewed-on: https://gerrit.libreoffice.org/31931
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:35:00 +00:00
Ashod Nakashian
e60bc28a00 loolwsd: LOOLSession -> Session
Change-Id: I94369480fb0a6789375dfe5610ada300e94b80eb
Reviewed-on: https://gerrit.libreoffice.org/31930
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-13 04:34:19 +00:00
Andras Timar
708f9be23a wsd: do not log error, when access_token_ttl is not passed 2016-12-12 19:28:37 +01:00
Andras Timar
356374d96b loleaflet: typos 2016-12-12 16:20:36 +01:00
Pranav Kant
b3db321e85 Unify loleaflet's make with top level make
Top level make would now build loleaflet too if necessary.

Respect value of ENABLE_DEBUG and if present add debug-info to
generated js bundles too.

Add new rule, clean-local in loleaflet.

Change-Id: I3a9b727824f2877fc72719a8bfdeebed5448cb7d
2016-12-12 17:56:58 +05:30
Miklos Vajna
20fe9cc863 TileCache: remove redundant initializers
Change-Id: Ifb458eb1e5f60152dcebbce2ad11af2ec90e7e52
2016-12-12 12:09:35 +01:00
Andras Timar
e9a370176b wsd: fix error: declaration of ‘size’ shadows a member of 'this' [-Werror=shadow] 2016-12-12 12:08:51 +01:00
Pranav Kant
5938962e0e loleaflet: build: Skip expensive 'npm install'
This always takes ~2 seconds irrespective of whether node_modules
needs updating or not. Lets add appropriate dependencies and save
these precious 2 seconds.

Change-Id: Ided4ff334316c16521e5ea7a69d15736a1cc170f
2016-12-12 16:08:15 +05:30
Pranav Kant
94153379f5 loleaflet: Unused variable
Change-Id: Ic08a04cd196084ce82524ded67445f5b1068b83d
2016-12-12 14:58:21 +05:30
Pranav Kant
6b795ae54d loleaflet: Remove troublesome extra argument to replace()
This errors out in firefox (in some versions).

Change-Id: I4c1d77249ec6883b70c961ffe8239157a0d6466c
2016-12-12 14:55:50 +05:30
Pranav Kant
fda2f26df4 loleaflet: Don't use w2ui directly from loleaflet
Use events, 'hidebusy', 'showbusy' to interact with toolbar.
In some cases, it may happen that w2ui usage in loleaflet happens
before browser loads w2ui.js (as it is in <script> tag after the
one which loads loleaflet).

Change-Id: I9b1b249ede72ed01f97cf31fd3f93780312530bc
2016-12-12 13:49:04 +05:30
Ashod Nakashian
3ac620fc4f loolwsd: alert all users via SenderQueue
Change-Id: Ib5f4e456109a2a48f29fb6b7b75950315490c352
Reviewed-on: https://gerrit.libreoffice.org/31890
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:28:54 +00:00
Ashod Nakashian
b7205192b4 loolwsd: route client messages through SenderQueue
Change-Id: Ied0e32e8874c9754bf32f1a77c74cf8da181924a
Reviewed-on: https://gerrit.libreoffice.org/31889
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:27:13 +00:00
Ashod Nakashian
d8c8737597 loolwsd: move forwardToPeer into PrisonerSession
Change-Id: I771af0ea066d3d7cb16173861ae70dcc052122aa
Reviewed-on: https://gerrit.libreoffice.org/31888
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:25:51 +00:00
Ashod Nakashian
2065fb5972 loolwsd: set the payload size only once
Change-Id: Ieb8f6fdbdbf0fbca3aa4032aea2f15bf37e3282b
Reviewed-on: https://gerrit.libreoffice.org/31887
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:59 +00:00
Ashod Nakashian
da97e2ac18 loolwsd: grow the SenderThreadPool dynamically
The pool is checked for expansion before processing
items from the queue. By tracking the number of idle
thread (i.e. not currently sending data) we ensure
that there is at least one idle thread before
we invoke the socket.

If there is not enough idle threads at that point,
a new thread is spawned, so long as we're below the
limit. This guarantees that even if all the active
threads block on the socket, we'd always have one
more to process new data (until we reach the limit,
which is as many client connections as we have).

Technically, a single slow connection could
still monopolize all connections if there are
many messages to be sent to it. For that we'd
need to track and assign one thread per connection,
something we don't currently do.

Change-Id: Ic8b5e064da068b37bcfa773005495b198763c31d
Reviewed-on: https://gerrit.libreoffice.org/31886
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:24:11 +00:00
Ashod Nakashian
f8d3576556 loolwsd: Sender Thread Pool
Change-Id: I36a0ad376dad1e6b0733ebfa930baf1dd5752a8c
Reviewed-on: https://gerrit.libreoffice.org/31885
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:22:31 +00:00
Ashod Nakashian
0b42af6d8d loolwsd: move SenderQueue to wsd
Change-Id: I33af4d1b2bbf0305cbc5fa6f05266d126f1bb803
Reviewed-on: https://gerrit.libreoffice.org/31884
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:20:43 +00:00
Ashod Nakashian
233cb94eff loolwsd: SenderQueue to hold messages to send to clients
This adds SenderQueue and a wrapper of messages to
send back to clients.

Currently no threading takes place, but the messages
are pumped through the queue nonetheless.

Change-Id: Id9997539c0a2a351cbf406f649c268dd3643e88e
Reviewed-on: https://gerrit.libreoffice.org/31883
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 05:19:04 +00:00
Ashod Nakashian
9252477353 loolwsd: correct logging
Change-Id: I1856b68f336bc5515c1ef82b47893649510438c5
Reviewed-on: https://gerrit.libreoffice.org/31882
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:29:11 +00:00
Ashod Nakashian
d3c2a320ae loolwsd: refactor tile sending to offload on thread
Change-Id: I6537ca407dc64a0a78a33ba823a43e5ead570848
Reviewed-on: https://gerrit.libreoffice.org/31881
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:28:52 +00:00
Ashod Nakashian
9f5ec66fb5 loolwsd: prepare to offload tile sending
Change-Id: Ifafa822c05c27fc4b7ef7e0e97ae133de39ce23b
Reviewed-on: https://gerrit.libreoffice.org/31880
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-12-12 00:28:16 +00:00
Andras Timar
e73841b66c loleaflet: remove unused functions: toggleButton, disableButton 2016-12-09 16:01:40 +01:00