See https://bugzilla.mozilla.org/show_bug.cgi?id=1735738 for reference.
const imagePromises = [];
  for (let i = 0, ii = images.length; i < ii; i++) {
    imagePromises.push(
      new Promise(function (resolve, reject) {
        const xhr = new XMLHttpRequest();
        xhr.responseType = "blob";
        xhr.onload = function () {
          const reader = new FileReader();
          reader.onloadend = function () {
            resolve(reader.result);
          };
          reader.readAsDataURL(xhr.response);
        };
        xhr.onerror = function (e) {
          reject(new Error("Error fetching inline image " + e));
        };
        xhr.open("GET", images[i].src);
        xhr.send();
      })
    );
  }
  return Promise.all(imagePromises);
}
async function resolveImages(node, silentErrors = false) {