Merge pull request #16612 from erm1116/fix-contentscript-updateEmbedElement

Fix reading property of null object in chrome extension's updateEmbedElement function
This commit is contained in:
Tim van der Meij 2023-07-01 13:30:37 +02:00 committed by GitHub
commit 73b6ee5325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,8 +132,12 @@ function updateEmbedElement(elem) {
}
elem.type = "text/html";
elem.src = getEmbeddedViewerURL(elem.src);
if (parentNode) {
nextSibling.before(elem);
// Suppress linter warning: insertBefore is preferable to
// nextSibling.before(elem) because nextSibling may be null.
// eslint-disable-next-line unicorn/prefer-modern-dom-apis
parentNode.insertBefore(elem, nextSibling);
}
}