List items
Items from the current list are shown below.
Blog
4 Jan 2024 : Day 128 #
It's the big one today! Finally we reached 27 days of Gecko development work. Looking at how things are progressing, it's looking hopeful that the work may be completed before we hit the 28-th days of work. But I'm not willing to make any more of a prediction than that!
Before moving on to coding, let's dwell on this a little further. I've been spending, I think (I've not actually been measuring this) between two to three hours working on this a day. Probably half that time is spent coding and the other half writing these posts. So that means 90 minutes of coding time spent on gecko for each of the 27 days.
That makes 192 hours of work, or 24 work days (eight hours a day), or nearly five weeks of "Full Time Equivalent" work. During holidays I've probably spent a bit more than this, so let's call it seven weeks.
That might sound like a lot, but in practice it's not much time at all when it comes to software development. I can imagine progress probably looks very slow to anyone reading this, but unfortunately it's more a product of the fact I can only spend some limited amount of time on this per day. I do wish there were more hours in the day to work with!
Alright, let's waste no more time on this side discussion then and get straight back to coding.
It's finally time to move on from printing, as promised, to User Agent string testing. This falls under Issue #1052 which I've now assigned to myself as my next task.
Let's get some bearings. The magic for User Agent fixes happens inside a file called ua-update.json that can be found inside your browser profile folder. It's a JSON file but un-prettified into a single line which makes it a little tricky to read. We can make it a little clearer by re-prettifying it. I'm just putting the first few lines here to give an idea about the contents, but feel free to run this on your own phone if you'd like to see the full list of fixes.
On DuckDuckGo the User Agent string is announced as "Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Firefox/91.0)". That doesn't look too bad. But it's also not one of the sites we currently have an override set for.
Neither Bing nor Google, both of which are in the list, do the courtesy of echoing back the user agent when you search on it and none of the other sites in the list look promising for doing this either. So I'm going to hack a user agent string in for DuckDuckGo to see whether or not we get any results.
I'll do this by just switching the msn.com string to duckduckgo.com instead.
We can conclude that the ua-update.json file is working as expected, but we will need to update it to reflect the new rendering engine version. Before proceeding I'm going to undo the change I just made. It's not like it really matters on my development phone, but it helps keep things neat and tidy.
Although that's updated the overrides, unfortunately it hasn't fixed some of the broken sites such as DuckDuckGo.com, which still just displays a blank page. My recollection is that this happened with ESR 78 too, but there must have been a different reason for it. There may even be an answer in amongst the patches. This will have to be my next task for tomorrow.
If you'd like to read any of my other gecko diary entries, they're all available on my Gecko-dev Diary page.
Before moving on to coding, let's dwell on this a little further. I've been spending, I think (I've not actually been measuring this) between two to three hours working on this a day. Probably half that time is spent coding and the other half writing these posts. So that means 90 minutes of coding time spent on gecko for each of the 27 days.
That makes 192 hours of work, or 24 work days (eight hours a day), or nearly five weeks of "Full Time Equivalent" work. During holidays I've probably spent a bit more than this, so let's call it seven weeks.
That might sound like a lot, but in practice it's not much time at all when it comes to software development. I can imagine progress probably looks very slow to anyone reading this, but unfortunately it's more a product of the fact I can only spend some limited amount of time on this per day. I do wish there were more hours in the day to work with!
Alright, let's waste no more time on this side discussion then and get straight back to coding.
It's finally time to move on from printing, as promised, to User Agent string testing. This falls under Issue #1052 which I've now assigned to myself as my next task.
Let's get some bearings. The magic for User Agent fixes happens inside a file called ua-update.json that can be found inside your browser profile folder. It's a JSON file but un-prettified into a single line which makes it a little tricky to read. We can make it a little clearer by re-prettifying it. I'm just putting the first few lines here to give an idea about the contents, but feel free to run this on your own phone if you'd like to see the full list of fixes.
$ python3 -m json.tool ~/.local/share/org.sailfishos/browser/.mozilla/ua-update.json { "msn.com": "Mozilla/5.0 (Android 8.1.0; Mobile; rv:78.0) Gecko/78.0 Firefox/78.0", "r7.com": "Mozilla/5.0 (Android; Mobile; rv:78.0) Gecko/78.0 Firefox/78.0", "baidu.com": "Mozilla/5.0 (Android 8.1.0; Mobile; rv:78.0) Gecko/78.0 Firefox/78.0", "bing.com": "Mozilla/5.0 (Android; Mobile; rv:78.0) Gecko/78.0 Firefox/78.0", "kuruc.info": "Mozilla/5.0 (Android; Mobile; rv:78.0) Gecko/78.0 Firefox/78.0", [...] }This file is generated using a process, so represents the end result of that process. The processing step happens during the sailfish-browser build and the raw pieces can be found in the data folder:
$ tree data data ├── 70-browser.conf ├── prefs.js ├── preprocess-ua-update-json ├── README ├── ua │ ├── 38.8.0 │ │ └── ua-update.json │ ├── 45.9.1 │ │ └── ua-update.json │ ├── 52.9.1 │ │ └── ua-update.json │ ├── 60.0 │ │ └── ua-update.json │ ├── 60.9.1 │ │ └── ua-update.json │ └── 78.0 │ └── ua-update.json ├── ua-update.json └── ua-update.json.in 7 directories, 12 filesThere are also some helpful instructions to be found in this folder:
$ cat data/README How to update ua-update.json ============================ 0) git checkout next 1) Edit ua-update.json.in 2) Run preprocess-ua-update-json 3) Copy preprocessed ua-update.json to ua/<engine-version> 4) git commit ua-update.json.in ua/<engine-version>/ua-update.json 5) Create merge requestBefore we get into these steps let's first find out what User Agent string is actually being used when we visit a Web site. The easiest way to do this is to actually go to a site that echoes the User Agent back to us.
On DuckDuckGo the User Agent string is announced as "Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Firefox/91.0)". That doesn't look too bad. But it's also not one of the sites we currently have an override set for.
Neither Bing nor Google, both of which are in the list, do the courtesy of echoing back the user agent when you search on it and none of the other sites in the list look promising for doing this either. So I'm going to hack a user agent string in for DuckDuckGo to see whether or not we get any results.
I'll do this by just switching the msn.com string to duckduckgo.com instead.
$ cd ~/.local/share/org.sailfishos/browser/.mozilla/ $ cp ua-update.json ua-update.json.bak $ sed -i -e 's/msn\.com/duckduckgo\.com/g' ua-update.jsonNow when we visit the site we get a newly updated User Agent string: "Mozilla/5.0 (Android 8.1.0; Mobile; rv:78.0) Gecko/78.0 Firefox/78.8".
We can conclude that the ua-update.json file is working as expected, but we will need to update it to reflect the new rendering engine version. Before proceeding I'm going to undo the change I just made. It's not like it really matters on my development phone, but it helps keep things neat and tidy.
$ mv ua-update.json.bak ua-update.jsonBack to the sailfish-browser repository and I'll do a search-and-replace on the references to "78.0" and replace them with "91.0". The file may need a little more refinement based on how the rendering engine works with different sites, but this simple change should give us a more solid base to build on.
$ pushd data $ sed -i -e 's/78\.0/91\.0/g' ua-update.json.in $ git diff | head -n 10 diff --git a/data/ua-update.json.in b/data/ua-update.json.in index be4352e6..584720c0 100644 --- a/data/ua-update.json.in +++ b/data/ua-update.json.in @@ -1,116 +1,116 @@ // Everything after the first // on a line will be removed by the preproccesor. // Send these sites a custom user-agent. Bugs should be included with an entry. { - // Ref: "Mozilla/5.0 (Mobile; rv:78.0) Gecko/78.0 Firefox/78.0" + // Ref: "Mozilla/5.0 (Mobile; rv:91.0) Gecko/91.0 Firefox/91.0"That looks pretty healthy. Let's complete the rest of the steps as suggested in the README.
$ ./preprocess-ua-update-json [sailfishos-esr91 e00b4335] [user-agent] Update preprocessed user agent overrides 1 file changed, 89 insertions(+), 89 deletions(-) rewrite data/ua-update.json (98%) $ gedit ua-update.json $ ls ua 38.8.0 45.9.1 52.9.1 60.0 60.9.1 78.0 $ mkdir ua/91.0 $ cp ua-update.json ua/91.0/ $ git add ua-update.json.in ua/91.0/ua-update.json $ git commit -m "[sailfish-browser] Update user agent overrides for ESR 91.0" $ popdSo I've now built and installed the updated sailfish-browser package. Checking the ua-update.json file on my phone I can see that the file hasn't changed after the installation. However, after deleting the ua-agent-json file in the profile folder and re-running the browser, the changes have now taken root. Great.
Although that's updated the overrides, unfortunately it hasn't fixed some of the broken sites such as DuckDuckGo.com, which still just displays a blank page. My recollection is that this happened with ESR 78 too, but there must have been a different reason for it. There may even be an answer in amongst the patches. This will have to be my next task for tomorrow.
If you'd like to read any of my other gecko diary entries, they're all available on my Gecko-dev Diary page.
Comments
Uncover Disqus comments