Enable eslint for browser/base/content/test

RESOLVED FIXED in Firefox 51

Status

()

defect
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: jaws, Assigned: jaws)

Tracking

Trunk
Firefox 51
Points:
---

Firefox Tracking Flags

(firefox51 fixed)

Details

Attachments

(1 attachment)

I have a patch that fixes the eslint errors for /browser/base/content/test. Two of the files have to be ignored due to unresolved parser issues,

browser/base/content/test/general/file_csp_block_all_mixedcontent.html
browser/base/content/test/urlbar/file_blank_but_not_blank.html
Comment hidden (mozreview-request)
This patch depends on the patches in bug 1218937.
Comment hidden (mozreview-request)
Comment hidden (mozreview-request)
Comment on attachment 8785499 [details]
Bug 1298559 - Enable eslint for /browser/base/content/test/

https://reviewboard.mozilla.org/r/74676/#review73352

Thanks Jared!
Attachment #8785499 - Flags: review?(MattN+bmo) → review+
Paolo, /browser/base/content/test/general/browser_sanitize-timespans.js fails with the change made here, specifically the following change:
>  function downloadExists(list, path)
>  {
>-   return Task.spawn(function () {
>+   return Task.spawn(function* () {
>      let listArray = yield list.getAll();
>      throw new Task.Result(listArray.some(i => i.target.path == path));
>    });
>  }

Do you know why changing this function to a generator would cause this test to fail? I'm also a bit curious about why this is throwing the Task.Result.
Flags: needinfo?(paolo.mozmail)

Comment 8

3 years ago
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #7)
> Do you know why changing this function to a generator would cause this test
> to fail? I'm also a bit curious about why this is throwing the Task.Result.

Yep, you just need to "return" instead of using "throw new Task.Result()". Non-star generators don't support returning a completion value using the "return" statement, that's why the trick of propagating a value through a special exception was created.
Flags: needinfo?(paolo.mozmail)

Comment 9

3 years ago
Ah, and you can convert to Task.async() while you're there.

let downloadExists = Task.async(function* (list, path) {
  //...
});

Comment 10

3 years ago
Pushed by jwein@mozilla.com:
https://hg.mozilla.org/integration/fx-team/rev/fdf90317de68
Enable eslint for /browser/base/content/test/ r=mattn

Comment 11

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/fdf90317de68
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 51
You need to log in before you can comment on or make changes to this bug.