Firefox extension: why browser.downloads is undefined

I’m can’t understand: why browser.downloads is undefined and how fix it?

Run/test:
web-ext run --firefox="C:\Program Files\Firefox Developer Edition\firefox.exe"

manifest.json:

{
  "manifest_version": 2,
  "name": "ensoloader",
  "version": "1.0",
  "icons": {
    "32": "icons/32.png",
    "48": "icons/48.png"
  },
  "permissions": [
    "downloads",
    "downloads.open",
    "<all_urls>"
  ],
  "content_scripts": [
    {
      "matches": ["<all_urls>"],
      "js": ["loader.js"],
      "all_frames": true
    }
  ]
}

loader.js:

(function() {
    console.log('init loader', browser.downloads);
    browser.downloads.onCreated.addListener(function (file) {
        console.log('browser.downloads.onCreated', file);
    });
    browser.downloads.onChanged.addListener(function (delta) {
        console.log('browser.downloads.onChanged', delta);
    });
})();

The downloads API is not available in content scripts. Only a couple APIs can be used in content scripts directly: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#webextension_apis.

thanks! how i can add listener on file download? add background script?

Yes, add a background script.