Next up, we have David from Sailfish OS talking about daily blogging, embedded gecko development.
Have a big round of applause, please.
So thanks very much for having me here in the FOSA mobile devices dev room.
It's great to be here in front of everyone.
So yeah, so I'm David Llewellyn Jones and I'm going to talk about some of my experiences,
essentially upgrading the browser for Sailfish OS from one version to the next version of the gecko engine.
And I'll also talk about my experiences.
So one of the things that I did as part of that was I did a daily blog about my experiences performing that development.
And so I'll talk a little bit about that as well.
So first of all, a little bit about me.
So until a year ago, I was a software engineer at YOLA.
And I know it was exactly a year ago because my last day was at FOSDEM when I was at YOLA.
So that was my last day of working there and then I started on the Monday at my next job.
And now I am working for an organization called the Alan Turing Institute as a research data scientist.
But it means that I have some background with Sailfish OS and the development of Sailfish OS.
So for those of you that don't know, YOLA is the company that develops Sailfish OS,
which is a Linux variant that runs on mobile devices, on phones.
I'll explain a little bit more about Sailfish OS in a second.
But now I'm a community member.
I still use Sailfish OS daily as my daily driver, as my main phone.
And so it's nice to have the opportunity to develop for it as a member of the community.
And I put up my avatar there because I guess on the internet I'm known as Flypig
and my website is called flypig.co.uk and that's where I'm doing my daily blogging.
And there will be a little bit of relevance for that later.
So Sailfish OS, like I said, is a Linux distribution.
That runs on smartphones.
It was first released in 2012 on the YOLA 1 phone.
That was a big release at the time.
And it is a busy box and G-Lib C-based Linux OS, so it's not an Android derivative.
It runs on libhybris and also natively on things like the Pine phone.
YOLA is the company that develops the operating system.
It is free for there.
So there are ports of it onto other devices that are community ports.
But there is also a commercial layer that you can pay for to get Android app support
to run Android device, Android apps on top of it as well.
When I was at YOLA I worked on a whole bunch of different things including the sync support.
I worked on some user interface stuff.
I worked on the email client, a whole bunch of different things.
One of the things that I worked on was the Gecko rendering engine which is used for the browser.
So that's something that I gained a bit of experience with.
And that's called Selfish Browser and that is essentially what I'm going to be talking about today.
So I mentioned that Selfish Browser uses the Gecko engine for its rendering.
And I'm sure a lot of you will be familiar with Gecko, but again for those of you that aren't,
Gecko is Mozilla's rendering engine that is used for Firefox.
So it is a rendering engine that is underneath Firefox and it is a little bit like these other rendering engines
that I've listed there like Blink which is the rendering engine that is developed essentially by Google
and that is used in Chrome.
It's used in, I guess it's used in Edge.
It's used in a bunch of other browsers.
Brave, Vivaldi browsers like that.
It's quite widely used.
Webkit which is the one that Apple forked from the KDE Webkit browser
which is primarily I guess used in Safari.
And I think Epiphany, no browser uses it as well.
I've also put Netscape up on there.
Have any of you used Netscape?
Yeah, okay.
Wow, that's impressive.
Okay, that's really good.
So I mean I remember Netscape from the, sorry.
Netscape.
Okay, Netscape.
Sorry, so I said Netscape.
Have any of you used Netsurf?
I beg your pardon, that's a different question.
Yeah, okay, there's still a bunch of you that have used Netsurf.
So I remember Netsurf from its days on Risco S.
So it's actually a very, very, had a long history,
but it's a nice engine as well.
So Gecko is like one of those engines,
but it is used for Firefox.
And it was released in 2000, as it says there.
Netscape 6 was when it was released.
So it's had quite a long history.
And it has also had quite a long history on selfish OS.
So it's quite unusual for mobile browsers to be using Gecko.
I think selfish OS might be unique amongst the mobile delivery.
The mobile derivatives in using Gecko.
And part of the reason for that is because it's not really set up
for embedded development, but I'll come back to that.
The history is that it's not a fact of when selfish OS was
essentially a development of MIMO,
which was the Nokia operating system that ran on the N900.
And it had a browser called MicroB that was Gecko based.
And at that point in time, WebKit wasn't really as developed as it is now.
So Gecko was perhaps a more natural choice.
And essentially there is this thing called embedLight,
which is the Gecko method of embedding a browser into other applications,
which is used in selfish OS to allow this to happen.
And I'll talk a little bit about embedLight later.
But it essentially allows you to run Gecko, the rendering engine,
as either a thread or a process in another app.
So WebKit is well set up for this.
That's why you have things like Electron, which are using WebKit as the back end.
But Gecko is not so well set up for this.
And it's not particularly supported by Mozilla.
In fact, I have this quote here.
So this is a quote from a guy called Chris Lord.
It's an old quote from 2006.
At that point in time, Chris Lord was working for Mozilla.
So he's not anymore, as I understand it, but this is from his blog,
and this was from when he was.
And he says, Gecko has limited embedding capability
that's not well documented, not well maintained,
not heavily invested in.
And at various points in its history,
there have been embedding APIs and capabilities,
but they've either been dropped or left to bit rot.
And it mentions IPCLight.
IPCLight is another name for embedLight.
So it's the same thing.
So as you can see, essentially, it's something that Mozilla doesn't really support.
And that has, over time, caused increasing difficulty
in making sure that this browser is working on selfish OS.
I want to talk a little bit about the structure,
because it's actually quite interesting.
So working with Gecko, so as I said,
I have some history from YOLO working with Gecko,
but it's actually a really nice set of technologies to work with.
In selfish OS, there is the structure where it works.
Gecko is at the bottom.
Zool runner, XUL runner, is the library that is built for embedding
from the Gecko source.
And on top of that, we have this layer called cuteMozEmbed,
which was also at one point in time in Mozilla technology,
but is now essentially maintained by YOLO,
I think that's fair to say.
And it provides a cute widget that embeds the browser inside it.
That's all.
And then on top of that, you have embedLightComponents,
which is a set of JavaScript shims that run inside the Gecko JavaScript engine
and provide support for the user interface.
And then finally, you have the selfish browser executable,
which is actually the app that you run,
and it's the user interface that you see when you run the app.
So there's quite a stack there.
And it's built of a whole bunch of different technologies.
So Gecko itself is made up of primarily C++ with a bunch of Rust.
It's gradually converting to Rust.
A big chunk of JavaScript as well in there,
and also this small IPC layer,
which provides inter-process communication.
CuteMozEmbed is, I think, all C++,
and embedLightComponents is all JavaScript.
And then on top of that, selfish browser is a mixture of C++ and QML.
So it's a cute-based browser.
So you can see there's a whole bunch of really interesting technologies
that are being used for it.
So for me, it's a really nice thing to be working with.
But as I said, there is a problem with Gecko,
which is essentially providing this route for upgrade of the browser.
So there is this upgrade problem that means that it's actually quite hard
to upgrade the browser from one version to the next.
So to give an example, when I was working at YOLA last year and before that,
so in February 2021, we upgraded it to ESR60.
So ESR is Mozilla Terminology for Extended Service Release.
I think I have that right.
I think it's not support, but I always say it wrong.
I think it's extended service release.
So it's essentially releases that have bug fixes and security updates for 12 cycles,
so 12 normal Firefox releases or thereabout, so I understand it.
And YOLA tends to upgrade to the next ESR release
because that provides longer-term support,
and it means that you don't have to keep up with all of the versions
all the time, which is very difficult.
But it takes a long time to do these jumps.
So in February 2021, it was upgraded to 60 in March 2022.
A year later, it was up for doing it again.
And because I knew it was going to be quite a big job,
I also felt like I didn't really want to do it alone,
so that's one of the reasons why I decided to blog about it.
I would decide to do this daily blog that would not only allow me to draw people in,
but also keep the community informed about where things were at.
So I'll talk a little bit about this dev diary.
So what is a dev diary?
I'm sure you probably already know, but let me give you a quote.
So this is a quote from Jay Wilson, who is a person on the Internet.
And he says,
A developer diary is where you write about developer things.
It can be the record of what you worked on last,
some decisions made by stakeholders in the product,
or a neat way to accomplish this task.
It really comes down to what you want to put into it.
Okay, so essentially it can be anything,
but my experience with dev diaries was with game development,
because I used to follow, I think originally it was prison architects
that had these video diaries.
They were a crowdsource funded game,
and I really enjoyed them.
I thought they were fantastic.
But they worked really well for game developers,
because they're actually, to a larger centre, marketing tool,
because they have a lot of really great assets that they can share
whilst they're doing the development of graphics,
things like that, screenshots.
So they worked really well as developer diaries.
But for me, it was more about kind of capturing the process
and making me think about the process
and motivating me to try and actually carry on working on it,
which I think is what I put on this slide, hopefully.
So yeah, an aid memoir.
So I found it useful to write about this stuff,
so that I could refer back to it.
So if I write what I've done, it means essentially
I actually have this massive text file
where I've written all of this stuff,
and I can just search it to find out what particular changes.
I made a wish particular point.
My memory is not always so great,
so it's very helpful for me to do that.
It helped me to structure my thoughts
in terms of architecting what changes I was making.
It made me kind of think through it in a logical and consistent way.
And it also motivated me to work on it on a daily basis,
which was actually a really big deal for me,
because otherwise I would drift.
So that was actually really important.
But there are some downsides as well.
Ah, am I coming onto downsides?
Okay, before I get to the downsides,
it was also a way to involve the community in the process.
So like I said, it was...
So these browser upgrades are something
that the community rightly sees as important.
When you have an alternative operating system on your phone,
you can't run...
I appreciate I'm telling you all stuff that you already know,
but you can't necessarily run all of the Android apps
that you might want to be able to run.
And in that case, having a good web browser is really important,
because that provides you access to the services that you need.
So an update browser is really important.
And so keeping users aware of how things were developing
was much nicer than just like after a year,
saying, you know, here's a new version.
It was actually much nicer, I thought,
to see that process through.
And also to maybe get other people to come in
and help with some stuff.
But as I said, there are some downsides as well.
So for example, I find that taking...
writing and coding at the same time takes about twice as long
as just coding.
You know, I think that's probably not too bad.
That's probably what I'd expect.
Like I said, there are benefits to keeping a record.
Daily updates are a motivation,
but they're also an incredible bind.
So when you get home late from work and you've had a really long day
and you know you've got to get a blog post out,
you still have to get it out, right?
That's the idea.
So there are certain times, so I feel like the balance is in favour of...
it makes me motivated in a positive way.
There have been a few times I've been a bit grumpy about it.
But overall, I think it's been a very positive experience for that.
And what I found was that it works really well
in certain parts of the coding process.
So it works well when you've got small tasks that can split me split up daily.
If you have a particularly long task that's going to take five days
of just pure thought to work through the architecting of it,
it's a bit of a disaster because you're writing the same stuff in cycles over and over again.
So I guess those were like learning things that I had as I went along.
And also, blogging, daily dev-diring, I guess,
is also really good if you have visual assets to share.
So I was mentioning about game development there, it's really good for stuff.
But if you have graphics that you can share, that's also really helpful.
All right, so very briefly, this is the timeline that I went through.
So the reason I was telling you about this is about dev-diring
is because I recommend it as a thing to go through if you're developing something.
I think it's really helpful.
This is the timeline. So I've now been doing it for 149 days.
I took two weeks off, I think, in August or thereabouts,
and I've taken two weeks off over FOSDN because otherwise my head would have exploded.
But otherwise, I've been doing it daily for this long.
And you can see that it took 45 days just to get the build working.
And that was a real problem because you're developing completely blind, right?
You're just making changes and you just don't know whether they're going to work until it builds.
And then it took another five days before it would actually execute,
and then a whole bunch more days it took up to 83 days before the rendering was working,
which was quite an experience, I have to say.
Getting it working was quite nice.
And then after that, changes came a bit quicker,
and I'm now back to kind of figuring things out at getting sites to render.
So, you know, that's been quite an interesting experience.
But the community response, I have to say, has been utterly overwhelming,
and I've been really astonished by it.
So people have just been incredibly generous and incredibly nice about all this stuff
in a way that I, you know, these diaries are really dull, I can assure you,
and yet people still read them and they still comment about them.
And I sometimes feel like I joined the wrong internet.
You know, everyone in the media seems to say that the internet is full of trolls
and full of scammers and full of, you know, foreign agents that are trying to swindle you in some way or another.
My experience is not that.
You know, I'm sure those people are out there.
I'm not saying they don't exist, but for me, I've just had positive experiences all the way.
So that's been really nice.
All right.
And one thing in particular is that there is one community member called Thig,
and he routinely generates art for me to put in the blog, which I find really,
which is just wonderful.
This is one of the images that he created.
And yeah, so I just use them, and I think it's really cute.
Although I feel like it's not a fair fight.
I'm not sure.
I feel like the Fox and the Gecko team me up on me there.
But anyway, so a shout out to him.
I think that's really good stuff.
And also to Ulva.
Have I got time to do a quick demo?
Yep.
Okay.
I'm getting nodding.
That's good.
So very quick demo.
So it does work.
There in my slide.
You don't want to see those.
So let me run it.
So what I discovered when I just try this a second ago, so it will crash probably,
but was that the network connectivity down here is really poor.
But as you can see, it does render, and it's pretty okay.
So this site is full of SVGs, and yet they're working okay.
One thing I'm particularly happy about is the fact that WebGL is working.
So hopefully, there we go.
So this is a little bit of shader code that's running in the browser.
So I appreciate the applause, but I have to say it just worked.
I just did the upgrade and it worked.
And let me run this.
So there's a bunch of stuff that's still turned off.
So this is not up as high.
So for example, WebRTC is off, is disabled, and there's a bunch of other stuff to get it to work.
So hopefully this number will go higher, but it's still looking okay.
So just finally, that's the demo.
I just want to say, closing thoughts.
So writing Dev.io I found was a really good experience.
I recommend it.
If you're going to do it, bear in mind it's literature, not code.
Just write your thoughts.
Work a couple of days in advance so that you've got a bit of a buffer,
and stick to a really strict cadence.
And write about what you think your tomorrow self is going to want to know
about what you're doing today.
And then finally, I just want to say, like I said,
I had this overwhelmingly positive experience from the community,
so I just wanted to thank all the people that have been reading the post.
This slide took a long time to prepare, I have to tell you.
But like I say, it's been really overwhelming, and I really appreciate it.
And if I have forgotten you from this slide, I really do apologize.
I tried my best.
Thanks very much.
APPLAUSE
Great talk.
Let's do the questions.
I'm sorry, this is not related to blogging.
Is it really using WebKit much easier than using Gekko?
So essentially, should selfish be using WebKit?
Is your question?
Yeah, I mean, it's a very natural question.
It's a very natural question.
So what I would say is that my understanding is that it has been thought about,
and the decision is that it would be more effort to do that.
So all of those layers on top of the rendering engine that I showed,
they are doing stuff that is selfish-y, right?
And in the user interface, they are providing links between the two.
There is a lot of interaction there, which is one of the reasons why this upgrade is so hard.
But re-implementing all of those things for WebKit would actually be a lot of work as well.
Because I've heard some complaints from other projects,
I think some browser-based browser has moved from Gekko to WebKit.
Right, yeah.
So like I said, WebKit is set up for embedding, so it is a natural choice, I think.
But I have to say, I'm actually very proud of the fact that selfish still uses Gekko.
I guess most people don't care about the rendering engine,
but I kind of think that is one of its attractive properties.
But it is a very fair point.
Since you are not working for Joll anymore, are they also somewhat involved in this process?
I mean, I guess they are interested in what you are doing,
and I'm guessing they will use this.
Sure, well.
But what is kind of to say to Stereo?
That's a really good question.
So I would say there are some Jolla people up on this slide.
And so I still have contact with the people I worked with previously,
and so this has not been done without their input.
Yeah, I mean, they've been super helpful.
People from Jolla have been helping me all the way through,
and I don't mean just encouragement, they've been making co-changes as well to help.
But I haven't had a discussion with them about what will happen eventually.
So maybe eventually they'll say, actually, we don't want it with.
Let's see.
But yeah, so yeah, I have a lot of really good support from them.
Yeah, hello.
So first of all, I'm one of those Jolla people,
but I'm not involved in it, but I'm going to say we follow it.
And it's great that it does the work, so it's really awesome.
And I forgot to speak in this microphone.
And one thing I want to say, or I'm not sure if it's really a question even,
I think you asked, should we use this WebKit?
You have to first think WebKit or Blink.
There's a big difference, and I think there are big advantages of using
what's embedded, a converter versus using Blink, even,
because the engine is faster, in my opinion, and doesn't use so much memory.
And I was thinking, couldn't also other users contribute to it,
they're not necessarily using save features,
because the whole API stack, except the service browser,
is not really service specific either.
Is this a point?
Yeah, no, I mean, that is a really good point.
So in theory, it is not selfish specific.
It is an embeddable version of Gecko.
So I think that's true.
So I have to be honest, I wouldn't know where to go to, though,
to find those users who would be interested in doing that.
I'm not saying they're not out there.
I'm just saying I lack the experience to know, I think, it's part of the problem.
My community is the selfish community, so that's what I know about.
Yeah, it's a really good point, though.
Yeah, I know. I just suggest, because in my opinion,
healthy Web is important, and having just any variation of WebKit on it
is just not healthy, in my opinion, and just try it.
It's not so far off, I would say, if people take in the effort, of course.
Yeah, interesting point. Thanks.
Any more questions?
Yeah, come around.
Yeah, hi. Have you talked to Mozilla people,
if they are happy to accept some of your patches even behind the flag,
just to help you out and to elaborate the process?
So that's a good question.
I have to ask.
Okay, so Bjorn has asked.
I have asked about it because I have a feeling it's kind of weird
that they talk about mobile, but then they just read Android,
because, well, they have no iOS, because they just ask.
But I don't think there's entirely interest in this idea, specifically,
but just interest in mobile.
I'm not sure.
They say they go where the users are, so go somewhere else,
and write their name.
Right, so I guess it's something that we should probably push harder on,
in that case. It looks like there is...
And someone is not even able to know about it anymore.
Yeah.
Yeah, it's probably something that we could try harder to do, actually.
It's a good idea.
I think the biggest problem is that we are behind head,
so we're not...
I think we would have to push patches that we couldn't then test.
Essentially.
Yeah, well, my personal opinion is that Mozilla developers would love to help,
because Jekyll Aging is not very popular,
especially compared to other engines.
So having somebody to use it, it's a good thing for them.
Actually, yeah, but it would be nice to try.
Give a round of applause for David.
Thank you so much.
Thank you.