Bug: copyStyleSheetsToWindow() may fail if win.document.head is null
Severity: Low
Files: src/js/utils/dom.js
Lines: 889, 898
Description
The function appends elements to win.document.head without checking if head exists. If the target window (e.g., a Picture-in-Picture window) is closing or in an invalid state, win.document.head could be null, causing an uncaught TypeError.
Affected code
win.document.head.appendChild(style); // Line 889
// ...
win.document.head.appendChild(link); // Line 898
Suggested fix
const head = win.document.head || win.document.documentElement;
if (head) {
head.appendChild(style);
}
Bug:
copyStyleSheetsToWindow()may fail ifwin.document.headis nullSeverity: Low
Files:
src/js/utils/dom.jsLines: 889, 898
Description
The function appends elements to
win.document.headwithout checking ifheadexists. If the target window (e.g., a Picture-in-Picture window) is closing or in an invalid state,win.document.headcould benull, causing an uncaught TypeError.Affected code
Suggested fix