From 2d9835591d94e73c1ce3105bedcab3780ee4a6e0 Mon Sep 17 00:00:00 2001 From: hackademix Date: Wed, 30 Oct 2024 09:26:59 +0100 Subject: [PATCH] Refactoring to use DocRewriter. --- src/content/syncFetchPolicy.js | 8 +++----- src/manifest.json | 1 + src/nscl | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/content/syncFetchPolicy.js b/src/content/syncFetchPolicy.js index 63c73e2..351e7b9 100644 --- a/src/content/syncFetchPolicy.js +++ b/src/content/syncFetchPolicy.js @@ -18,6 +18,8 @@ * this program. If not, see . */ +// depends on /nscl/content/DocRewriter.js + "use strict"; (window.ns || (window.ns = {})).syncFetchPolicy = function() { @@ -116,7 +118,6 @@ try { debug("Soft reload", ev); // DEV_ONLY try { - let doc = window.wrappedJSObject.document; let isDir = document.querySelector("link[rel=stylesheet][href^='chrome:']") && document.querySelector(`base[href^="${url}"]`); if (isDir || document.contentType !== "text/html") { @@ -127,10 +128,7 @@ let html = document.documentElement.outerHTML; let sx = window.scrollX, sy = window.scrollY; - doc.open(); - console.debug("Opened", doc.documentElement); - doc.write(html); - doc.close(); + DocRewriter.rewrite(html); debug("Written", html); // Work-around this rendering bug: https://forums.informaction.com/viewtopic.php?p=103105#p103050 debug("Scrolling back to", sx, sy); diff --git a/src/manifest.json b/src/manifest.json index ced5b13..bb506ce 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -94,6 +94,7 @@ "/nscl/common/CSP.js", "/nscl/common/CapsCSP.js", "/nscl/common/RequestKey.js", + "/nscl/content/DocRewriter.js", "/nscl/content/patchWindow.js", "/nscl/content/patchWorkers.js", "/nscl/content/DocumentCSP.js", diff --git a/src/nscl b/src/nscl index 9705b11..3aff8f5 160000 --- a/src/nscl +++ b/src/nscl @@ -1 +1 @@ -Subproject commit 9705b11ac271b44c70fc086a162326a83c0b2dbe +Subproject commit 3aff8f5c9820437c52dedaeaa0b73631eecbfeee