aboutsummaryrefslogtreecommitdiff
path: root/bg
diff options
context:
space:
mode:
authorStef Gijsberts <stef@stef.link>2021-11-03 20:05:27 +0100
committerYuchen Pei <hi@ypei.me>2021-11-10 14:52:09 +1100
commit3b8c600fbe0add03b038395779182e2a9c48b295 (patch)
treefad557d0be0795539b1b479d26a9af20d5637c83 /bg
parenta3c44b07a5f587311926fedf017e110cfa5d9255 (diff)
Fix infinite loop
LibreJS got stuck in an infinite loop whenever a <link rel="jslicense"> occured inside a HTML head tag. This was due to a small programming mistake (refer to the git diff for details). It caused Icecat to become unresponsive (tested on Icecat 78.10.0esr). This notably affected users trying to visit lichess.org, and reportedly users trying to visit scratch.mit.edu [0]. [0]: https://lists.gnu.org/archive/html/bug-librejs/2020-06/msg00000.html
Diffstat (limited to 'bg')
-rw-r--r--bg/ExternalLicenses.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/bg/ExternalLicenses.js b/bg/ExternalLicenses.js
index d5bcd4e..758b92d 100644
--- a/bg/ExternalLicenses.js
+++ b/bg/ExternalLicenses.js
@@ -118,7 +118,7 @@ var ExternalLicenses = {
cache.webLabels = {href};
let move = () => !!doc.head.insertBefore(link, doc.head.firstChild);
if (link.parentNode === doc.head) {
- for (let node; node = link.previousElementSibling;) {
+ for (let node = link; node = node.previousElementSibling;) {
if (node.tagName.toUpperCase() === "SCRIPT") {
return move();
}