Closed Bug 1392354 Opened 2 years ago Closed 2 years ago

Ugly system error when _locales folder is not found

Categories

(WebExtensions :: General, defect)

57 Branch
defect
Not set

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1388266

People

(Reporter: geoffreydebelie, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20170813183258

Steps to reproduce:

When loading a webextension on about:debugging that does not contain a _locales folder (which is optional):

Unix error 2 during operation DirectoryIterator.prototype.next on file /path/addon-webext/_locales (File or directory does not exist)

A slightly different error is shown on Windows as well. Using the latest Nightly. I didn't have this problem a few weeks back.
This is in Extension.jsm:

await iter.forEach(entry => {
  results.push(entry);
});

Some context:

async readDirectory(path) {
    if (this.rootURI instanceof Ci.nsIFileURL) {
      let uri = Services.io.newURI(this.rootURI.resolve("./" + path));
      let fullPath = uri.QueryInterface(Ci.nsIFileURL).file.path;

      let iter = new OS.File.DirectoryIterator(fullPath);
      let results = [];

      try {
        await iter.forEach(entry => {
          results.push(entry);
        });
      } catch (e) {
        // Always return a list, even if the directory does not exist (or is
        // not a directory) for symmetry with the ZipReader behavior.
        Cu.reportError(e);
      }
      iter.close();

      return results;
    }
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1388266
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.