Skip to content

Commit

Permalink
Merge pull request #16612 from erm1116/fix-contentscript-updateEmbedE…
Browse files Browse the repository at this point in the history
…lement

Fix reading property of null object in chrome extension's updateEmbedElement function
  • Loading branch information
timvandermeij authored Jul 1, 2023
2 parents 8a95482 + fcf38f6 commit 73b6ee5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion extensions/chromium/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 73b6ee5

Please sign in to comment.