Refactoring to use DocRewriter.
This commit is contained in:
parent
68fbf0dded
commit
2d9835591d
|
@ -18,6 +18,8 @@
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// depends on /nscl/content/DocRewriter.js
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
(window.ns || (window.ns = {})).syncFetchPolicy = function() {
|
(window.ns || (window.ns = {})).syncFetchPolicy = function() {
|
||||||
|
@ -116,7 +118,6 @@
|
||||||
try {
|
try {
|
||||||
debug("Soft reload", ev); // DEV_ONLY
|
debug("Soft reload", ev); // DEV_ONLY
|
||||||
try {
|
try {
|
||||||
let doc = window.wrappedJSObject.document;
|
|
||||||
let isDir = document.querySelector("link[rel=stylesheet][href^='chrome:']")
|
let isDir = document.querySelector("link[rel=stylesheet][href^='chrome:']")
|
||||||
&& document.querySelector(`base[href^="${url}"]`);
|
&& document.querySelector(`base[href^="${url}"]`);
|
||||||
if (isDir || document.contentType !== "text/html") {
|
if (isDir || document.contentType !== "text/html") {
|
||||||
|
@ -127,10 +128,7 @@
|
||||||
|
|
||||||
let html = document.documentElement.outerHTML;
|
let html = document.documentElement.outerHTML;
|
||||||
let sx = window.scrollX, sy = window.scrollY;
|
let sx = window.scrollX, sy = window.scrollY;
|
||||||
doc.open();
|
DocRewriter.rewrite(html);
|
||||||
console.debug("Opened", doc.documentElement);
|
|
||||||
doc.write(html);
|
|
||||||
doc.close();
|
|
||||||
debug("Written", html);
|
debug("Written", html);
|
||||||
// Work-around this rendering bug: https://forums.informaction.com/viewtopic.php?p=103105#p103050
|
// Work-around this rendering bug: https://forums.informaction.com/viewtopic.php?p=103105#p103050
|
||||||
debug("Scrolling back to", sx, sy);
|
debug("Scrolling back to", sx, sy);
|
||||||
|
|
|
@ -94,6 +94,7 @@
|
||||||
"/nscl/common/CSP.js",
|
"/nscl/common/CSP.js",
|
||||||
"/nscl/common/CapsCSP.js",
|
"/nscl/common/CapsCSP.js",
|
||||||
"/nscl/common/RequestKey.js",
|
"/nscl/common/RequestKey.js",
|
||||||
|
"/nscl/content/DocRewriter.js",
|
||||||
"/nscl/content/patchWindow.js",
|
"/nscl/content/patchWindow.js",
|
||||||
"/nscl/content/patchWorkers.js",
|
"/nscl/content/patchWorkers.js",
|
||||||
"/nscl/content/DocumentCSP.js",
|
"/nscl/content/DocumentCSP.js",
|
||||||
|
|
2
src/nscl
2
src/nscl
|
@ -1 +1 @@
|
||||||
Subproject commit 9705b11ac271b44c70fc086a162326a83c0b2dbe
|
Subproject commit 3aff8f5c9820437c52dedaeaa0b73631eecbfeee
|
Loading…
Reference in New Issue