Closed Bug 1250254 Opened 8 years ago Closed 8 years ago

Enable ESLint "no-throw-literal" rule for PSM

Categories

(Core :: Security: PSM, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox47 --- fixed

People

(Reporter: Cykesiopka, Assigned: Cykesiopka)

References

Details

Attachments

(1 file)

See Bug 1246594 comment 0 for why doing this is beneficial.

tl;dr: |throw new Error("Foo")| will provide actual line numbers!
https://reviewboard.mozilla.org/r/37339/#review33891

A few notes:
 - See Bug 1251003 comment 0 for why the .eslintrc -> .eslintrc.json rename was done.
 - ESLint doesn't actually catch something like |throw Cr.NS_ERROR_FAILURE|, maybe because it can't tell NS_ERROR_FAILURE is basically a number.
Comment on attachment 8725115 [details]
MozReview Request: Bug 1250254 - Enable ESLint "no-throw-literal" rule for PSM.

https://reviewboard.mozilla.org/r/37339/#review34235

LGTM.

::: security/manager/tools/genHPKPStaticPins.js:129
(Diff revision 1)
> -    throw `ERROR: problem downloading '${filename}': status ${req.status}`;
> +    throw new Error("ERROR: problem downloading '" + filename + "': status " +

I'm assuming the switch from template strings is because of line length?
Attachment #8725115 - Flags: review?(dkeeler) → review+
https://reviewboard.mozilla.org/r/37339/#review34235

Thanks!

> I'm assuming the switch from template strings is because of line length?

Yes. Sadly there doesn't seem to be a way to have a multi-line template literal ignore inner whitespace without using a tag function or something.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=34a1cec792f5
Keywords: checkin-needed
OS: Unspecified → All
Hardware: Unspecified → All
https://hg.mozilla.org/mozilla-central/rev/b670d8ff99ca
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Depends on: 1311570
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: