Skip to content

Commit

Permalink
Fixed soft reload messing with non UTF-8 encodings (thanks "Quest" fo…
Browse files Browse the repository at this point in the history
…r reporting).
  • Loading branch information
hackademix committed Sep 10, 2020
1 parent 486da3b commit 911469e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/content/syncFetchPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@

let softReload = ev => {
try {
//let html = document.documentElement.outerHTML;
debug("Soft reload", ev); // DEV_ONLY
try {
let doc = window.wrappedJSObject.document;
Expand All @@ -52,15 +51,13 @@
if (isDir || document.contentType !== "text/html") {
throw new Error(`Can't document.write() on ${isDir ? "directory listings" : document.contentType}`)
}
DocumentFreezer.unfreeze();
let html = document.documentElement.outerHTML;
doc.open();
console.debug("Opened", doc.documentElement);
DocumentFreezer.unfreeze();
(async () => {
let html = await ((await fetch(document.URL)).text());
doc.write(html);
doc.close();
debug("Written", html)
})();
doc.write(html);
doc.close();
debug("Written", html);
} catch (e) {
debug("Can't use document.write(), XML document?", e);
try {
Expand Down

0 comments on commit 911469e

Please sign in to comment.