WebExtensions (Firefox): communicating between content and background script

I've just started developing my first WebExtension-based Firefox AddOn, and I have trouble understanding the concept of communicating between content script and background script as described here: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Content_scripts#Communicating_with_background_scripts

I've stripped down the "One-off messages" example to be even simpler (just send the href of the first link to the background script), but it still does not work.

content script:

var links = document.links;
if (links.length > 0) {
  var href = links[0].href;
  browser.runtime.sendMessage( { "url": href } );
  console.log('(content)', href);  // this log works.

background script version 1 (according to Mozilla docs)

console.log('background is here ...'); // this log works.
function notify(message) {
  console.log('(background) ' + message.url);

background script version 2 (found in the web)

console.log('background is here ...'); // this log works.
browser.runtime.onMessage.addListener( function(message,sender,sendResponse) {
  console.log('(background) ' + message.url);

As you see in the comments, some of the console logs work. This means the AddOn is loaded and running. I'm testing it as temporary AddOn in about:debugging. The other console logs do not work. But I've got an error message in the console:

Error: Could not establish connection. Receiving end does not exist.

I guess I must have missed a basic detail in the docs.