feat(tracker):safe font node callback

This commit is contained in:
Alex Kaminskii 2023-01-27 15:18:18 +01:00 committed by Taha Yassine Kraiem
parent 7dbdae283d
commit 603f8c30b1

View file

@ -45,22 +45,24 @@ export default function (app: App) {
app.observer.attachContextCallback(patchWindow)
patchWindow(window)
app.nodes.attachNodeCallback((node) => {
if (!isDocument(node)) {
return
}
const ffDataArr = docFonts.get(node)
if (!ffDataArr) {
return
}
app.nodes.attachNodeCallback(
app.safe((node) => {
if (!isDocument(node)) {
return
}
const ffDataArr = docFonts.get(node)
if (!ffDataArr) {
return
}
const parentID = node.defaultView === window ? 0 : app.nodes.getID(node)
if (parentID === undefined) {
return
}
const parentID = node.defaultView === window ? 0 : app.nodes.getID(node)
if (parentID === undefined) {
return
}
ffDataArr.forEach((ffData) => {
app.send(LoadFontFace(parentID, ...ffData))
})
})
ffDataArr.forEach((ffData) => {
app.send(LoadFontFace(parentID, ...ffData))
})
}),
)
}