Review main Abandoned

93803[TASK] Convert synchronous XMLHttpRequest userpref to async

Garvin Hicking CR -1 V 0 Easy +11 −16 updated 04/23/26, 07:56

Commit message

Chrome reports in the Backend when `persistent.ts` is used:

  Synchronous XMLHttpRequest on the main thread is deprecated
  because of its detrimental effects to the end user's experience.
  For more help, check https://xhr.spec.whatwg.org/.

WhatWG says:

  Synchronous XMLHttpRequest outside of workers is in the process
  of being removed from the web platform as it has detrimental
  effects to the end user’s experience. (This is a long process
  that takes many years.) Developers must not pass false for the
  async argument when the current global object is a Window object.
  User agents are strongly encouraged to warn about such usage in
  developer tools and may experiment with throwing an
  "InvalidAccessError" DOMException when it occurs.

The usage comes from the only Core place that sets `async=false`:

```
const request = new XMLHttpRequest();
const async = false;
request.open('GET', url.toString(), async);
request.send();
```

This patch tries to insert a non-intrusive async call flow:

- New private field `fetchPromise` — prevents duplicate
  network requests if `get()` is called multiple times before data
  arrives.

- Instead of calling the sync XHR in `get()` and immediately
  using the result, it kicks off the async load and returns
  `undefined` for that call. Once the load completes,
  subsequent `get()` calls return real data normally.

- In `loadFromServer()` the synchronous XMLHttpRequest is
  replaced with `AjaxRequest` (which was already imported).
  It now sets this.data when it resolves. Error handling
  is performed in there.

Review

  • Code review CR -1
    • Andreas Kienast -1
  • Verified V 0
    • core-ci +1 CI

Issues 1

Files 2

Review log 1012

  1. Garvin Hicking uploaded patch set 1 04/22/26, 18:46

  2. Garvin Hicking commented on patch set 1 04/22/26, 18:49

    Please note this TypeScript/JavaScript is not my strong suit and I clobbered this together as a first working base to kick off. Needs proper review.
  3. core-ci voted on patch set 1 V -1 04/22/26, 18:54 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100924

  4. core-ci voted on patch set 1 V +1 04/22/26, 19:33 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/100924

  5. Andreas Kienast commented on patch set 1 04/23/26, 05:25

    This means that the first call to .get() will now always "fail" and I won't get any data. How is this helpful?
  6. Andreas Kienast voted on patch set 1 CR -1 04/23/26, 05:25

  7. Garvin Hicking commented on patch set 1 04/23/26, 07:44

    Reply

    Probably not, do you have an idea how to solve it? I need help with this.
  8. Garvin Hicking commented on patch set 1 04/23/26, 07:47

    Reply

    (Note this isn't urgent, we'll probably have a while until browsers really kill this)
  9. Garvin Hicking marked it work in progress 04/23/26, 07:47

  10. Andreas Kienast commented on patch set 1 04/23/26, 07:53

    Reply

    The only solution is to rewrite / replace this with a truly async solution, which of course leads to a deprecation of this very module.
  11. Garvin Hicking commented on patch set 1 04/23/26, 07:55

    Reply Unresolved

    Ack. I'll abandon this one and leave the issue open.
  12. Garvin Hicking abandoned the change 04/23/26, 07:56

    Needs the whole nine yards