Commit Graph

7082 Commits (7cbb3f565dc5414d226fe399767cb4375449b32a)

Author SHA1 Message Date
Richard Hansen 7cbb3f565d tests: Speed up `helper.edit()` and `helper.clearPad()` 2021-04-02 15:46:27 +02:00
Richard Hansen 7a154b1e1d tests: Wait for commit instead of sleep in `timeslider_revisions.js` 2021-04-02 15:46:27 +02:00
Richard Hansen d15ff9ce8d tests: Add missing `await`s to `change_user_name.js`
Also increase the timeouts.
2021-04-02 15:46:27 +02:00
Richard Hansen bbf89dfcf9 tests: Refine frontend tests
* Switch from `helper.newPad()` to `helper.aNewPad()`.
  * Promisify.
  * Delete redundant logic.
  * Lint fixes.
2021-04-02 15:46:27 +02:00
Richard Hansen 3790c0e41c tests: Use `async`/`await` instead of returning Promises
This has a few benefits:
  * It's more readable: It's easier for a user of the function to know
    that they should use `await` when calling the function.
  * Stack traces are more useful.
  * Some code (e.g., the async npm package) uses introspection to
    determine if a function is `async` vs. takes a callback.
2021-04-02 15:46:27 +02:00
Richard Hansen b164a34e64 lint: Fix ESLint error in `helper/methods.js` 2021-04-02 15:46:27 +02:00
Richard Hansen 62403159df tests: Invert conditions to improve readability 2021-04-02 15:46:27 +02:00
Richard Hansen dd9c08d821 tests: Wait for commit rather than sleep 2021-04-01 14:31:56 +02:00
Richard Hansen 2776946627 tests: Use cookie libraries to manipulate cookies 2021-04-01 14:31:56 +02:00
Richard Hansen 202d65d2bb pad_cookie: Re-read prefs cookie on every call to `getPref()`
This makes it easier to write tests that clear the prefs cookie.
2021-04-01 14:31:56 +02:00
Richard Hansen 0df41a9a78 pad_cookie: Move initial cookie read+save to `init()`
Benefits of this change:
  * It avoids race conditions with tests that clear cookies.
  * Any attempt to get or set a value before `init()` is called will
    throw an error, ensuring the API is used properly.
  * Improved readability: It's easier to understand what the
    `pad.noCookie` check is doing.
2021-04-01 14:31:56 +02:00
Richard Hansen aeee5c0b69 tests: Fix cookie name in `helper.js` tests 2021-04-01 14:31:56 +02:00
Richard Hansen 137fa89d2a tests: Always set cookie path to / (to match non-test behavior) 2021-04-01 14:31:56 +02:00
Richard Hansen 5666c34061 tests: Fix encoding of prefs cookie 2021-04-01 14:31:56 +02:00
Richard Hansen 63e6e163b7 tests: Promisify some of the `helper.js` tests 2021-04-01 14:31:56 +02:00
Richard Hansen 701a40ac13 tests: Promisify `multiple_authors_clear_authorship_colors.js` 2021-04-01 14:31:56 +02:00
Richard Hansen 8b43f9eb5f tests: Promisify `authorship_of_editions.js` 2021-04-01 14:31:56 +02:00
Richard Hansen 056939cd22 tests: Refine `helper/multipleUsers.js`
* Rename "current"/"other" to "user0"/"user1".
  * Delete unnecessary `_createTokenFor*` functions.
  * Rename helper functions to remove unnecessary leading underscore
    and for brevity.
  * Use jQuery's `.attr()` to build the second iframe.
  * Use js-cookie to manipulate the token cookie.
  * Don't attempt to set the token cookie if the pad isn't loaded.
  * Use the token generated by the pad.
  * Only clear the token cookie at path=/.
2021-04-01 14:31:56 +02:00
Guilherme Goncalves f2034ad368 tests: Add regression tests for character composition race
See: https://github.com/ether/etherpad-lite/issues/4978
2021-03-30 16:42:53 -04:00
Richard Hansen 1fdaf95c3b collab_client: Delete unused `NO_COMMIT_PENDING` handling 2021-03-30 16:42:53 -04:00
Richard Hansen 63a1f078f4 collab_client: Redo server message queueing
Move server message queue processing out of `handleUserChanges()` for
the following reasons:
  * Fix a race condition: Before this change the client would stop
    processing incoming messages and stop sending changes to the
    server if a `NEW_CHANGES` message arrived while the user was
    composing a character and waiting for an `ACCEPT_COMMIT` message.
  * Improve readability: The `handleUserChanges()` function is for
    handling changes from the local user, not for handling changes
    from other users.
  * Simplify the code.
2021-03-30 16:42:53 -04:00
Richard Hansen e99fe88537 collab_client: Use `Date.now()` instead of casting a Date object
Also rename the `t` variable to `now` to improve readability.
2021-03-30 16:42:53 -04:00
Richard Hansen 5c445eac21 collab_client: Convert `state` var to `committing` bool 2021-03-30 16:42:53 -04:00
Richard Hansen 3ee6b5eb2b collab_client: Delete unused `caughtErrors` 2021-03-30 16:42:53 -04:00
Richard Hansen 81b9a2544d collab_client: Factor out duplicate `ACCEPT_COMMIT` code 2021-03-30 16:42:53 -04:00
snyk-bot dd09a3f12b fix: src/package.json & src/package-lock.json to reduce vulnerabilities
The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-UNDERSCORE-1080984
2021-03-30 18:26:32 +02:00
Richard Hansen b9753dcc71 Changeset: Return a new op object by default when iterating
Reusing the same op object for each iteration can result in very weird
behaviors because previously yielded op objects will get a surprise
mutation.

It is unclear why the code was written to reuse the same object. There
was no comment, nor is there a commit message providing rationale (it
has behaved this way since the very first commit). Perhaps the objects
were reused to improve performance (fewer object allocations that need
to be garbage collected). I do expect this change to reduce
performance somewhat, but not enough to warrant reverting this commit.
2021-03-29 18:42:55 -04:00
Richard Hansen 718da6fc1b tests: New `helper.aNewPad()` (promisified `newPad()`) 2021-03-29 18:40:05 -04:00
Richard Hansen ec76a6548f tests: Make the `helper.newPad()` callback optional 2021-03-29 18:40:05 -04:00
Richard Hansen 27b35699ea tests: Fix `helper.newPad()` retries
* Pass retry count in options object so that each pad has its own
    retry count.
  * Delete useless `origPadName` variable.
2021-03-29 18:40:05 -04:00
translatewiki.net eac5a52690 Localisation updates from https://translatewiki.net. 2021-03-29 17:55:09 +02:00
John McLear b80f5bdae8
bugfix/tests/scaling: Socket query test fix (#4974)
fix socketio test where res.req is not available.
2021-03-24 21:03:48 +00:00
John McLear 2b98b930d7
scaling: include padId in socketio query string 2021-03-24 16:07:11 +00:00
webzwo0i 0e854a5892 fix wrong changelog entry 2021-03-22 17:26:55 +01:00
webzwo0i 7af0641f04 Merge branch 'master' into develop 2021-03-22 16:17:27 +01:00
webzwo0i 5db0c8d1cf Merge branch 'develop' 2021-03-22 16:17:20 +01:00
webzwo0i 3ae6b01518 bump version 2021-03-22 16:17:18 +01:00
webzwo0i 65b644498f bump require-kernel dependency 2021-03-21 18:30:39 +00:00
webzwo0i 826826bd37 add changelog for 1.8.13 2021-03-21 15:42:16 +00:00
John McLear a8f9c2b6a7
fix: upgrade express-rate-limit from 5.2.5 to 5.2.6 (#4938)
Snyk has created this PR to upgrade express-rate-limit from 5.2.5 to 5.2.6.

See this package in npm:
https://www.npmjs.com/package/express-rate-limit

See this project in Snyk:
https://app.snyk.io/org/johnmclear/project/d9a12bfb-7ccd-443f-9e22-f30d339cc8c5?utm_source=github&utm_medium=upgrade-pr

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
2021-03-20 17:45:00 -04:00
Richard Hansen eb3cff5b3a LibreOffice: Remove unnecessary callbackification
`async.queue` will do the right thing if passed an `async` function.
2021-03-20 20:29:55 +00:00
Richard Hansen 0233399fdf Abiword: Avoid calling `stdoutCallback` multiple times 2021-03-20 20:29:55 +00:00
webzwo0i c208d50c4a add version string to iframe_editor.css 2021-03-20 16:42:08 +00:00
webzwo0i b250ceaae7 add test for wrong clientHeight 2021-03-20 16:41:15 +00:00
Richard Hansen 3ad1d0a74f cssmanager: Refactor CSS manager creation to avoid race condition
Safari takes a while to initialize `document.styleSheets`, which
results in a race condition when loading the pad. Avoid the race
condition by accessing the CSSStyleSheet objects directly from the
HTMLStyleElement DOM objects.
2021-03-20 01:07:16 +00:00
Richard Hansen e2bfe2fd10 pad_editor: Promisify `init()` 2021-03-20 01:07:16 +00:00
Richard Hansen 81e36cf3c7 Ace2Inner: Promisify `init()` 2021-03-20 01:07:16 +00:00
Richard Hansen 742a7cd430 cssmanager: Throw if no matching style sheet is found
This avoids a later null dereference when the stack trace isn't as
useful.
2021-03-20 01:07:16 +00:00
Richard Hansen 5b05ee79ff cssmanager: Simplify iteration over style sheets 2021-03-20 01:07:16 +00:00
Richard Hansen cb9f6d6776 ace: Use iframe `srcdoc` property to refine frame load logic
This seems to fix "null is not an object (evaluating
'browserSheet.insertRule')" errors on Safari.
2021-03-19 17:06:58 +01:00