qutebrowser icon indicating copy to clipboard operation
qutebrowser copied to clipboard

Opening two tabs with google.com result in "Unknown error while getting elements"

Open Hi-Angel opened this issue 9 months ago • 5 comments

Version info:

qutebrowser v3.1.0
Git commit:
Backend: QtWebEngine 6.7, based on Chromium 118.0.5993.220 (from api)
Qt: 6.7.0

And it's also tested with latest main branch.

Does the bug happen if you start with --temp-basedir?:

Yes

Description

See steps to reproduce.

I think it's a regression because I haven't see it before. Idk what component regressed though.

I think this is different from #7662, for one because that issue seems to have been related to a WebEngine bug that was fixed.

How to reproduce

  1. Launch qutebrowser --temp-basedir google.com google.com

    Qutebrowser with two tabs should get opened

  2. Type into the search box test and press Enter

  3. Press f to make hints appear over the results page.

Expected

Hints should appear

Actual

Qutebrowser prints Unknown error while getting elements

Hi-Angel avatar May 13 '24 15:05 Hi-Angel

Fixed the title (while writing this issue I found a better way to reproduce).

FWIW, "steps to reproduce" isn't the only way to get this. I don't have a habit of having multiple google pages among opened tabs, but I still routinely get the error. It usually happens when I repeat search within the same tab. For some reason though, with --temp-base-dir it does not happen, but it still can be reproduced with the steps I wrote in the post.

Hi-Angel avatar May 13 '24 15:05 Hi-Angel

Reproduced, fails with Uncaught TypeError: Cannot read properties of undefined (reading 'webelem').

Seems to work fine with Qt 6.6, so this might be another QtWebEngine 6.7 regression...

The-Compiler avatar May 13 '24 16:05 The-Compiler

I don't know if it's the same issue but i get this a lot in the arch linux packages page, even with the temp-dir:

https://archlinux.org/packages/

Although it's not 100%, if i do a search with the page search engine (it's one of my search engines in the config) and open the page of one of the packages then it happens a lot more, but still not 100%:

https://archlinux.org/packages/?q={}

While doing it with the terminal open i got this but only once:

ERROR: JS: [userscript:_qute_js:452] Uncaught TypeError: Cannot read properties of undefined (reading 'click')

All the other times i get this:

ERROR: Unknown error while getting elements

What i typically do is do a quick d(to close) and then u(to undo the tab) and then the hints work since reloading doesn't work.

randomcodepanda avatar Jun 10 '24 14:06 randomcodepanda

I chased this around a little bit, nothing conclusive but suspect it's something on the Qt side. Some notes in case they're helpful:

  • Under normal circumstances webelem.js gets executed on each navigation, this file creates the javascript function which is invoked for hints and which isn't being found
  • Following the repro steps above, the script gets executed on each tab that's opened as expected
  • Where things diverge is when the search is performed, under normal circumstances the script is executed again after the navigation. Following the repro steps, it is not, leading to the issue
  • The script is injected here: https://github.com/qutebrowser/qutebrowser/blob/main/qutebrowser/browser/webengine/webenginetab.py#L1083
  • This call appears to happen when a tab is created, but not on each navigation, in both the normal and pathological flows
  • This is what suggests a Qt issue to me, the semantics seem to be that QWebEnginePage.scripts().insert expects to be given a script once and will manage re-executing it on subsequent navigations (or the subframes flag causes it to work this way), and that's what happens when things are working, but something in the repro steps prevents that from happening

Can also verify that the qute_js script remains in the script list after navigation in the repro steps, it just doesn't seem to get executed

Lanny avatar Jun 17 '24 00:06 Lanny

I'm also affected by this in a lot of sites. Using Qtwebengine 6.7.1

lockie avatar Jun 24 '24 10:06 lockie