Days 29/30: Web elements

A lot of code got moved around last Thursday/Friday!

I finished working on the web inspector, which made dealing with javascript a lot easier! I also added a new utils.javascript Python module for various javascript-related utilities.

While working on the Python/Javascript bridge for web elements, I noticed the functions I define actually "leak" to the page. For Qt 5.7 and newer, I fixed this letting the javascript run in a different world which means it runs isolated from the page's javascript, but can still access and manipulate it. For Qt 5.6 (which I'd still like to support with QtWebEngine, due to Archlinux' PyQt version), this change broke compatibility, so I fixed things up and decided to rename my javascript functions to make conflicts unlikely.

I changed the tab.find_all_elements() method to be async (i.e. call a callback rather than returning the found elements), which is the groundwork to be able to implement it for QtWebEngine. I also wrote a small first proof-of-concept of manipulating web elements from Python with QtWebEngine:

Manipulating web elements

It's about as ugly as it can get, but it demonstrates that getting elements from Python (via Javascript) and then coloring them (via Javascript) works with QtWebEngine, which is the first step towards supporting hints, :navigate and editing fields with an external editor.

While reading the hints code again, I realized how the HintManager class has grown way too big, and cleaned things up: I moved all :navigate related code to its own qutebrowser.browser.navigate module, split up actions (like "click the link" or "download the link") to a separate class, and moved the _resolve_url function to a webelement method.

Since pytest 3.0 is going to be released soon, I also wrote a requirements.txt file installing all test dependencies from git/hg. Unfortunately, I found some issues - at least this way I could report them before 3.0 was released!

Apart from all that, there also was a big number of GitHub issues, pull requests, and other little things - too many to mention them all here!

The plan for this week is to split up webelem into generic/QtWebKit/QtWebEngine parts, get :navigate to work, and then hopefully start looking at hints.