From 87f58a30b75ba4c5e97680271d88a3183cd68dc2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 23 Aug 2022 22:21:40 +0200 Subject: Fix half-finished test (cherry picked from commit 40125ca73b61bfc74e733063af4826af2a5bcacb) --- qutebrowser/javascript/.eslintrc.yaml | 1 + qutebrowser/javascript/stylesheet.js | 1 + tests/end2end/features/misc.feature | 2 +- tests/end2end/features/test_misc_bdd.py | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/qutebrowser/javascript/.eslintrc.yaml b/qutebrowser/javascript/.eslintrc.yaml index 939500aa3..43fd1b6e6 100644 --- a/qutebrowser/javascript/.eslintrc.yaml +++ b/qutebrowser/javascript/.eslintrc.yaml @@ -61,3 +61,4 @@ rules: prefer-named-capture-group: "off" function-call-argument-newline: "off" no-negated-condition: "off" + no-console: "off" diff --git a/qutebrowser/javascript/stylesheet.js b/qutebrowser/javascript/stylesheet.js index 1f1bdbd57..8293e0767 100644 --- a/qutebrowser/javascript/stylesheet.js +++ b/qutebrowser/javascript/stylesheet.js @@ -141,6 +141,7 @@ window._qutebrowser.stylesheet = (function() { } catch (exc) { if (exc instanceof DOMException && exc.name === "SecurityError") { // FIXME:qtwebengine This does not work for cross-origin frames. + console.log(`Failed to style frame: ${exc.message}`) } else { throw exc; } diff --git a/tests/end2end/features/misc.feature b/tests/end2end/features/misc.feature index 5c74647f6..480ce7339 100644 --- a/tests/end2end/features/misc.feature +++ b/tests/end2end/features/misc.feature @@ -153,7 +153,7 @@ Feature: Various utility commands. When I load a third-party iframe # rerun set_css in stylesheet.js And I set content.user_stylesheets to [] - Then the javascript message "Uncaught SecurityError: Blocked a frame with origin * from accessing a frame with origin *. *" should be logged + Then the javascript message "Failed to style frame: Blocked a frame with origin * from accessing *" should be logged # :debug-webaction diff --git a/tests/end2end/features/test_misc_bdd.py b/tests/end2end/features/test_misc_bdd.py index a4bae5c2d..3ede5ffe2 100644 --- a/tests/end2end/features/test_misc_bdd.py +++ b/tests/end2end/features/test_misc_bdd.py @@ -25,6 +25,10 @@ bdd.scenarios('misc.feature') def load_iframe(quteproc, server, ssl_server): quteproc.set_setting('content.tls.certificate_errors', 'load-insecurely') quteproc.open_path(f'https-iframe/{ssl_server.port}', port=server.port) + msg = quteproc.wait_for(message="Certificate error: *") + msg.expected = True + msg = quteproc.wait_for(message="Certificate error: *") + msg.expected = True @bdd.then(bdd.parsers.parse('the PDF {filename} should exist in the tmpdir')) -- cgit v1.2.3-54-g00ecf