Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

216
Views
Why browser.downloads.dowload hits into "undefined is not an object" error for Safari extension?

While trying to port my extension to Safari (using xcrun safari-web-extension-converter) from Firefox add-on, the browser.downloads.download implementation in my extension to download the user options stored hits into following error:

TypeError: undefined is not an object (evaluating 'browser.downloads.download')

Following lists my implementation for downloading the user options as .csv file:

var enableDebug = 1;
// Function to download CSV file
function downloadCSV(csv, file_name) {
  try {
    var blob = new Blob([csv], {
      type: "text/csv;charset=utf-8"
    });
    browser.downloads.download({
      url: URL.createObjectURL(blob),
      filename: file_name,
      saveAs: true
    });
  } catch (err) {
    if (enableDebug === 1) {
      console.log(err);
    }
  }
}

manifest.json permissions:

"permissions": ["menus", "storage", "unlimitedStorage", "downloads"]

The Safari version being used is 15.4. Looking around the web had given following links which seem relevant, but i'm quite not sure if the issues mentioned in these links are the ones which are causing failure in my case:

browser.downloads API for Safari Web Extensions

Safari error undefined is not an object

I did try with adding the following in entitlements file of XCode, but it didn't help either:

com.apple.security.files.downloads.read-write

Any help to understand the cause and probable solution would be highly appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!