From 99b1a62c9787bbc9232963d2cf8c1cee97140db6 Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Thu, 31 Dec 2020 13:40:03 +0100
Subject: [PATCH] Use `remove`, rather than `removeChild`, when removing the
 temporary `Text` nodes used in `FirefoxCom`

This is the "modern" way of removing a node from the DOM, which has the benefit of being a lot shorter and more concise.

Also, this patch removes the `return` statement from the "pdf.js.response" event listener, since it's always `undefined`, given that none of the `callback`-functions used here ever return anything (and don't need to either). Generally speaking, returning a value from an event listener isn't normally necessary either.
---
 web/firefoxcom.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/web/firefoxcom.js b/web/firefoxcom.js
index fbe9091e6..f65e9bc7e 100644
--- a/web/firefoxcom.js
+++ b/web/firefoxcom.js
@@ -48,7 +48,8 @@ const FirefoxCom = (function FirefoxComClosure() {
       });
       request.dispatchEvent(sender);
       const response = sender.detail.response;
-      document.documentElement.removeChild(request);
+      request.remove();
+
       return response;
     },
 
@@ -68,10 +69,9 @@ const FirefoxCom = (function FirefoxComClosure() {
           event => {
             const node = event.target;
             const response = event.detail.response;
+            node.remove();
 
-            document.documentElement.removeChild(node);
-
-            return callback(response);
+            callback(response);
           },
           { once: true }
         );