Closed Bug 1338585 Opened 7 years ago Closed 7 years ago

Add an eslint rule to require using .ownerGlobal instead of .ownerDocument.defaultView

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

3 Branch
defect
Not set
normal

Tracking

(firefox54 fixed)

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: florian, Assigned: florian)

References

Details

Attachments

(1 file)

The tree-wide cleanup was already done in bug 1334156, this is just about adding an eslint rule to enforce it.

The rule has to be disabled in a few folders and on a few lines because ownerGlobal isn't defined in content privileged windows.
Attached patch PatchSplinter Review
Attachment #8836129 - Flags: review?(jaws)
Comment on attachment 8836129 [details] [diff] [review]
Patch

Review of attachment 8836129 [details] [diff] [review]:
-----------------------------------------------------------------

::: devtools/client/.eslintrc.js
@@ +3,5 @@
> +module.exports = {
> +  "rules": {
> +    // See bug 1288147, the devtools front-end wants to be able to run in
> +    // content privileged windows, where ownerGlobal doesn't exist.
> +    "mozilla/use-ownerGlobal": 0,

Use "off" instead of 0.

::: devtools/shared/.eslintrc.js
@@ +3,5 @@
> +module.exports = {
> +  "rules": {
> +    // See bug 1288147, the devtools front-end wants to be able to run in
> +    // content privileged windows, where ownerGlobal doesn't exist.
> +    "mozilla/use-ownerGlobal": 0,

Use "off" instead of 0.

::: toolkit/components/prompts/test/.eslintrc.js
@@ +5,5 @@
>      "../../../../testing/mochitest/mochitest.eslintrc.js"
> +  ],
> +  "rules": {
> +    // ownerGlobal doesn't exist in content privileged windows.
> +    "mozilla/use-ownerGlobal": 0,

Use "off" instead of 0.

::: tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
@@ +51,5 @@
>      "no-useless-parameters": 0,
>      "no-useless-removeEventListener": 0,
>      "reject-importGlobalProperties": 0,
>      "reject-some-requires": 0,
> +    "use-ownerGlobal": 0,

Can you please file a bug to convert these to their string alternates? You can clone bug 1316096.
Attachment #8836129 - Flags: review?(jaws) → review+
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #4)

Thanks for the review!

> ::: tools/lint/eslint/eslint-plugin-mozilla/lib/index.js
> @@ +51,5 @@
> >      "no-useless-parameters": 0,
> >      "no-useless-removeEventListener": 0,
> >      "reject-importGlobalProperties": 0,
> >      "reject-some-requires": 0,
> > +    "use-ownerGlobal": 0,
> 
> Can you please file a bug to convert these to their string alternates? You
> can clone bug 1316096.

Filed bug 1339042.
https://hg.mozilla.org/integration/mozilla-inbound/rev/2f98a702c07b52b0a597bddb9a155d8e138d9033
Bug 1338585 - Add an eslint rule to require using .ownerGlobal instead of .ownerDocument.defaultView, r=jaws.
https://hg.mozilla.org/mozilla-central/rev/2f98a702c07b
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: