Closed Bug 1335813 Opened 7 years ago Closed 7 years ago

Enable eslint no-undef for toolkit, apart from components/ and content/

Categories

(Toolkit :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: standard8, Assigned: standard8)

References

Details

Attachments

(1 file)

We're now in a position that we can enable no-undef for some of toolkit - everything bar components/ and content/. Those directories still need a bit of work for common failures.

There's a few actual issues outside of those directory, which this patch covers as well.
Comment on attachment 8832528 [details]
Bug 1335813 - Enable eslint no-undef for toolkit, apart from components/ and content/, and fix various issues.

https://reviewboard.mozilla.org/r/108772/#review109976

::: toolkit/modules/ObjectUtils.jsm:23
(Diff revision 1)
>  
>  // Used only to cause test failures.
>  XPCOMUtils.defineLazyModuleGetter(this, "Promise",
>    "resource://gre/modules/Promise.jsm");
>  
> +var pSlice = Array.prototype.slice;

This fixes an issue that "pSlice" isn't declared further down in the file. I've added a test for this, but I strongly suspect the particular case isn't hit in the tree.

::: toolkit/modules/ZipUtils.jsm:60
(Diff revision 1)
>  
>    function readFailed(error) {
>      try {
>        aStream.close();
>      } catch (e) {
> -      logger.error("Failed to close JAR stream for " + aPath);
> +      Cu.reportError("Failed to close JAR stream for " + aPath);

These were moved from a file that had logger, but this one doesn't.

::: toolkit/modules/moz.build:14
(Diff revision 1)
>  MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
>  MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
>  
>  TESTING_JS_MODULES += [
> -    'tests/MockDocument.jsm',
> -    'tests/PromiseTestUtils.jsm',
> +    'tests/modules/MockDocument.jsm',
> +    'tests/modules/PromiseTestUtils.jsm',

These moved as it means we can enable the xpcshell eslint config for them, but not enable the xpcshell particulars for the other tests in the sub-directories.

::: toolkit/modules/tests/xpcshell/test_sqlite.js
(Diff revision 1)
>  
>      handleError(error) {
>        print("Error when executing SQL (" + error.result + "): " +
>              error.message);
>        print("Original error: " + error.error);
> -      errors.push(error);

It was like this when first committed. Given the promise is rejected, the test will do the right thing.
Comment on attachment 8832528 [details]
Bug 1335813 - Enable eslint no-undef for toolkit, apart from components/ and content/, and fix various issues.

https://reviewboard.mozilla.org/r/108772/#review110030

::: toolkit/modules/tests/browser/browser_InlineSpellChecker.js:6
(Diff revision 1)
> +var InlineSpellChecker;
> +
>  function test() {
>    let tempScope = {};
>    Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm", tempScope);
> -  let InlineSpellChecker = tempScope.InlineSpellChecker;
> +   InlineSpellChecker = tempScope.InlineSpellChecker;

The indentation seems off here.
Attachment #8832528 - Flags: review?(jaws) → review+
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0c237089b317
Enable eslint no-undef for toolkit, apart from components/ and content/, and fix various issues. r=jaws
Note: the updates were addressing the nit, and ensuring the PromiseTestUtils.jsm was correctly marked as moved rather than delete/add.
https://hg.mozilla.org/mozilla-central/rev/0c237089b317
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: