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

RESOLVED FIXED in Firefox 54

Status

Testing
Lint
RESOLVED FIXED
4 months ago
4 months ago

People

(Reporter: florian, Assigned: florian)

Tracking

Version 3
mozilla54
Points:
---

Firefox Tracking Flags

(firefox54 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

4 months ago
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.
(Assignee)

Comment 1

4 months ago
Created attachment 8836129 [details] [diff] [review]
Patch
Attachment #8836129 - Flags: review?(jaws)
Comment hidden (obsolete)
(Assignee)

Comment 3

4 months ago
https://treeherder.mozilla.org/#/jobs?repo=try&revision=78bfff0279a865359b9f44b2eea2b236341573b7
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+
(Assignee)

Comment 5

4 months ago
(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.
(Assignee)

Comment 6

4 months ago
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.

Comment 7

4 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/2f98a702c07b
Status: NEW → RESOLVED
Last Resolved: 4 months ago
status-firefox54: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in before you can comment on or make changes to this bug.