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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user