diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-09-23 21:43:48 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-23 21:43:48 +0900 |
| commit | e673c143a9b63bae52689f719d6b363f66eb7a59 (patch) | |
| tree | a8f9b6bf78eb2447530e5b887e3ec74fdbe917d6 /packages/backend/src | |
| parent | refactor(misskey-games): Misskey Games系パッケージのlint修正+Lint ... (diff) | |
| download | misskey-e673c143a9b63bae52689f719d6b363f66eb7a59.tar.gz misskey-e673c143a9b63bae52689f719d6b363f66eb7a59.tar.bz2 misskey-e673c143a9b63bae52689f719d6b363f66eb7a59.zip | |
fix(backend): happy-domを使用後にcloseするように (#14615)
* Add `DetachedWindowAPI.close` calls to `MfmService`
(cherry picked from commit ceaec3324925e53ca3f467b0438a98f1108eed0f)
* fix
* update changelog
* fix
---------
Co-authored-by: Julia Johannesen <julia@insertdomain.name>
Diffstat (limited to '')
| -rw-r--r-- | packages/backend/src/core/MfmService.ts | 8 | ||||
| -rw-r--r-- | packages/backend/src/core/activitypub/ApRequestService.ts | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/backend/src/core/MfmService.ts b/packages/backend/src/core/MfmService.ts index 74536c68f5..d33b228c3d 100644 --- a/packages/backend/src/core/MfmService.ts +++ b/packages/backend/src/core/MfmService.ts @@ -239,7 +239,7 @@ export class MfmService { return null; } - const { window } = new Window(); + const { happyDOM, window } = new Window(); const doc = window.document; @@ -457,6 +457,10 @@ export class MfmService { appendChildren(nodes, body); - return new XMLSerializer().serializeToString(body); + const serialized = new XMLSerializer().serializeToString(body); + + happyDOM.close().catch(err => {}); + + return serialized; } } diff --git a/packages/backend/src/core/activitypub/ApRequestService.ts b/packages/backend/src/core/activitypub/ApRequestService.ts index 805280db36..7c78f3319b 100644 --- a/packages/backend/src/core/activitypub/ApRequestService.ts +++ b/packages/backend/src/core/activitypub/ApRequestService.ts @@ -207,7 +207,7 @@ export class ApRequestService { if ((contentType ?? '').split(';')[0].trimEnd().toLowerCase() === 'text/html' && _followAlternate === true) { const html = await res.text(); - const window = new Window({ + const { window, happyDOM } = new Window({ settings: { disableJavaScriptEvaluation: true, disableJavaScriptFileLoading: true, @@ -241,7 +241,7 @@ export class ApRequestService { } catch (e) { // something went wrong parsing the HTML, ignore the whole thing } finally { - window.close(); + happyDOM.close().catch(err => {}); } } //#endregion |