summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-11-29 09:05:02 +0100
committerFlorian Bruhin <me@the-compiler.org>2022-11-29 09:21:34 +0100
commitf837da40f2f72c467664208756a4829aa6276670 (patch)
tree071b53a99b07a4fcf5b5234d6d95214bbd19c45c
parent68dbde61fd998334066a500d77fb14a4e0400d2c (diff)
downloadqutebrowser-f837da40f2f72c467664208756a4829aa6276670.tar.gz
qutebrowser-f837da40f2f72c467664208756a4829aa6276670.zip
qt 6: Remove old JS quirks
We don't support Qt 5.12 anymore, so those can go.
-rw-r--r--qutebrowser/browser/webengine/webenginetab.py10
-rw-r--r--qutebrowser/config/configdata.yml2
-rw-r--r--qutebrowser/javascript/quirks/globalthis.user.js12
-rw-r--r--qutebrowser/javascript/quirks/object_fromentries.user.js46
-rw-r--r--tests/unit/javascript/test_js_quirks.py12
5 files changed, 2 insertions, 80 deletions
diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py
index 3ff1547d3..834f783ea 100644
--- a/qutebrowser/browser/webengine/webenginetab.py
+++ b/qutebrowser/browser/webengine/webenginetab.py
@@ -1189,6 +1189,7 @@ class _WebEngineScripts(QObject):
versions = version.qtwebengine_versions()
quirks = [
+ # FIXME:qt6 Double check which of those are still required
_Quirk(
'whatsapp_web',
injection_point=QWebEngineScript.InjectionPoint.DocumentReady,
@@ -1200,19 +1201,12 @@ class _WebEngineScripts(QObject):
# will be an UA quirk once we set the JS UA as well
name='ua-googledocs',
),
+
_Quirk(
'string_replaceall',
predicate=versions.webengine < utils.VersionNumber(5, 15, 3),
),
_Quirk(
- 'globalthis',
- predicate=versions.webengine < utils.VersionNumber(5, 13),
- ),
- _Quirk(
- 'object_fromentries',
- predicate=versions.webengine < utils.VersionNumber(5, 13),
- ),
- _Quirk(
'array_at',
predicate=versions.webengine < utils.VersionNumber(6, 2),
),
diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml
index b7e8d8175..bc6b4c269 100644
--- a/qutebrowser/config/configdata.yml
+++ b/qutebrowser/config/configdata.yml
@@ -606,8 +606,6 @@ content.site_specific_quirks.skip:
- js-whatsapp-web
- js-discord
- js-string-replaceall
- - js-globalthis
- - js-object-fromentries
- misc-krunker
- misc-mathml-darkmode
none_ok: true
diff --git a/qutebrowser/javascript/quirks/globalthis.user.js b/qutebrowser/javascript/quirks/globalthis.user.js
deleted file mode 100644
index b87a956e5..000000000
--- a/qutebrowser/javascript/quirks/globalthis.user.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// ==UserScript==
-// @include https://www.reddit.com/*
-// @include https://open.spotify.com/*
-// @include https://*.stackexchange.com/*
-// @include https://stackoverflow.com/*
-// @include https://test.qutebrowser.org/*
-// ==/UserScript==
-
-// Polyfill for a failing globalThis with older Qt versions.
-
-"use strict";
-window.globalThis = window;
diff --git a/qutebrowser/javascript/quirks/object_fromentries.user.js b/qutebrowser/javascript/quirks/object_fromentries.user.js
deleted file mode 100644
index 6f6ad8b31..000000000
--- a/qutebrowser/javascript/quirks/object_fromentries.user.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// Based on: https://gitlab.com/moongoal/js-polyfill-object.fromentries/-/tree/master
-
-/*
- Copyright 2018 Alfredo Mungo <alfredo.mungo@protonmail.ch>
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to
- deal in the Software without restriction, including without limitation the
- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- sell copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- IN THE SOFTWARE.
-*/
-
-"use strict";
-
-if (!Object.fromEntries) {
- Object.defineProperty(Object, "fromEntries", {
- value(entries) {
- if (!entries || !entries[Symbol.iterator]) {
- throw new Error(
- "Object.fromEntries() requires a single iterable argument");
- }
-
- const obj = {};
-
- Object.keys(entries).forEach((key) => {
- const [k, v] = entries[key];
- obj[k] = v;
- });
-
- return obj;
- },
- });
-}
-
diff --git a/tests/unit/javascript/test_js_quirks.py b/tests/unit/javascript/test_js_quirks.py
index 35ce37f16..4d07ab6e0 100644
--- a/tests/unit/javascript/test_js_quirks.py
+++ b/tests/unit/javascript/test_js_quirks.py
@@ -50,18 +50,6 @@ from qutebrowser.utils import usertypes
id='replace-all-reserved-string',
),
pytest.param(
- QUrl('https://test.qutebrowser.org/test'),
- 'typeof globalThis.setTimeout === "function"',
- True,
- id='global-this',
- ),
- pytest.param(
- QUrl(),
- 'Object.fromEntries([["0", "a"], ["1", "b"]])',
- {'0': 'a', '1': 'b'},
- id='object-fromentries',
- ),
- pytest.param(
QUrl("https://test.qutebrowser.org/linkedin"),
'[1, 2, 3].at(1)',
2,