Enable ESLint for dom/cache
Categories
(Core :: DOM: Core & HTML, enhancement, P2)
Tracking
()
People
(Reporter: standard8, Assigned: manuela.monika97, Mentored)
References
Details
(Keywords: good-first-bug, Whiteboard: [lang=js])
Attachments
(2 files)
Reporter | ||
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Reporter | ||
Comment 4•6 years ago
|
||
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Reporter | ||
Comment 7•6 years ago
|
||
Comment 8•6 years ago
|
||
Reporter | ||
Comment 9•6 years ago
|
||
Reporter | ||
Comment 10•6 years ago
|
||
Urvashi, are you still working on this?
Reporter | ||
Comment 11•6 years ago
|
||
I've not heard anything back from Urvashi, so I'm opening this up again.
Assignee | ||
Comment 12•6 years ago
|
||
I'd like to work on this, please
Reporter | ||
Comment 13•6 years ago
|
||
Hi Monika, please do. Feel free to ask questions if you have them.
Assignee | ||
Comment 14•6 years ago
|
||
Hi Mark, right now I'm doing the manual fix for this:
c:\mozilla-source\mozilla-central\dom\cache\test\mochitest\browser_cache_pb_window.js
4:52 error 'name' is already declared in the upper scope. no-shadow (eslint)
Any suggestion as to what I should rename this parameter to?
Reporter | ||
Comment 15•6 years ago
|
||
(In reply to Monika Manuela Hengki from comment #14)
c:\mozilla-source\mozilla-central\dom\cache\test\mochitest\browser_cache_pb_window.js 4:52 error 'name' is already declared in the upper scope. no-shadow (eslint)
Any suggestion as to what I should rename this parameter to?
Hi Monika, the interesting thing with this file is that no-shadow doesn't really apply here. The ContentTask.spawn(browser, name, function(name) {
causes the function(name) {...}
to be run in a different process, so from a processing perspective there's no overlap of variable names.
I think you could just do /* eslint-disable no-shadow */
near the top of the file, and that would be fine.
Assignee | ||
Comment 16•6 years ago
|
||
Hi Mark, currently I'm trying to fix these:
c:\mozilla-source\mozilla-central\dom\cache\test\xpcshell\head.js
24:26 error Use Services.dirsvc rather than getService(). mozilla/use-services (eslint)
73:20 error Use Services.dirsvc rather than getService(). mozilla/use-services (eslint)
Can I check if this is the correct way to fix?
What I understand is that I need to replace
var directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
with Services.dirsvc
to get an instance
I'm having doubts because the docs here says that dirsvc
has 2 Service interfaces, and the fix I suggested above doesn't specifically mention which interface to use.
Thanks!
Reporter | ||
Comment 17•6 years ago
|
||
Hi Monika,
What I understand is that I need to replace
var directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
withServices.dirsvc
to get an instance
So you need to change this to:
var directoryServices = Services.dirsvc;
The Services.jsm file has already done the .getService and made sure the interfaces are available, so you don't need to handle that.
If there aren't too many usages, then you can also drop the intermediate variable, and do Services.dirsvc.get('ProfD', Ci.nsIFile);
direct.
Note, you will need to import Services.jsm, I've just updated it to use the latest format which landed recently:
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Assignee | ||
Comment 18•6 years ago
|
||
Assignee | ||
Comment 19•6 years ago
|
||
Depends on D20943
Reporter | ||
Comment 20•6 years ago
|
||
Henri, did you see the review requests here? Would it better if I pushed them to someone else?
Comment 21•6 years ago
|
||
(In reply to Mark Banner (:standard8) from comment #20)
Henri, did you see the review requests here?
I didn't not sure why. Sorry.
Reporter | ||
Comment 22•6 years ago
|
||
(In reply to Henri Sivonen (:hsivonen) from comment #21)
(In reply to Mark Banner (:standard8) from comment #20)
Henri, did you see the review requests here?
I didn't not sure why. Sorry.
No problem. Thank you for the reviews.
Comment 23•6 years ago
|
||
Reporter | ||
Comment 24•6 years ago
|
||
Hi Monika, now you've got approved patches, I've just landed them on our integration branch for you. If not issues are found, they'll be merged to our master branch within around 24 hours.
Congratulations on getting your first bug fixed.
If you want to find more, please drop me a line with the sort of thing you'd like to do, or take a look on https://codetribute.mozilla.org/ for more.
Comment 25•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/36052e9424f7
https://hg.mozilla.org/mozilla-central/rev/0077a71108eb
Updated•6 years ago
|
Updated•6 years ago
|
Description
•