From ed84aa8c7b705bf2d3ac715748c644f1642ce585 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 14 Nov 2018 11:43:58 +0100 Subject: [PATCH 1/4] stylesheet.js: Check if document.documentElement exists Fixes #4244 --- qutebrowser/javascript/stylesheet.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qutebrowser/javascript/stylesheet.js b/qutebrowser/javascript/stylesheet.js index b1cdeb26e..3dfefe700 100644 --- a/qutebrowser/javascript/stylesheet.js +++ b/qutebrowser/javascript/stylesheet.js @@ -40,6 +40,10 @@ window._qutebrowser.stylesheet = (function() { // then move the stylesheet to the end. Partially inspired by Stylus: // https://github.com/openstyles/stylus/blob/1.1.4.2/content/apply.js#L235-L355 function watch_root() { + if (!document.documentElement) { + return; + } + if (root_elem !== document.documentElement) { root_elem = document.documentElement; root_observer.disconnect(); @@ -53,7 +57,7 @@ window._qutebrowser.stylesheet = (function() { function create_style() { let ns = xhtml_ns; - if (document.documentElement.namespaceURI === svg_ns) { + if (document.documentElement && document.documentElement.namespaceURI === svg_ns) { ns = svg_ns; } style_elem = document.createElementNS(ns, "style"); From 64fb73df3e31b0fbe45f69c320855d819a1b404a Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Sat, 29 Dec 2018 08:23:09 -0800 Subject: [PATCH 2/4] Add mutation observer when documentElement does not exist yet --- qutebrowser/javascript/stylesheet.js | 1 + 1 file changed, 1 insertion(+) diff --git a/qutebrowser/javascript/stylesheet.js b/qutebrowser/javascript/stylesheet.js index 3dfefe700..96b5aa35d 100644 --- a/qutebrowser/javascript/stylesheet.js +++ b/qutebrowser/javascript/stylesheet.js @@ -41,6 +41,7 @@ window._qutebrowser.stylesheet = (function() { // https://github.com/openstyles/stylus/blob/1.1.4.2/content/apply.js#L235-L355 function watch_root() { if (!document.documentElement) { + root_observer.observe(document, {"childList": true}); return; } From 266a4c16fde37fd36b6913cd8b26bf58067f45e0 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Thu, 14 Feb 2019 17:51:04 -0800 Subject: [PATCH 3/4] Fix lint errors --- qutebrowser/javascript/stylesheet.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qutebrowser/javascript/stylesheet.js b/qutebrowser/javascript/stylesheet.js index 96b5aa35d..ce1cc167d 100644 --- a/qutebrowser/javascript/stylesheet.js +++ b/qutebrowser/javascript/stylesheet.js @@ -58,7 +58,8 @@ window._qutebrowser.stylesheet = (function() { function create_style() { let ns = xhtml_ns; - if (document.documentElement && document.documentElement.namespaceURI === svg_ns) { + if (document.documentElement && + document.documentElement.namespaceURI === svg_ns) { ns = svg_ns; } style_elem = document.createElementNS(ns, "style"); From 4039b3188f327c3eae4590f16d59066daeff5918 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Thu, 14 Feb 2019 17:52:57 -0800 Subject: [PATCH 4/4] Update changelog --- doc/changelog.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index d5d76b181..7e6b21e4e 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -80,6 +80,7 @@ Fixed correctly gets migrated to `always` instead of `when-searching`. - Completion highlighting now works again on Qt 5.11.3 and 5.12.1. - The outdated header `X-Do-Not-Track` is no longer sent. +- A javascript error on page load when using Qt 5.12 was fixed. v1.5.2 ------