One month in Blink

On October 1, I began working in Opera’s new Web Technology team, tasked with improving the Web platform by contributing to the Chromium and Blink projects. Most of my effort has been on the Blink side, and it has been a very pleasant experience so far. Since I’ve worked so much with <video> before, I jumped right into that area and looked for things to work on. Chromium/Blink is a big code base which will take time to get intimately familiar with, but I was still able to make small improvements in a few areas.

Event handler attributes

My colleague Henrik reported that onplay and friends were missing on HTMLMediaElement, and I thought it surely would be easy to fix. However, I am easily distracted, so instead of just adding them I decided to implement GlobalEventHandlers and WindowEventHandlers, which ended up taking me 11 commits and even requiring IDL code generator (Perl!) changes. Now onplay is supported, but you probably don’t want to use it – use addEventListener(‘play’, func) if uncertain!

While in the neighborhood, I also made the onerror attribute on <body> and <frameset> work per spec. I was a bit surprised to find this broken, presumably it isn’t that important for site compat…

Removing features

Although I’m quite happy with Blink code, I was surprised to find how much non-standard stuff there is, including prefixed APIs, undocumented quirks and things that have been removed from the spec. Fortunately, the Blink project is supportive of removing these things, with care, and I’ve now picked most of the low-hanging fruit on HTMLMediaElement, getting rid of a weird npr.org quirk, webkitPreservesPitch, webkitHasClosedCaptions, webkitClosedCaptionsVisible, startTime and initialTime.

Counting features

When there’s a risk that removing a feature is going to break the Web, the first step is to figure out by how much. UseCounter counts (opt-in) which features are used on each page view, so I went ahead and added/improved counters for various things that would be nice to eventually remove: a bunch of prefixed HTMLMediaElement APIs, the TextTrackCue constructor, the beforeload event and the two (!) prefixed fullscreen APIs. There’s also the media attribute on <source>, which is still in the spec, but getting usage data will help us decide whether to remove it.

Fixing bugs

It’s a beautiful thing when you can fix a bug just by removing code, and I did so this month by removing the width and height properties from the <video> intrinsic size logic. After my fix intrinsic size is still not per spec, but at least it’s less wrong.

In my only non-trivial Chromium contribution, I made CookieMonster wait for disk flush when deleting cookies, so that cookies are really gone when the UI says they are. This involved fixing a flaky test, which was fun.

Loading text tracks

I began looking into <track> and WebVTT and soon stumbled upon a FIXME in TextTrackLoader, which is what feeds data to the WebVTT parser. Unable to resist the bait, I refactored TextTrackLoader to use RawResource and removed TextTrackResource. Finally, I fixed some other minor issues and fiddled a bit with the TextTrack IDL.

One year ago

Also this month, one year has passed since my final commit in Core (Presto), which was on October 12, 2012. I was a little bit sad when I noticed this anniversary, but at the same I’m really happy about working on Chromium and Blink. Hopefully the next month will be even better!

Web Technology

The Web Technology team (source)

Weird commit log

I stumbled upon something strange on page 895 of Swedish TV4’s teletext:

895

This is clearly counting the number of commits in source code repositories, but why is this information in the teletext system?

Favorite podcasts

About a year ago I discovered the delights of listening to podcasts, and I have done so practically daily during my commute. Unfortunately, the screen on my phone recently went black and for a while I thought my feeds were lost. I did eventually managed to extract them, so now I’m making a public backup, in the form of podcast recommendations:

60-Second Space (RSS) is one of several bite-sized podcasts from Scientific American. Since it’s so short I seldom remember anything, but when queued up it can serve as an overview of recent space news.

Discovery (RSS) is a science podcast from the BBC.

Freethought Radio (RSS) is a podcast with news, music and interviews from the Freedom from Religion Foundation. The news is rather US-specific, so I just pick the episodes with interesting interviews.

Humanistpodden (RSS) is the official podcast of Humanisterna, a Swedish secular humanist organization. Some episodes are in English, e.g. the excellent interviews with Ophelia Benson and Peter Singer.

Little Atoms (RSS) is a “talk show about ideas and culture.” The host sounds like a really nice guy, maybe it’s the British accent?

Planetary Radio (RSS) is the Planetary Society’s show with news and interviews. It sounds very scripted and a bit dry, but the actual content is interesting.

Red Planet Radio (RSS) is a newly launched podcast from the Mars Society.

Science Talk (RSS) is a science podcast from Scientific American.

Science Weekly (RSS) is a science podcast from The Guardian.

Skeptoid (RSS) is my probably my favorite podcast, see my previous post for episode recommendations.

Språket (RSS) is a Swedish radio show about the Swedish language, and is what got me started listening to podcasts.

StarStuff (RSS) is by far the best space podcast that I have found. The host, Stuart Gary, has a nice Australian accent and appears to be incredibly knowledgeable when interviewing the authors of recent papers, etc.

The Atheist Experience (RSS) is actually a call-in TV show from Austin, Texas, but I listen to it as a podcast. I recommended episode #795 on Twitter, with my favorite hosts Tracie Harris and Matt Dillahunty.

I’ve prepared an OPML file with all 13 feeds for importing. I can recommend DoggCatcher for Android if you don’t already have a podcast player.

Favorite Skeptoid episodes

Skeptoid is an excellent podcast for a skeptical treatment of paranormal claims, conspiracy theories, alternative medicine, etc. Over the past 8 months or so I’ve listened to every episode up to and including #376, and I thought I would share my favorites. The most reward episodes have often been those challenging my own beliefs, since those open the door to learning something new.

Happy listening!

Send mail the first time an IP logs in over SSH

Fail2ban is useful for slowing down brute force attacks against SSH, and in the few days since I enabled it it’s become very clear that these attempts are happening all the time. I don’t want to disable password authentication for all users in case I find myself without my SSH keys, and even if I did it’s not impossible for SSH keys to be compromised. For the day when the walls are breached, I’ve put this in my /etc/ssh/sshrc:

IP="$(echo $SSH_CONNECTION | awk '{print $1}')"
KNOWN_IPS="$HOME/.ssh/known_ips"
if ! grep -Fqsx $IP $KNOWN_IPS; then
  echo $IP >> $KNOWN_IPS
  echo "$IP added to $KNOWN_IPS" | \
    mail -s "ssh $USER@$(hostname) from $IP" spam@foolip.org
fi

It sends me an email the first time a particular IP successfully logs in over SSH. (If you use this, make sure that mail is configured correctly first: dpkg-reconfigure exim4-config in Debian.)

Web hosting

About a month ago, I began looking for a new hosting solution for foolip.org, having started with a wardrobe computer in 2006 and never really having found a stable home. My needs are modest, so I went shopping for the cheapest possible shared hosting. I settled for JustHost, which popped up on many comparison sites and seemed to be good value for money, at $2.81/month including VAT.

JustHost isn’t terrible, but there were a few problems. The server (just44.justhost.com) seemed starved for memory and I was unable to work with my www.git because of it at one point. Another time I couldn’t log in over SSH for the better part of a day. Finally, on August 2, there were some major problems, with my site going up and down like a yo-yo. One of the first things I did was to point Pingdom at foolip.org to get some good uptime data. I have a public status page, where you can judge for yourself.

Wanting more control, I started to look for a VPS instead, and eventually settled on DigitalOcean, based on the location (Netherlands), technology (KVM) and price ($5/month, but counted hourly). As of August 6, foolip.org is hosted on a virtual machine running Debian and nginx. Having root access and doing things the hard way is great, it feels like having a wardrobe computer all over again. Time (and Pingdom) will tell if it’s robust or not, but so far I’m very happy. Also, JustHost will refund me for the remaining time, which is very good of them.

In closing, if I were to pick a Web hosting solution all over again and was not in a hurry, I would try to ignore individual reviews and claimed uptimes, and instead use Pingdom to monitor sites hosted using my candidate solutions before making a decision.

New GPG key

I’ve uploaded a new GPG key to various keyservers, fetch it manually or on the command line:

$ gpg --recv-keys 0xF75964F29DC6C210

Before creating the key, I took inspiration from Ubuntu and Christopher Wellons, arriving at this for my gpg.conf:

cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
personal-cipher-preferences AES256 AES192 AES
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
s2k-cipher-algo AES256
s2k-digest-algo SHA512
s2k-mode 3
s2k-count 65011712

The first half is in order to use the SHA-2 and AES instead of SHA-1 and CAST5, while the s2k settings are there to make brute force as expensive as possible in the event that my private key should be compromised.

I’m starting from scratch with my web of trust, so if you want to play key signing, let me know.